Learning TauREx in 5mn

Quentin Changeat
6 min read
Learning TauREx in 5mn

Introduction

TauREx is a powerful tool for exoplanet research and education. In this blogpost, we learn in 5mn how to make an exoplanet spectrum with TauREx3.

Installation and Resources

Install TauREx

This is simply done automatically in command line using:

1
   pip install taurex

Note: we recommend to always manage your python codes using virtual environments (conda or venv).

Obtain the opacity data

For an exoplanet atmosphere model, we need the properties of the main opacity sources. Here, we consider molecular absorption (XSEC) and collision induced absorption (CIA). These can be obtained in this repository:

XSEC: zip folder

CIA: zip folder

Note: for this example, the cross-section data has very low resolution (i.e., it is not usable for research purpose). Higher resolution cross-sections (R > 15k) for TauREx are computed by opacity data groups like ExoMol and are available on their websites.

Obtain the template taurex parfile

TauREx (in command line mode) reads “parfile files” to setup the model run. For our example, a template parfile can be obtained here:

TauREx parfile: zip folder

To continue, unzip the XSEC and CIA folders. Create an “input” folder containing the XSEC and CIA folders in the same directory as the example parfile: this will ensure the path of our example are correct Your working directory should look like this:

Example directory structure
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12

working_dir/
├── input/
│   ├── cia_hitran/
|   |   ├── H2-H2.db
|   |   └── H2-He.db
│   └── xsec_exotransmit/
|       ├── opacCH4.dat
|       ├── opacCO.dat
|       ├── opacCO2.dat
|       └── opacH2O.dat
└── parfile_simple_example.par

This structure makes sense when opening the parfile file. The first Section contains:

parfile_simple_example.par
1
2
3
4

[Global]
xsec_path = inputs/xsec
cia_path = inputs/cia

This of course defines the path to our input opacity data.

Setup the model

To setup the model to our liking, we need to provide additional information. Thankfully, this is already done in the “parfile_simple_example.par” file. Nothing needs to be done for our first run, but let’s get through the different sections anyway.

Planet and Star parameters

The modeled system can be defined under the Planet and Star sections.

parfile_simple_example.par
1
2
3
4

[Planet]
planet_mass = 1.0
planet_radius = 1.0
parfile_simple_example.par
1
2
3
4
5

[Star]
star_type = blackbody
radius = 1.0
temperature = 6000

By default the units are those of Jupiter (i.e., 1.0 Jupiter radius and 1.0 Jupiter masses) to describe the planet and those for the Sun to describe the host star.

Note: Other types of planet or star models are possible. For instance phoenix spectra can be used for stellar model. The temperature parameter is not used for the base transit models, but it plays an essential role in eclipse.

Atmospheric profiles

Now that the system has a star and a planet, the atmospheric 1D structure is described. This includes pressure, thermal, and chemical profiles.

Pressure profiles:

The pressure profile defines the grid to work with and is described under the [Pressure] section. In the base taurex, only plane-parallel equally log-spaced grid in pressure are included. The altitude-pressure profile is constructed using hydrostatic equilibrium. In practice, the min and max pressures of the modeled atmosphere are provided, with the number of grid points (i.e., numerical resolution):

parfile_simple_example.par
1
2
3
4
5
6

[Pressure]
profile_type = Simple
atm_min_pressure = 1e-1
atm_max_pressure = 1e6
nlayers = 100

Chemical profiles:

The chemical profile is described under the [Chemistry] section. Here a simple “free” chemistry (also labeled with keywork taurex) is employed. Trace gases are included using [[gas]] keyword. The type of profile is specified using various keywork. For this example, the profiles have constant-with-altitude mixing ratios. For instance:

parfile_simple_example.par
1
2
3
4

    [[H2O]]
    gas_type = constant
    mix_ratio = 1e-2

After the trace gases are added, the atmosphere is filled with the fill_gases. For a primary atmosphere, it makes sense to use H2 and He as fill_gases since they constitude most of the envelope. A fully working “free” chemistry would look like this:

parfile_simple_example.par
1
2
3
4
5
6
7
8
9

[Chemistry]
chemistry_type = taurex
fill_gases = H2,He
ratio = 0.17

    [[H2O]]
    gas_type = constant
    mix_ratio = 1e-2

Temperature profiles:

The temperature of the atmosphere is parameterized. Here a simple isothermal profile is used:

parfile_simple_example.par
1
2
3
4

[Temperature]
profile_type = isothermal
T = 1200

Since isothermal only has a single parameter, here the entire atmosphere will be at T = 1200 kelvin.

Note: 1D plane-parallel eclipse models should produce blackbody emission with isothermal temperature profiles. Other profile options like NPoints, or Guillot2010 are available (see documentation).

Model and Contributions

Finally, now that we have described all the properties of this exoplanet, we can tell TauREx what model to run. This is done using the [Model] section. We here run a transmission model (or transit model), which is specified under the model_type keyword:

parfile_simple_example.par
1
2
3

[Model]
model_type = transmission

For the atmosphere to do anything, contributions functions need to be added: you can see this as the bits of physics that need to be modeled in the radiative transfer. At minimum, we include [Absorption]: this is using your XSEC input folder information to model molecular absorption. We also want to include the continum from collision induced absorption using [CIA], and from Rayleigh Scattering using [Rayleigh]. Clouds are also common on exoplanets. So, constant absorption clouds, with absorption coefficients (flat_mix_ratio) and top cloud pressure (flat_topP), can be added via the [[FlatMie]] contribution keyword. The full Model section looks like:

parfile_simple_example.par
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14

[Model]
model_type = transmission

    [[Absorption]]

    [[CIA]]
    cia_pairs = H2-He,H2-H2
    
    [[Rayleigh]]

    [[FlatMie]]
    flat_topP = 1e5
    flat_mix_ratio = 10

Run the model

The last step is to run a model! In command line simply navigate to your working directory and execute:

1
   taurex -i parfile_simple_example.par -o output.hdf5

The outputs are saved in the “output.hdf5” file and can be used for plotting our further post-processing. Try plotting the spectrum with:

1
   taurex-plot -i output.hdf5 -s -o plots

The list of accessible options for taurex-plot can be obtained using:

1
   taurex-plot -h

Conclusion

Bravo for running your first TauREx model in < 5mn. Thanks for following this blogpost.

Resources

Where to go next? Have a look at:

TauREx 3

The most advanced exoplanet retrieval platform.