:py:mod:`exo_k.fit` =================== .. py:module:: exo_k.fit .. autoapi-nested-parse:: @author: jeremy leconte This module contain classes to fit a spectrum Module Contents --------------- .. py:class:: Fit(spectrum_to_fit=None, uncertainties=None, fitting_parameters=None, **kwargs) Bases: :py:obj:`object` Class to fit spectra Initialization method. .. py:method:: init_atmosphere(composition=None, Mp=None, **kwargs) initializes atmospheric model :param Mp: Mass of the planet in Kg. :type Mp: :class:`float` .. py:method:: set_fitting_parameters(fitting_parameters=None) :param fitting_paramaters: The parameters to fit. Must be in T, Rp, logx_MOL :type fitting_paramaters: :class:`list` of :class:`str` .. py:method:: set_spectrum_to_fit(spectrum_to_fit=None, uncertainties=None) :param spectrum_to_fit: The spectrum to fit :type spectrum_to_fit: :class:`Spectrum` object :param uncertainties: The uncertainty on each spectral point. :type uncertainties: :class:`float` or :class:`array` .. py:method:: plot_spectrum_to_fit(ax, capsize=0, fmt='k.', ecolor='.7', ylabel='Depth', xlabel='Wavelength', **kwargs) Plots the spectrum that is fitted with uncertainties .. py:method:: transmission_spectrum(parameters, rebin_spectrum=False, **kwargs) Method to compute the spectrum with a new set of parameters .. py:method:: set_cost_function() Defines the cost (or merit) function to minimize. .. py:method:: set_progress_report(Nprint=None) .. py:method:: minimize(initial_guess=None, bounds=None, method='Nelder-Mead', verbose=False, tol=0.1, Nprint=None, **kwargs) Minimizes the cost function over the fitting parameters. :param initial_guess: Initial value for the fitting parameters. Must be in the order declared in fitting_parameters. :type initial_guess: :class:`list` :param bounds: Lower and upper values for the parameters. Must be in the order declared in fitting_parameters. :type bounds: :class:`list` or :class:`2-value arrays` :param method: Method used for minimization. For now, only 'Nelder-Mead' seems to handle bounds and yield relatively good results. :type method: :class:`str` :param tol: tolerance transmitted to sciopt.minimize :type tol: :class:`float` .. py:method:: best_fit() Output last fit results in a dictionary .. py:method:: best_fit_spectrum(rebin_spectrum=False) Returns the spectrum computed with the best fit parameters .. py:method:: contributions(rebin_spectrum=False) Computes a spectrum with each molecule contribution .. py:method:: set_log_likelihood() Defines the log likelihood. .. py:method:: set_bounds(bounds=None) .. py:method:: set_prior_transform(bounds=None) Defines the piors. .. py:method:: sample(bounds=None, method='single', npoints=10, maxcall=None, verbose=False, **kwargs) Minimizes the cost function over the fitting parameters. :param initial_guess: Initial value for the fitting parameters. Must be in the order declared in fitting_parameters. :type initial_guess: :class:`list` :param bounds: Lower and upper values for the parameters. Must be in the order declared in fitting_parameters. :type bounds: :class:`list` or :class:`2-value arrays` :param method: Method used for minimization. For now, only 'Nelder-Mead' seems to handle bounds and yield relatively good results. :type method: :class:`str` :param tol: tolerance transmitted to sciopt.minimize :type tol: :class:`float`