:py:mod:`pytmosph3r.model.model` ================================ .. py:module:: pytmosph3r.model.model Module Contents --------------- .. py:class:: Model(output_file: str = None, n_vertical: Optional[int] = None, noise=None, interp=None, gas_dict=None, aerosols_dict=None, input_atmosphere: Optional[pytmosph3r.atmosphere.InputAtmosphere] = None, opacity: Optional[pytmosph3r.opacity.Opacity] = None, planet: Optional[pytmosph3r.planetary_system.Planet] = None, star: Optional[pytmosph3r.planetary_system.Star] = None, observer: Optional[pytmosph3r.planetary_system.Observer] = None, orbit: Optional[pytmosph3r.planetary_system.Orbit] = None, radiative_transfer=None, transmission: Optional[pytmosph3r.observations.Transmission] = None, emission: Optional[pytmosph3r.observations.Emission] = None, lightcurve: Optional[pytmosph3r.observations.Lightcurve] = None, phasecurve: Optional[pytmosph3r.observations.Phasecurve] = None, parallel=None, **kwargs) Bases: :py:obj:`pytmosph3r.log.Logger` Main model structure which plays the role of the puppeteer. The main function are :func:`build`, which initializes some of the classes once you are sure of your input data (computes altitude for example), and :math:`run`, which basically computes everything (transit depth/emission, ..). All 'property' attributes are derived from :class:`~pytmosph3r.AltitudeAtmosphere`. Main class to control all submodules. Here you control *everything*. :param output_file: HDF5 output filename. :type output_file: str :param n_vertical: Number of vertical layers for the altitude-based :py:attr:`atmosphere` (100 by default). :type n_vertical: int :param noise: If a float, it gives the width of the errorbar (the output spectrum will be noised with a normal distribution scaled with this value). if an array, the noise is simply added to the spectrum. 0 by default. :type noise: float, array :param interp: Interpolation of the pressure in the transformation of the input atmosphere into the altitude-based :py:attr:`atmosphere`. It may be either one the parameters to pass to scipy.interpolate.interp1d function (see 'kind' parameters) or False (default option). If it is set to false, the pressure will be recomputed using :class:`~pytmosph3r.atmosphere.AltitudeAtmosphere.compute_pressure`. :param gas_dict: Dictionary containing the names of the gas and the keys to find them in the input file (diagfi, hdf5). Defaults to {'H2O': 'h2o_vap'}. :param aerosols_dict: Similar to :py:attr:`gas_dict`, it's a dictionary containing the names of the aerosols (and their characteristics) and the keys to find them in the input file (diagfi, hdf5). If only the name of the molecule is given, the key is assumed to represent the MMR (mass molecular ratio in kg/kg). Example : {'H2O': 'h2o_ice', 'H2O_reff': 'H2Oice_reff'}. :param planet: Planet object. :type planet: :class:`~pytmosph3r.planet.Planet` :param star: Star object (not optional). :type star: :class:`~pytmosph3r.star.Star` :param input_atmosphere: Input atmospheric grid based on levels (and inter-layers). :type input_atmosphere: :class:`~pytmosph3r.atmosphere.inputatmosphere.InputAtmosphere` :param observer: Position of the observer (latitude, longitude). :type observer: :class:`~pytmosph3r.rays.Observer` :param opacity: Opacity parameters. :type opacity: :class:`~pytmosph3r.opacity.Opacity` :param transmission: Transmission parameters. :type transmission: :class:`~pytmosph3r.transmission.Transmission` :param emission: Emission parameters. :type emission: :class:`~pytmosph3r.emission.Emission` :param lightcurve: Lightcurve parameters. :type lightcurve: :class:`~pytmosph3r.lightcurve.Lightcurve` :param phasecurve: Phasecurve parameters. :type phasecurve: :class:`~pytmosph3r.phasecurve.Phasecurve` :param kwargs: You can use set/override other parameters using this. :type kwargs: dict .. py:property:: default_values .. py:property:: stats_file File with profiling statistics. Profiling is activated by :func:`start_profiling` and saved in :func:`dump_profiling`. Defaults to the same name as `output_file`, with '.prof' as a file extension. .. py:property:: atmosphere .. py:property:: doppler .. py:property:: grid .. py:property:: shape .. py:property:: n_latitudes :type: int .. py:property:: n_longitudes :type: int .. py:property:: n_layers :type: int .. py:property:: n_levels :type: int .. py:property:: altitude .. py:property:: pressure .. py:property:: temperature .. py:property:: molar_mass .. py:property:: gas_mix_ratio .. py:property:: aerosols .. py:property:: Rs .. py:property:: surface Surface area at each latitude x longitude. .. py:property:: spectrum .. py:property:: wns .. py:property:: wnedges .. py:property:: wls .. py:property:: wledges .. py:property:: spectrum_value .. py:property:: spectrum_noised .. py:attribute:: noised_spectrum :type: Optional[exo_k.Spectrum] Noiseless spectrum. .. py:attribute:: modes :value: ['transmission', 'lightcurve', 'emission', 'phasecurve'] Names of modes, and their order of computation. .. py:method:: outputs() .. py:method:: start_profiling(file=None) Start profiling code. Can specify in which `file` (optional). .. py:method:: dump_profiling(file=None) Save profiling stats in `file` (optional, defaults to `stats_file`). .. py:method:: Rp() .. py:method:: gas(gas) Return the key corresponding to :attr:`gas` using user dictionary :attr:`gas_dict`. .. py:method:: aerosol(aerosol) Return the key corresponding to :attr:`aerosol` using user dictionary :attr:`aerosols_dict`. .. py:method:: read_data() .. py:method:: override_data_file(params) This method allows subclasses to override the data read from data file (HDF5, diagfi, ...) .. py:method:: override_file_param(data_name, config) Override an element from the datafile :param data_name: name of attribute to override :type data_name: string :param config: object read from config file :type config: object .. py:method:: default_value(data_name, value) .. py:method:: build() Initialize the model once all the parameters have been set. Set default values if needed. .. py:method:: run(profiling=False) Run Pytmosph3R, i.e., compute the spectrum of a built model (the function :py:attr:`build` (or an equivalent) should have been called). .. py:class:: FileModel(filename: str, *args, **kwargs) Bases: :py:obj:`Model` Model reading from a file. Same parameters as :class:`~pytmosph3r.model.model.Model`, with the addition of a :attr:`filename`. Main class to control all submodules. Here you control *everything*. :param output_file: HDF5 output filename. :type output_file: str :param n_vertical: Number of vertical layers for the altitude-based :py:attr:`atmosphere` (100 by default). :type n_vertical: int :param noise: If a float, it gives the width of the errorbar (the output spectrum will be noised with a normal distribution scaled with this value). if an array, the noise is simply added to the spectrum. 0 by default. :type noise: float, array :param interp: Interpolation of the pressure in the transformation of the input atmosphere into the altitude-based :py:attr:`atmosphere`. It may be either one the parameters to pass to scipy.interpolate.interp1d function (see 'kind' parameters) or False (default option). If it is set to false, the pressure will be recomputed using :class:`~pytmosph3r.atmosphere.AltitudeAtmosphere.compute_pressure`. :param gas_dict: Dictionary containing the names of the gas and the keys to find them in the input file (diagfi, hdf5). Defaults to {'H2O': 'h2o_vap'}. :param aerosols_dict: Similar to :py:attr:`gas_dict`, it's a dictionary containing the names of the aerosols (and their characteristics) and the keys to find them in the input file (diagfi, hdf5). If only the name of the molecule is given, the key is assumed to represent the MMR (mass molecular ratio in kg/kg). Example : {'H2O': 'h2o_ice', 'H2O_reff': 'H2Oice_reff'}. :param planet: Planet object. :type planet: :class:`~pytmosph3r.planet.Planet` :param star: Star object (not optional). :type star: :class:`~pytmosph3r.star.Star` :param input_atmosphere: Input atmospheric grid based on levels (and inter-layers). :type input_atmosphere: :class:`~pytmosph3r.atmosphere.inputatmosphere.InputAtmosphere` :param observer: Position of the observer (latitude, longitude). :type observer: :class:`~pytmosph3r.rays.Observer` :param opacity: Opacity parameters. :type opacity: :class:`~pytmosph3r.opacity.Opacity` :param transmission: Transmission parameters. :type transmission: :class:`~pytmosph3r.transmission.Transmission` :param emission: Emission parameters. :type emission: :class:`~pytmosph3r.emission.Emission` :param lightcurve: Lightcurve parameters. :type lightcurve: :class:`~pytmosph3r.lightcurve.Lightcurve` :param phasecurve: Phasecurve parameters. :type phasecurve: :class:`~pytmosph3r.phasecurve.Phasecurve` :param kwargs: You can use set/override other parameters using this. :type kwargs: dict .. py:method:: read_data(*args, **kwargs) :abstractmethod: Adapt this function according to your format. See :func:`~pytmosph3r.model.diagfimodel.DiagfiModel.read_data` for an example. .. py:method:: inputs()