exo_k.fit
@author: jeremy leconte
This module contain classes to fit a spectrum
Module Contents
- class exo_k.fit.Fit(spectrum_to_fit=None, uncertainties=None, fitting_parameters=None, **kwargs)[source]
Bases:
object
Class to fit spectra
Initialization method.
- cost_function = None
- atm = None
- N_iter = 0
- spectrum_to_fit = None
- init_atmosphere(composition=None, Mp=None, **kwargs)[source]
initializes atmospheric model
- Parameters:
Mp (
float
) – Mass of the planet in Kg.
- set_spectrum_to_fit(spectrum_to_fit=None, uncertainties=None)[source]
- Parameters:
spectrum_to_fit (
Spectrum
object) – The spectrum to fituncertainties (
float
orarray
) – The uncertainty on each spectral point.
- plot_spectrum_to_fit(ax, capsize=0, fmt='k.', ecolor='.7', ylabel='Depth', xlabel='Wavelength', **kwargs)[source]
Plots the spectrum that is fitted with uncertainties
- transmission_spectrum(parameters, rebin_spectrum=False, **kwargs)[source]
Method to compute the spectrum with a new set of parameters
- minimize(initial_guess=None, bounds=None, method='Nelder-Mead', verbose=False, tol=0.1, Nprint=None, **kwargs)[source]
Minimizes the cost function over the fitting parameters.
- Parameters:
initial_guess (
list
) – Initial value for the fitting parameters. Must be in the order declared in fitting_parameters.bounds (
list
or2-value arrays
) – Lower and upper values for the parameters. Must be in the order declared in fitting_parameters.method (
str
) – Method used for minimization. For now, only ‘Nelder-Mead’ seems to handle bounds and yield relatively good results.tol (
float
) – tolerance transmitted to sciopt.minimize
- best_fit_spectrum(rebin_spectrum=False)[source]
Returns the spectrum computed with the best fit parameters
- sample(bounds=None, method='single', npoints=10, maxcall=None, verbose=False, **kwargs)[source]
Minimizes the cost function over the fitting parameters.
- Parameters:
initial_guess (
list
) – Initial value for the fitting parameters. Must be in the order declared in fitting_parameters.bounds (
list
or2-value arrays
) – Lower and upper values for the parameters. Must be in the order declared in fitting_parameters.method (
str
) – Method used for minimization. For now, only ‘Nelder-Mead’ seems to handle bounds and yield relatively good results.tol (
float
) – tolerance transmitted to sciopt.minimize