Skip to main content

Python Wrapper for GGchem chemical scheme

Project description

TauREx-GGchem plugin

A Python wrapper built using the TauREx is available. The wrapper also installs all available datafiles included with GGchem

Installation

You can install one of the prebuilt binary wheels for Windows, macOS and manylinux through pip:

pip install taurex_ggchem

Installing from source

To install from source a valid C/C++ and FORTRAN compiler must be present. You can compile it by doing:

git clone https://github.com/ucl-exoplanets/GGchem.git
cd GGchem
pip install .

Running in TauREx

Once installed you can select the chemical model through the chemistry_type keyword under Chemistry.

[Chemistry]
chemistry_type = ggchem
metallicity = 1.0
selected_elements = H, He, C, N, O, Ti, V, S, K
ratio_elements = C, N, Ti
ratios_to_O = 0.5,0.001, 1e-4
equilibrium_condensation = True

[Fitting]
Ti_O_ratio:fit = True
Ti_O_ratio:prior = "LogUniform(bounds=(-6,2))"
S_O_ratio:fit = True
S_O_ratio:prior = "LogUniform(bounds=(-6,2))"
metallicity:fit = True
metallicity:prior = "LogUniform(bounds=(-6,2))"

Input arguments:

Argument Description Type Default Required
dispol_files Path to thermochemical data list of strings Built-in (BarklemCollet,StockKitzmann_withoutTsuji, WoitkeRefit )
abundance_profile Initial abundance profile. Either solar, meteor, ocean or earth string 'solar'
selected_elements List of elements to include list of string All elements in GGchem
ratio_elements List of elements to set the ratio list of string
ratios_to_O ratio of each 'ratio_element' relative to oxygen array
he_h_ratio He/H ratio float 0.083
metallicity Metallicity relative to initial abundance float 1.0
include_charge Include ions bool False
equilibrium_condensation Include condenstation bool False
dustchem_file Dust chemistry file string Built-in (DustChem.dat)
Tfast Lowest temperature (K) to use faster method float 1000
new_back_it integer 6
new_back_fac float 1e5
new_pre_method integer 2
new_full_it bool False
new_fast_level integer 1

Retrieval Parameters:

Fitting Parameter Description
metallicity Metallicity relative to solar

The wrapper will generate oxygen retrieval parameters for all metallic elements within the chemical model. If Ti is present (either by default or specifing in selected_elements) then a Ti_O_ratio retrieval parameter will be available. Using the default selected_parameters will give access to:

Fitting Parameter Description
C_O_ratio C/O ratio
N_O_ratio N/O ratio
Na_O_ratio Na/O ratio
Mg_O_ratio Mg/O ratio
Si_O_ratio Si/O ratio
Fe_O_ratio Fe/O ratio
Al_O_ratio Al/O ratio
Ca_O_ratio Ca/O ratio
Ti_O_ratio Ti/O ratio
S_O_ratio S/O ratio
Cl_O_ratio Cl/O ratio
K_O_ratio K/O ratio
Li_O_ratio Li/O ratio
F_O_ratio F/O ratio
P_O_ratio P/O ratio
V_O_ratio V/O ratio
Cr_O_ratio Cr/O ratio
Mn_O_ratio Mn/O ratio
Ni_O_ratio Ni/O ratio
Zr_O_ratio Zr/O ratio
W_O_ratio W/O ratio

Running in Python

You can import the chemistry scheme in Python pretty easily

>>> from taurex_ggchem import GGChem
>>> gg = GGChem(metallicity=1.0,  
         selected_elements=['H','He','C','O','N','K'], 
         abundance_profile='earthcrust', 
         equilibrium_condensation=True) 

You can either pass it into a TauREx forward model like so:

>>> tm = TransmissionModel(chemistry=gg)

Or use it independently to compute volume mixing ratios for gas-phase and condensates by passing in temperature and pressure ( Pascal ) arrays:

>>> nlayers = 100
>>> T = numpy.linspace(400,1000,nlayers)
>>> P = numpy.logspace(1,5, nlayers)
>>> gg.initialize_chemistry(nlayers=nlayers, temperature_profile=T, pressure_profile=P)
>>> gg.gases
['H', 'He', 'C', 'O', 'N',..., 'N3', 'O3', 'C3H']
>>> gg.mixProfile
array([[4.75989782e-04, 4.93144149e-04, 5.10561665e-04, ...,
        2.89575385e-05, 2.47386006e-05, 2.10241059e-05],
       ...,
       [2.49670621e-16, 1.44224904e-16, 8.29805526e-17, ...,
        9.48249338e-42, 4.75884162e-42, 2.37999459e-42]])
>>> gg.condensates
['C[s]', 'H2O[s]', 'H2O[l]', 'NH3[s]', 'CH4[s]', 'CO[s]', 'CO2[s]']
>>> gg.condensateMixProfile
array([[0.00000000e+00, 0.00000000e+00, 0.00000000e+00,...,
        0.00000000e+00, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ...,
        0.00000000e+00, 9.82922802e-10, 1.88551848e-10, 2.88471985e-11,
        4.40651877e-12, 6.95597887e-13],
        ...,
        [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ...,
        0.00000000e+00, 0.00000000e+00]])

Bibliography

If you use the plugin please cite the relevant articles. TauREx will output it at program end. You can get the citation from Python like so:

from taurex import __citations__
print(__citations__)
print(gg.nice_citation())

Which gives:

TauREx III: A fast, dynamic and extendable framework for retrievals
Al-Refaie, Ahmed F., Changeat, Quentin, Waldmann, Ingo P., Tinetti, Giovanna
arXiv, 1912.07759, 2019

Equilibrium chemistry down to 100 K - Impact of silicates and phyllosilicates on the carbon to oxygen ratio
Woitke, P., Helling, Ch., Hunter, G. H., Millard, J. D., Turner, G. E., Worters, M., Blecic, J., Stock, J. W.
A&A, 614, A1, 2018

You can also generate bibtex from the input file like so:

taurex -i myinput.par --bibtex mybib.bib

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

taurex_ggchem-1.0.0.dev0-cp39-cp39-win_amd64.whl (918.8 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

taurex_ggchem-1.0.0.dev0-cp39-cp39-manylinux2010_i686.whl (1.6 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686

taurex_ggchem-1.0.0.dev0-cp39-cp39-manylinux1_x86_64.whl (950.7 kB view hashes)

Uploaded CPython 3.9

taurex_ggchem-1.0.0.dev0-cp39-cp39-macosx_10_9_x86_64.whl (727.4 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

taurex_ggchem-1.0.0.dev0-cp38-cp38-win_amd64.whl (914.1 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

taurex_ggchem-1.0.0.dev0-cp38-cp38-manylinux2010_i686.whl (1.6 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

taurex_ggchem-1.0.0.dev0-cp38-cp38-manylinux1_x86_64.whl (946.2 kB view hashes)

Uploaded CPython 3.8

taurex_ggchem-1.0.0.dev0-cp38-cp38-macosx_10_9_x86_64.whl (726.9 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

taurex_ggchem-1.0.0.dev0-cp37-cp37m-win_amd64.whl (913.6 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

taurex_ggchem-1.0.0.dev0-cp37-cp37m-manylinux2010_i686.whl (1.6 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686

taurex_ggchem-1.0.0.dev0-cp37-cp37m-manylinux1_x86_64.whl (946.2 kB view hashes)

Uploaded CPython 3.7m

taurex_ggchem-1.0.0.dev0-cp37-cp37m-macosx_10_9_x86_64.whl (726.8 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

taurex_ggchem-1.0.0.dev0-cp36-cp36m-win_amd64.whl (808.6 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

taurex_ggchem-1.0.0.dev0-cp36-cp36m-manylinux2010_i686.whl (1.5 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ i686

taurex_ggchem-1.0.0.dev0-cp36-cp36m-manylinux1_x86_64.whl (944.5 kB view hashes)

Uploaded CPython 3.6m

taurex_ggchem-1.0.0.dev0-cp36-cp36m-macosx_10_9_x86_64.whl (726.7 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page