Chemistry Models (taurex.chemistry)

Base

class Chemistry(name)[source]

Bases: taurex.data.fittable.Fittable, taurex.log.logger.Logger, taurex.output.writeable.Writeable, taurex.data.citation.Citable

Abstract Class

Skeleton for defining chemistry. Must implement methods:

Active are those that are actively absorbing in the atmosphere. In technical terms they are molecules that have absorption cross-sections. You can see which molecules are able to actively absorb by doing: You can find out what molecules can actively absorb by doing:

>>> avail_active_mols = OpacityCache().find_list_of_molecules()
Parameters

name (str) – Name used in logging

property activeGasMixProfile

Requires implementation

Should return profiles of shape (nactivegases,nlayers). Active refers to gases that are actively absorbing in the atmosphere. Another way to put it these are gases where molecular cross-sections are used.

property activeGases

Requires implementation

Should return a list of molecule names

Returns

active – List of active gases

Return type

list

property availableActive

Returns a list of available actively absorbing molecules

Returns

molecules – Actively absorbing molecules

Return type

list

compute_mu_profile(nlayers)[source]

Computes molecular weight of atmosphere for each layer

Parameters

nlayers (int) – Number of layers

property condensateMixProfile

Requires implementation

Should return profiles of shape (ncondensates,nlayers).

property condensates

Returns a list of condensates in the atmosphere.

Returns

active – List of condensates

Return type

list

property gases
get_condensate_mix_profile(condensate_name)[source]

Returns the mix profile of a particular condensate

Parameters

condensate_name (str) – Name of condensate

Returns

mixprofile – Mix profile of condensate with shape (nlayer)

Return type

array

get_gas_mix_profile(gas_name)[source]

Returns the mix profile of a particular gas

Parameters

gas_name (str) – Name of gas

Returns

mixprofile – Mix profile of gas with shape (nlayer)

Return type

array

get_molecular_mass(molecule)[source]
property hasCondensates
property inactiveGasMixProfile

Requires implementation

Should return profiles of shape (ninactivegases,nlayers).

property inactiveGases

Requires implementation

Should return a list of molecule names

Returns

inactive – List of inactive gases

Return type

list

initialize_chemistry(nlayers=100, temperature_profile=None, pressure_profile=None, altitude_profile=None)[source]

Requires implementation

Derived classes should implement this to compute the active and inactive gas profiles

Parameters
  • nlayers (int) – Number of layers in atmosphere

  • temperature_profile (array) – Temperature profile in K, must have length nlayers

  • pressure_profile (array) – Pressure profile in Pa, must have length nlayers

  • altitude_profile (array) – Altitude profile in m, must have length nlayers

property mixProfile
property mu
property muProfile

Molecular weight for each layer of atmosphere

Returns

mix_profile

Return type

array

set_star_planet(star, planet)[source]

Supplies the star and planet to chemistry for photochemistry reasons. Does nothing by default

Parameters
  • star (Star) – A star object

  • planet (Planet) – A planet object

write(output)[source]

Writes chemistry class and arguments to file

Parameters

output (Output) –

Base (Auto)

class AutoChemistry(name)[source]

Bases: taurex.data.profiles.chemistry.chemistry.Chemistry

Chemistry class that automatically seperates out active and inactive gases

Has a helper function that should be called when

Parameters

name (str) – Name of class

property activeGasMixProfile

Active gas layer by layer mix profile

Returns

active_mix_profile

Return type

array

property activeGases

Requires implementation

Should return a list of molecule names

Returns

active – List of active gases

Return type

list

compute_mu_profile(nlayers)[source]

Computes molecular weight of atmosphere for each layer

Parameters

nlayers (int) – Number of layers

determine_active_inactive()[source]
property gases
property inactiveGasMixProfile

Inactive gas layer by layer mix profile

Returns

inactive_mix_profile

Return type

array

property inactiveGases

Requires implementation

Should return a list of molecule names

Returns

inactive – List of inactive gases

Return type

list

property mixProfile

Equilibrium Chemistry (ACE)

Warning

This is no longer available in the base TauREx 3 since version 3.1. To use this you must install the taurex_ace plugin.

Free chemistry

exception InvalidChemistryException[source]

Bases: taurex.exceptions.InvalidModelException

Exception that is called when atmosphere mix is greater than unity

class TaurexChemistry(fill_gases=['H2', 'He'], ratio=0.17567, derived_ratios=[], base_metallicty=0.013)[source]

Bases: taurex.data.profiles.chemistry.autochemistry.AutoChemistry

The standard chemical model used in Taurex. This allows for the combination of different mixing profiles for each molecule. Lets take an example profile, we want an atmosphere with a constant mixing of H2O but two layer mixing for CH4. First we initialize our chemical model:

>>> chemistry = TaurexChemistry()

Then we can add our molecules using the addGas() method. Lets start with H2O, since its a constant profile for all layers of the atmosphere we thus add the ConstantGas object:

>>> chemistry.addGas(ConstantGas('H2O',mix_ratio = 1e-4))

Easy right? Now the same goes for CH4, we can add the molecule into the chemical model by using the correct profile (in this case TwoLayerGas):

>>> chemistry.addGas(TwoLayerGas('CH4',mix_ratio_surface=1e-4,
                                 mix_ratio_top=1e-8))
Molecular profiles available are:
Parameters
  • fill_gases (str or list) – Either a single gas or list of gases to fill the atmosphere with

  • ratio (float or list) – If a bunch of molecules are used to fill an atmosphere, whats the ratio between them? The first fill gas is considered the main one with others defined as molecule / main_molecule

addGas(gas)[source]

Adds a gas in the atmosphere.

Parameters

gas (Gas) – Gas to add into the atmosphere. Only takes effect on next initialization call.

citations()[source]
compute_elements_mix()[source]
fill_atmosphere(mixratio_remainder)[source]
fitting_parameters()[source]

Overrides the fitting parameters to return one with all the gas profile parameters as well

Returns

fit_param

Return type

dict

property gases
get_element_ratio(elem_ratio)[source]
get_metallicity()[source]
initialize_chemistry(nlayers=100, temperature_profile=None, pressure_profile=None, altitude_profile=None)[source]

Initializes the chemical model and computes the all gas profiles and the mu profile for the forward model

classmethod input_keywords()[source]
isActive(gas)[source]

Determines if the gas is active or not (Whether we have cross-sections)

Parameters

gas (str) – Name of molecule

Returns

True if active

Return type

bool

property metallicity
property mixProfile
setup_derived_params(ratio_list)[source]
setup_fill_params()[source]
write(output)[source]

Writes chemistry class and arguments to file

Parameters

output (Output) –

Gas Models (taurex.chemistry)

Base

class Gas(name, molecule_name)[source]

Bases: taurex.data.fittable.Fittable, taurex.log.logger.Logger, taurex.output.writeable.Writeable, taurex.data.citation.Citable

Abstract Class

This class is a base for a single molecule or gas. Its used to describe how it mixes at each layer and combined with TaurexChemistry is used to build a chemical profile of the planets atmosphere. Requires implementation of:

  • func:~mixProfile

Parameters
  • name (str) – Name used in logging

  • molecule_name (str) – Name of molecule

initialize_profile(nlayers=None, temperature_profile=None, pressure_profile=None, altitude_profile=None)[source]

Initializes and computes mix profile

Parameters
  • nlayers (int) – Number of layers in atmosphere

  • temperature_profile (array) – Temperature profile of atmosphere in K. Length must be equal to nlayers

  • pressure_profile (array) – Pressure profile of atmosphere in Pa. Length must be equal to nlayers

  • altitude_profile (array) – Altitude profile of atmosphere in m. Length must be equal to nlayers

property mixProfile

Requires implementation

Should return mix profile of molecule/gas at each layer

Returns

mix – Mix ratio for molecule at each layer

Return type

array

property molecule

returns: molecule_name – Name of molecule :rtype: str

write(output)[source]

Writes class and arguments to file

Parameters

output (Output) –

Constant

class ConstantGas(molecule_name='H2O', mix_ratio=1e-05)[source]

Bases: taurex.data.profiles.chemistry.gas.gas.Gas

Constant gas profile. Molecular abundace is constant at each layer of the atmosphere

Parameters
  • molecule_name (str) – Name of molecule

  • mix_ratio (float) – Mixing ratio of the molecule

add_active_gas_param()[source]

Adds the mixing ratio as a fitting parameter as the name of the molecule

initialize_profile(nlayers=None, temperature_profile=None, pressure_profile=None, altitude_profile=None)[source]

Initializes and computes mix profile

Parameters
  • nlayers (int) – Number of layers in atmosphere

  • temperature_profile (array) – Temperature profile of atmosphere in K. Length must be equal to nlayers

  • pressure_profile (array) – Pressure profile of atmosphere in Pa. Length must be equal to nlayers

  • altitude_profile (array) – Altitude profile of atmosphere in m. Length must be equal to nlayers

classmethod input_keywords()[source]
property mixProfile

Mixing profile

Returns

mix – Mix ratio for molecule at each layer

Return type

array

write(output)[source]

Writes class and arguments to file

Parameters

output (Output) –

Two Layer

class TwoLayerGas(molecule_name='CH4', mix_ratio_surface=0.0001, mix_ratio_top=1e-08, mix_ratio_P=1000.0, mix_ratio_smoothing=10)[source]

Bases: taurex.data.profiles.chemistry.gas.gas.Gas

Two layer gas profile.

A gas profile with two different mixing layers at the surface of the planet and top of the atmosphere seperated at a defined pressure point and smoothened.

Parameters
  • molecule_name (str) – Name of molecule

  • mix_ratio_surface (float) – Mixing ratio of the molecule on the planet surface

  • mix_ratio_top (float) – Mixing ratio of the molecule at the top of the atmosphere

  • mix_ratio_P (float) – Boundary Pressure point between the two layers

  • mix_ratio_smoothing (float , optional) – smoothing window

BIBTEX_ENTRIES = ['\n @misc{changeat2019complex,\n title={Towards a more complex description of chemical profiles in exoplanets retrievals: A 2-layer parameterisation},\n author={Quentin Changeat and Billy Edwards and Ingo Waldmann and Giovanna Tinetti},\n year={2019},\n eprint={1903.11180},\n archivePrefix={arXiv},\n primaryClass={astro-ph.EP}\n }\n ']
add_P_param()[source]

Generates pressure fitting parameter. Has the form ‘Moleculename_P’

add_surface_param()[source]

Generates surface fitting parameters. Has the form ‘’Moleculename_surface’

add_top_param()[source]

Generates TOA fitting parameters. Has the form: ‘Moleculename_top’

initialize_profile(nlayers=None, temperature_profile=None, pressure_profile=None, altitude_profile=None)[source]

Initializes and computes mix profile

Parameters
  • nlayers (int) – Number of layers in atmosphere

  • temperature_profile (array) – Temperature profile of atmosphere in K. Length must be equal to nlayers

  • pressure_profile (array) – Pressure profile of atmosphere in Pa. Length must be equal to nlayers

  • altitude_profile (array) – Altitude profile of atmosphere in m. Length must be equal to nlayers

classmethod input_keywords()[source]
property mixProfile

returns: mix – Mix ratio for molecule at each layer :rtype: array

property mixRatioPressure
property mixRatioSmoothing
property mixRatioSurface

Abundance on the planets surface

property mixRatioTop

Abundance on the top of atmosphere

write(output)[source]

Writes class and arguments to file

Parameters

output (Output) –

Array

class TwoLayerGas(molecule_name='CH4', mix_ratio_surface=0.0001, mix_ratio_top=1e-08, mix_ratio_P=1000.0, mix_ratio_smoothing=10)[source]

Bases: taurex.data.profiles.chemistry.gas.gas.Gas

Two layer gas profile.

A gas profile with two different mixing layers at the surface of the planet and top of the atmosphere seperated at a defined pressure point and smoothened.

Parameters
  • molecule_name (str) – Name of molecule

  • mix_ratio_surface (float) – Mixing ratio of the molecule on the planet surface

  • mix_ratio_top (float) – Mixing ratio of the molecule at the top of the atmosphere

  • mix_ratio_P (float) – Boundary Pressure point between the two layers

  • mix_ratio_smoothing (float , optional) – smoothing window

BIBTEX_ENTRIES = ['\n @misc{changeat2019complex,\n title={Towards a more complex description of chemical profiles in exoplanets retrievals: A 2-layer parameterisation},\n author={Quentin Changeat and Billy Edwards and Ingo Waldmann and Giovanna Tinetti},\n year={2019},\n eprint={1903.11180},\n archivePrefix={arXiv},\n primaryClass={astro-ph.EP}\n }\n ']
add_P_param()[source]

Generates pressure fitting parameter. Has the form ‘Moleculename_P’

add_surface_param()[source]

Generates surface fitting parameters. Has the form ‘’Moleculename_surface’

add_top_param()[source]

Generates TOA fitting parameters. Has the form: ‘Moleculename_top’

initialize_profile(nlayers=None, temperature_profile=None, pressure_profile=None, altitude_profile=None)[source]

Initializes and computes mix profile

Parameters
  • nlayers (int) – Number of layers in atmosphere

  • temperature_profile (array) – Temperature profile of atmosphere in K. Length must be equal to nlayers

  • pressure_profile (array) – Pressure profile of atmosphere in Pa. Length must be equal to nlayers

  • altitude_profile (array) – Altitude profile of atmosphere in m. Length must be equal to nlayers

classmethod input_keywords()[source]
property mixProfile

returns: mix – Mix ratio for molecule at each layer :rtype: array

property mixRatioPressure
property mixRatioSmoothing
property mixRatioSurface

Abundance on the planets surface

property mixRatioTop

Abundance on the top of atmosphere

write(output)[source]

Writes class and arguments to file

Parameters

output (Output) –