Cross Sections for an Ultra Hot Jupiter

This script shows how to cmopute line-sampled molecular cross sections, to be used for atmospheric modeling and retrievals. There are four main steps to compute cross-section files:

  1. Download line-list data

  2. Compute partition functions

  3. Compute TLI files

  4. Sample cross sections

Note that the first three steps are typically executed only once, allowing you to reuse the output files across projects. If you have already the tli files that you need, go directly to Step 4.

Step 4 may need to be executed on a per-project basis, depending on your specific requirements (e.g., different spectral, temperature, or pressure ranges; or varying resolutions).


1. Line Lists

First we need to download the line lists, typically sourced from the ExoMol or HITRAN/HITEMP databases. You will likely only need to complete this step once unless a new or updated line list becomes available. It may be better to store this data in a general directory on your machine.

For this project, we will focus on the molecular absorbers relevant for an ultra-hot Jupiter (WASP-18b). The table below lists the line lists that we will use.

Molecular line lists

Species (source)

References

H2O (exomol, pokazatel)

[Polyansky2018]

CO (HITEMP, li)

[Li2015]

CO2 (ames, ai3000k)

[Huang2023]

CH4 (exomol, mm)

[Yurchenko2024a]

TiO (exomol, toto)

[McKemmish2019]

VO (exomol, hyvo)

[Bowesman2024]

HCN (exomol, harris larner)

[Harris2008] [Barber2014]

NH3 (exomol, coyute)

[Coles2019] [Yurchenko2024b]

C2H2 (exomol, acety)

[Chubb2020]

These datasets contain around 200 billion transitions, so it would be impractical to work with the full set of line lists. Instead, we work with the datasets processed with repack [Cubillos2017b], which filtered the dominant transitions at each wavelength, and thus reduced the number of lines to model. The file below contains the actual files to download.

https://zenodo.org/records/14046762/files/H2O_exomol_pokazatel_0.24-500.0um_100-3500K_threshold_0.01_lbl.dat
https://hitran.org/hitemp/data/bzip2format/05_HITEMP2019.par.bz2
https://zenodo.org/records/14266247/files/CO2_ames_ai3000k_0.5-50.0um_100-3500K_threshold_0.01_lbl.dat
https://zenodo.org/records/14046762/files/CH4_exomol_mm_0.83-50.0um_100-3000K_threshold_0.03_lbl.dat/content
https://zenodo.org/records/14046762/files/TiO_exomol_toto_0.33-500um_100-3500K_threshold_0.01_lbl.dat
https://zenodo.org/records/14046762/files/VO_exomol_hyvo_0.22-50um_100-3500K_threshold_0.01_lbl.dat
https://zenodo.org/records/14046762/files/HCN_exomol_harris-larner_0.56-500um_100-3500K_threshold_0.01_lbl.dat
https://zenodo.org/records/14266247/files/NH3_exomol_coyute_0.5-500.0um_100-3000K_threshold_0.01_lbl.dat
https://zenodo.org/records/14046762/files/C2H2_exomol_acety_1.0-500.0um_100-3500K_threshold_0.03_lbl.dat

Here’s a script to download these files from the command line using wget. First, make sure to copy the text file above to your current folder:

# Download line lists (note there are several GBs of data):
wget -i wasp18b_line_lists_data.txt

# Unzip the HITEMP data:
bzip2 -d 05_HITEMP2019.par.bz2

2. Partition Functions

In addition to the line-list data, we need the partition functions for each molecule and isotope. For this we will use again the data provided by ExoMol and HITRAN TIPS ([Gamache2017] [Gamache2021]).

What’s really important is to be aware of the temperature range of the partition functions. For an ultra hot Jupiter like WASP-18b, we want cross sections as hot as ~5000K. So, the strategy will be to use the tabulated partition functions files (.pf files) when they cover the temperatures we need. Otherwise, we will compute the partition from the .states files. For CO2 I provide the partitions computed from the Ames states files.

This file below contains links to the input partition-function data from Exomol, ames, and HITRAN:

http://www.exomol.com/db/H2O/1H2-16O/POKAZATEL/1H2-16O__POKAZATEL.pf
https://www.exomol.com/db/CH4/12C-1H4/MM/12C-1H4__MM.pf
http://www.exomol.com/db/C2H2/12C2-1H2/aCeTY/12C2-1H2__aCeTY.pf
https://www.exomol.com/db/VO/51V-16O/HyVO/51V-16O__HyVO.pf
https://www.exomol.com/db/TiO/46Ti-16O/Toto/46Ti-16O__Toto.pf
https://www.exomol.com/db/TiO/47Ti-16O/Toto/47Ti-16O__Toto.pf
https://www.exomol.com/db/TiO/48Ti-16O/Toto/48Ti-16O__Toto.pf
https://www.exomol.com/db/TiO/49Ti-16O/Toto/49Ti-16O__Toto.pf
https://www.exomol.com/db/TiO/50Ti-16O/Toto/50Ti-16O__Toto.pf

http://www.exomol.com/db/HCN/1H-12C-14N/Harris/1H-12C-14N__Harris.states.bz2
http://www.exomol.com/db/HCN/1H-13C-14N/Larner/1H-13C-14N__Larner.states.bz2
https://www.exomol.com/db/NH3/14N-1H3/CoYuTe/14N-1H3__CoYuTe.states.bz2
https://www.exomol.com/db/NH3/15N-1H3/CoYuTe-15/15N-1H3__CoYuTe-15.states.bz2

https://zenodo.org/records/14266247/files/PF_ames_CO2.dat

Pyrat Bay provides the commands to parse and compute the partitions into the required format. Here’s a script to download these files above and process the partition functions (First, make sure to copy the text file above to your current folder):

# Download partition function files
wget -i wasp18b_partition_function_data.txt

# Compute HITRAN partitions from TIPS data:
pbay -pf tips CO

# Convert Exomol partitions from .pf files:
pbay -pf exomol 1H2-16O__POKAZATEL.pf
pbay -pf exomol 12C-1H4__MM.pf
pbay -pf exomol 12C2-1H2__aCeTY.pf
pbay -pf exomol 51V-16O__HyVO.pf
pbay -pf exomol 46Ti-16O__Toto.pf 47Ti-16O__Toto.pf 48Ti-16O__Toto.pf 49Ti-16O__Toto.pf 50Ti-16O__Toto.pf

# Compute Exomol partitions from .states files:
pbay -pf states 5.0 5000.0 5.0  1H-12C-14N__Harris.states.bz2 1H-13C-14N__Larner.states.bz2
pbay -pf states 5.0 5000.0 5.0  14N-1H3__CoYuTe.states.bz2 15N-1H3__CoYuTe-15.states.bz2

Note

More info about calculating partition functions can be found in the Partition Functions tutorial.


3. TLI Files

Now we have all the needed inputs. Lets return to our root directory (the one containing the inputs/ folder). The next step is to format the line-list and partition-function data into the format for use in Pyrat Bay, these are called transmission line information (TLI) files.

Here below is the H2O/Exomol configuration files that run this step, for example:

Click here to show/hide: tli_exomol_H2O_pokazatel.cfg
File: tli_exomol_H2O_pokazatel.cfg
[pyrat]

# Pyrat Bay run mode: [tli atmosphere spectrum opacity retrieval radeq]
runmode = tli

# Output file:
logfile = Exomol_H2O_0.24-33.0um.log

# List of line-transtion databases:
dblist = inputs/H2O_exomol_pokazatel_0.24-500.0um_100-3500K_threshold_0.01_lbl.dat

# Type of line-transition database, select from: [hitran exomol repack]
dbtype = repack
# List of partition functions for each database:
pflist = inputs/PF_exomol_H2O.dat

# Wavelength ranges:
wl_low = 0.24 um
wl_high = 33.0 um

# Verbosity level [1--5]:
verb = 2

There are two main things to configure during this step:

  1. Set the wavelength range to consider. Best practice is to include the full wavelength range that is available. That way there is no need to recalculate TLI files for future projects at other wavelengths. In Step 4 you will have the option to fine tune the wavelength range for the cross-sections.

  2. The partition-function input is the one file determining what is the available temperature range.

Here are all the TLI configuration files:

Click here to show/hide: uhj_configs_tli.txt
File: uhj_configs_tli.txt
https://pyratbay.readthedocs.io/en/ver2.0/cookbooks/cross_sections_uhj/tli_exomol_C2H2_acety.cfg
https://pyratbay.readthedocs.io/en/ver2.0/cookbooks/cross_sections_uhj/tli_exomol_H2O_pokazatel.cfg
https://pyratbay.readthedocs.io/en/ver2.0/cookbooks/cross_sections_uhj/tli_exomol_HCN_harris-larner.cfg
https://pyratbay.readthedocs.io/en/ver2.0/cookbooks/cross_sections_uhj/tli_exomol_NH3_coyute-byte.cfg
https://pyratbay.readthedocs.io/en/ver2.0/cookbooks/cross_sections_uhj/tli_exomol_TiO_toto.cfg
https://pyratbay.readthedocs.io/en/ver2.0/cookbooks/cross_sections_uhj/tli_exomol_VO_vomyt.cfg
https://pyratbay.readthedocs.io/en/ver2.0/cookbooks/cross_sections_uhj/tli_hitemp_CH4_2020.cfg
https://pyratbay.readthedocs.io/en/ver2.0/cookbooks/cross_sections_uhj/tli_hitemp_CO_li2019.cfg
https://pyratbay.readthedocs.io/en/ver2.0/cookbooks/cross_sections_uhj/tli_hitemp_CO2_2010.cfg

Copy this file to your current folder to download the TLI configuration files with:

wget -i uhj_configs_tli.txt

Now you can compute the TLI files using this Pyrat Bay shell command:

pbay -c tli_exomol_C2H2_acety.cfg
pbay -c tli_exomol_H2O_pokazatel.cfg
pbay -c tli_exomol_HCN_harris-larner.cfg
pbay -c tli_exomol_NH3_coyute-byte.cfg
pbay -c tli_exomol_TiO_toto.cfg
pbay -c tli_exomol_VO_vomyt.cfg
pbay -c tli_hitemp_CH4_2020.cfg
pbay -c tli_hitemp_CO_li2019.cfg
pbay -c tli_hitemp_CO2_2010.cfg

This may take a while since you are processing several millions of line transitions, but once you have generated these TLI files, you wont likely need to run this step again.


4. Cross Sections

The final step is to sample the line lists into tabulated data. In this step, the code computes the strength and Voigt profile of each transition of a given molecule, and co-adds them into a cross-section grid (cm\(^2\) molecule\(^{-1}\)), which is sampled over pressure, temperature, and wavelength.

Note

Customization of the pressure, temperature, and wavelength sampling will vary depending on the application. For example, radiative-equilibrium applications typically require a broad wavelength coverage (~0.3-30 µm). In constrast, atmospheric retrievals may focus only on the spectral range covered by the observations, thus allowing to have higher spectral resolutions than you could with radiative-equilibrium run. It’s a trade-off between science requirements and computational constraints.

Here we will focus on a emission atmospheric retrieval for an ultra-hot Jupiter constrained by optical and infrared observations. Here are the configuration files to sample the cross sections:

Click here to show/hide: opacity_0250-4000K_0.35-12.0um_R025K_exomol_H2O.cfg
File: opacity_0250-4000K_0.35-12.0um_R025K_exomol_H2O.cfg
[pyrat]

# Pyrat Bay run mode: [tli atmosphere spectrum opacity retrieval radeq]
runmode = opacity

# Output file names:
logfile = cross_section_0250-4000K_0.35-12.0um_R025K_exomol_H2O.log

# Parallel computing
ncpu = 128
# Verbosity level (<0:errors, 0:warnings, 1:headers, 2:details, 3:debug):
verb = 2

# Atmospheric model:
ptop = 1.0e-08 bar
pbottom = 1.0e+02 bar
nlayers = 56

tmodel = isothermal
tpars = 1000.0

chemistry = equilibrium
species =
    H  He  C  O  N  Na  K  S  Si  Fe  Ti  V
    H2  H2O  CH4  CO  CO2  HCN  NH3  C2H2  C2H4  N2  TiO  VO  OH
    S2  SH  SiO  H2S  SO2  SO  TiO2  VO2

# TLI opacity files:
tlifile = Exomol_H2O_0.24-33.0um.tli

# Wavelength sampling boundaries:
wl_low  = 0.35 um
wl_high = 12.0 um
resolution = 25000.0
voigt_extent = 300.0

# Temperature cross-section grid:
tmin =  250
tmax = 4000
tstep = 150
Click here to show/hide: opacity_0250-4000K_0.35-12.0um_R025K_hitemp_CO.cfg
File: opacity_0250-4000K_0.35-12.0um_R025K_hitemp_CO.cfg
[pyrat]

# Pyrat Bay run mode: [tli atmosphere spectrum opacity retrieval radeq]
runmode = opacity

# Output file names:
logfile = cross_section_0250-4000K_0.35-12.0um_R025K_hitemp_CO.log

# Parallel computing
ncpu = 128
# Verbosity level (<0:errors, 0:warnings, 1:headers, 2:details, 3:debug):
verb = 2

# Atmospheric model:
ptop = 1.0e-08 bar
pbottom = 1.0e+02 bar
nlayers = 56

tmodel = isothermal
tpars = 1000.0

chemistry = equilibrium
species =
    H  He  C  O  N  Na  K  S  Si  Fe  Ti  V
    H2  H2O  CH4  CO  CO2  HCN  NH3  C2H2  C2H4  N2  TiO  VO  OH
    S2  SH  SiO  H2S  SO2  SO  TiO2  VO2

# TLI opacity files:
tlifile = HITEMP_CO_0.3-33.0um.tli

# Wavelength sampling boundaries:
wl_low  = 0.35 um
wl_high = 12.0 um
resolution = 25000.0
voigt_extent = 500.0

# Temperature cross-section grid:
tmin =  250
tmax = 4000
tstep = 150
Click here to show/hide: opacity_0250-4000K_0.35-12.0um_R025K_hitemp_CO2.cfg
File: opacity_0250-4000K_0.35-12.0um_R025K_hitemp_CO2.cfg
[pyrat]

# Pyrat Bay run mode: [tli atmosphere spectrum opacity retrieval radeq]
runmode = opacity

# Output file names:
logfile = cross_section_0250-4000K_0.35-12.0um_R025K_hitemp_CO2.log

# Parallel computing
ncpu = 128
# Verbosity level (<0:errors, 0:warnings, 1:headers, 2:details, 3:debug):
verb = 2

# Atmospheric model:
ptop = 1.0e-08 bar
pbottom = 1.0e+02 bar
nlayers = 56

tmodel = isothermal
tpars = 1000.0

chemistry = equilibrium
species =
    H  He  C  O  N  Na  K  S  Si  Fe  Ti  V
    H2  H2O  CH4  CO  CO2  HCN  NH3  C2H2  C2H4  N2  TiO  VO  OH
    S2  SH  SiO  H2S  SO2  SO  TiO2  VO2

# TLI opacity files:
tlifile = HITEMP_CO2_0.78-33.0um.tli

# Wavelength sampling boundaries:
wl_low  = 0.35 um
wl_high = 12.0 um
resolution = 25000.0
voigt_extent = 300.0

# Temperature cross-section grid:
tmin =  250
tmax = 4000
tstep = 150
Click here to show/hide: opacity_0250-4000K_0.35-12.0um_R025K_hitemp_CH4.cfg
File: opacity_0250-4000K_0.35-12.0um_R025K_hitemp_CH4.cfg
[pyrat]

# Pyrat Bay run mode: [tli atmosphere spectrum opacity retrieval radeq]
runmode = opacity

# Output file names:
logfile = cross_section_0250-4000K_0.35-12.0um_R025K_hitemp_CH4.log

# Parallel computing
ncpu = 128
# Verbosity level (<0:errors, 0:warnings, 1:headers, 2:details, 3:debug):
verb = 2

# Atmospheric model:
ptop = 1.0e-08 bar
pbottom = 1.0e+02 bar
nlayers = 56

tmodel = isothermal
tpars = 1000.0

chemistry = equilibrium
species =
    H  He  C  O  N  Na  K  S  Si  Fe  Ti  V
    H2  H2O  CH4  CO  CO2  HCN  NH3  C2H2  C2H4  N2  TiO  VO  OH
    S2  SH  SiO  H2S  SO2  SO  TiO2  VO2

# TLI opacity files:
tlifile = HITEMP_CH4_0.74-12.0um.tli

# Wavelength sampling boundaries:
wl_low  = 0.35 um
wl_high = 12.0 um
resolution = 25000.0
voigt_extent = 300.0

# Temperature cross-section grid:
tmin =  250
tmax = 4000
tstep = 150
Click here to show/hide: opacity_0250-4000K_0.35-12.0um_R025K_exomol_HCN.cfg
File: opacity_0250-4000K_0.35-12.0um_R025K_exomol_HCN.cfg
[pyrat]

# Pyrat Bay run mode: [tli atmosphere spectrum opacity retrieval radeq]
runmode = opacity

# Output file names:
logfile = cross_section_0250-4000K_0.35-12.0um_R025K_exomol_HCN.log

# Parallel computing
ncpu = 128
# Verbosity level (<0:errors, 0:warnings, 1:headers, 2:details, 3:debug):
verb = 2

# Atmospheric model:
ptop = 1.0e-08 bar
pbottom = 1.0e+02 bar
nlayers = 56

tmodel = isothermal
tpars = 1000.0

chemistry = equilibrium
species =
    H  He  C  O  N  Na  K  S  Si  Fe  Ti  V
    H2  H2O  CH4  CO  CO2  HCN  NH3  C2H2  C2H4  N2  TiO  VO  OH
    S2  SH  SiO  H2S  SO2  SO  TiO2  VO2

# TLI opacity files:
tlifile = Exomol_HCN_0.56-33.0um.tli

# Wavelength sampling boundaries:
wl_low  = 0.35 um
wl_high = 12.0 um
resolution = 25000.0
voigt_extent = 300.0

# Temperature cross-section grid:
tmin =  250
tmax = 4000
tstep = 150
Click here to show/hide: opacity_0250-4000K_0.35-12.0um_R025K_exomol_NH3.cfg
File: opacity_0250-4000K_0.35-12.0um_R025K_exomol_NH3.cfg
[pyrat]

# Pyrat Bay run mode: [tli atmosphere spectrum opacity retrieval radeq]
runmode = opacity

# Output file names:
logfile = cross_section_0250-4000K_0.35-12.0um_R025K_exomol_NH3.log

# Parallel computing
ncpu = 128
# Verbosity level (<0:errors, 0:warnings, 1:headers, 2:details, 3:debug):
verb = 2

# Atmospheric model:
ptop = 1.0e-08 bar
pbottom = 1.0e+02 bar
nlayers = 56

tmodel = isothermal
tpars = 1000.0

chemistry = equilibrium
species =
    H  He  C  O  N  Na  K  S  Si  Fe  Ti  V
    H2  H2O  CH4  CO  CO2  HCN  NH3  C2H2  C2H4  N2  TiO  VO  OH
    S2  SH  SiO  H2S  SO2  SO  TiO2  VO2

# TLI opacity files:
tlifile = Exomol_NH3_0.5-33.0um.tli

# Wavelength sampling boundaries:
wl_low  = 0.35 um
wl_high = 12.0 um
resolution = 25000.0
voigt_extent = 300.0

# Temperature cross-section grid:
tmin =  250
tmax = 4000
tstep = 150
Click here to show/hide: opacity_0250-4000K_0.35-12.0um_R025K_exomol_TiO.cfg
File: opacity_0250-4000K_0.35-12.0um_R025K_exomol_TiO.cfg
[pyrat]

# Pyrat Bay run mode: [tli atmosphere spectrum opacity retrieval radeq]
runmode = opacity

# Output file names:
logfile = cross_section_0250-4000K_0.35-12.0um_R025K_exomol_TiO.log

# Parallel computing
ncpu = 128
# Verbosity level (<0:errors, 0:warnings, 1:headers, 2:details, 3:debug):
verb = 2

# Atmospheric model:
ptop = 1.0e-08 bar
pbottom = 1.0e+02 bar
nlayers = 56

tmodel = isothermal
tpars = 1000.0

chemistry = equilibrium
species =
    H  He  C  O  N  Na  K  S  Si  Fe  Ti  V
    H2  H2O  CH4  CO  CO2  HCN  NH3  C2H2  C2H4  N2  TiO  VO  OH
    S2  SH  SiO  H2S  SO2  SO  TiO2  VO2

# TLI opacity files:
tlifile = Exomol_TiO_0.33-33.0um.tli

# Wavelength sampling boundaries:
wl_low  = 0.35 um
wl_high = 12.0 um
resolution = 25000.0
voigt_extent = 300.0

# Temperature cross-section grid:
tmin =  250
tmax = 4000
tstep = 150
Click here to show/hide: opacity_0250-4000K_0.35-12.0um_R025K_exomol_VO.cfg
File: opacity_0250-4000K_0.35-12.0um_R025K_exomol_VO.cfg
[pyrat]

# Pyrat Bay run mode: [tli atmosphere spectrum opacity retrieval radeq]
runmode = opacity

# Output file names:
logfile = cross_section_0250-4000K_0.35-12.0um_R025K_exomol_VO.log

# Parallel computing
ncpu = 128
# Verbosity level (<0:errors, 0:warnings, 1:headers, 2:details, 3:debug):
verb = 2

# Atmospheric model:
ptop = 1.0e-08 bar
pbottom = 1.0e+02 bar
nlayers = 56

tmodel = isothermal
tpars = 1000.0

chemistry = equilibrium
species =
    H  He  C  O  N  Na  K  S  Si  Fe  Ti  V
    H2  H2O  CH4  CO  CO2  HCN  NH3  C2H2  C2H4  N2  TiO  VO  OH
    S2  SH  SiO  H2S  SO2  SO  TiO2  VO2

# TLI opacity files:
tlifile = Exomol_VO_0.29-33.0um.tli

# Wavelength sampling boundaries:
wl_low  = 0.35 um
wl_high = 12.0 um
resolution = 25000.0
voigt_extent = 300.0

# Temperature cross-section grid:
tmin =  250
tmax = 4000
tstep = 150
Click here to show/hide: opacity_0250-4000K_0.35-12.0um_R025K_exomol_C2H2.cfg
File: opacity_0250-4000K_0.35-12.0um_R025K_exomol_C2H2.cfg
[pyrat]

# Pyrat Bay run mode: [tli atmosphere spectrum opacity retrieval radeq]
runmode = opacity

# Output file names:
logfile = cross_section_0250-4000K_0.35-12.0um_R025K_exomol_C2H2.log

# Parallel computing
ncpu = 128
# Verbosity level (<0:errors, 0:warnings, 1:headers, 2:details, 3:debug):
verb = 2

# Atmospheric model:
ptop = 1.0e-08 bar
pbottom = 1.0e+02 bar
nlayers = 56

tmodel = isothermal
tpars = 1000.0

chemistry = equilibrium
species =
    H  He  C  O  N  Na  K  S  Si  Fe  Ti  V
    H2  H2O  CH4  CO  CO2  HCN  NH3  C2H2  C2H4  N2  TiO  VO  OH
    S2  SH  SiO  H2S  SO2  SO  TiO2  VO2

# TLI opacity files:
tlifile = Exomol_C2H2_1.0-33.0um.tli

# Wavelength sampling boundaries:
wl_low  = 0.35 um
wl_high = 12.0 um
resolution = 25000.0
voigt_extent = 300.0

# Temperature cross-section grid:
tmin =  250
tmax = 4000
tstep = 150

Lets use the H2O cross-section configuration file to walk through the relevant parameters:

Extract from: opacity_0250-4000K_0.35-12.0um_R025K_exomol_H2O.cfg
# Pyrat Bay run mode: [tli atmosphere spectrum opacity retrieval radeq]
runmode = opacity

# Output file names:
logfile = cross_section_0250-4000K_0.35-12.0um_R025K_exomol_H2O.log

# Parallel computing
ncpu = 128
# Verbosity level (<0:errors, 0:warnings, 1:headers, 2:details, 3:debug):
verb = 2

This is the boilerplate indicating what to run (runmode), the output file names (the output cross section file will have the same name as logfile but as a .npz file), and ncpu sets how many parallel CPUs you want to use (use as many as you can without crashing your machine).

Extract from: opacity_0250-4000K_0.35-12.0um_R025K_exomol_H2O.cfg
# Atmospheric model:
ptop = 1.0e-08 bar
pbottom = 1.0e+02 bar
nlayers = 56

tmodel = isothermal
tpars = 1000.0

chemistry = equilibrium
species =
    H  He  C  O  N  Na  K  S  Si  Fe  Ti  V
    H2  H2O  CH4  CO  CO2  HCN  NH3  C2H2  C2H4  N2  TiO  VO  OH
    S2  SH  SiO  H2S  SO2  SO  TiO2  VO2

While the configuration file needs to define an atmosphere, the relevant parameters here are the ones for the pressure profile. These will set the layers at which we will sample the cross sections. The tmodel and tpars are just a filler here (the temperature grid will be defined later). Similarly, for the composition (species) we only need to take care that the molecule being sample is in the atmospheric composition.

Note that the number of pressure layers of the cross section table does not need to be exactly that used later in a radiative-transfer calculation. Here you can set a relatively coarser grid if needed (when you run retrievals, Pyrat Bay can evaluate over a finer pressure grid if requested).

Extract from: opacity_0250-4000K_0.35-12.0um_R025K_exomol_H2O.cfg
# Wavelength sampling boundaries:
wl_low  = 0.35 um
wl_high = 12.0 um
resolution = 25000.0
voigt_extent = 300.0

This section defines the wavelength sampling. wl_low and wl_high set the ranges (we want to cover the TESS and JWST observing ranges), whereas resolution sets the resolving power of the spectra (we want a resolution >= 25K to avoid having sampling biases). Lastly, the voigt_extent parameter sets the extent of the Voigt profile when sampling each line transition (this is the distance in cm-1 from the line center; for this we want at least something > ~300–500 cm-1).

Extract from: opacity_0250-4000K_0.35-12.0um_R025K_exomol_H2O.cfg
# Temperature cross-section grid:
tmin =  250
tmax = 4000
tstep = 150

Then we set the temperature grid. This is a linear grid from tmin to tmax with a step size of tstep. Note that you cannot sample beyond the temperature ranges given in the partition functions of the inputs. That would require extrapolation, which is not too scientific.


Now you can compute the TLI files using this Pyrat Bay shell command:

pbay -c opacity_0250-4000K_0.35-12.0um_R025K_exomol_C2H2.cfg
pbay -c opacity_0250-4000K_0.35-12.0um_R025K_exomol_H2O.cfg
pbay -c opacity_0250-4000K_0.35-12.0um_R025K_exomol_HCN.cfg
pbay -c opacity_0250-4000K_0.35-12.0um_R025K_exomol_NH3.cfg
pbay -c opacity_0250-4000K_0.35-12.0um_R025K_exomol_TiO.cfg
pbay -c opacity_0250-4000K_0.35-12.0um_R025K_exomol_VO.cfg
pbay -c opacity_0250-4000K_0.35-12.0um_R025K_hitemp_CH4.cfg
pbay -c opacity_0250-4000K_0.35-12.0um_R025K_hitemp_CO2.cfg
pbay -c opacity_0250-4000K_0.35-12.0um_R025K_hitemp_CO.cfg

This may take a while since you are processing several millions of line transitions, but once you have generated these TLI files, you wont likely need to run this step again.


Once you have the cross-section files needed for yout project, go back to the WASP-18b retrieval notebook.