MultiREx - Planetary Transmission Spectra Generator
MultiREx is a Python library designed for generating synthetic exoplanet transmission spectra. This tool extends the functionalities of the TauREx library, reorganizing and enabling the massive generation of spectra and observations with added noise. The package was originally devised for training large machine learning models to identify biosignatures in noisy spectra, but it can also be used for other purposes.
For the science behind the model, please refer to the following paper:
David S. Duque-Castaño, Jorge I. Zuluaga, and Lauren Flor-Torres (2024), Machine-assisted classification of potential biosignatures in earth-like exoplanets using low signal-to-noise ratio transmission spectra, submitted to MNRAS, arXiv:2407.19167.
Contents:
Key Features of MultiREx
Planetary System Assembly: Combine different stars, planets, and atmospheres to explore various system configurations.
Customizable Atmospheres: Configure and add a wide range of atmospheric compositions to planets.
Synthetic Spectrum Generation: Produce realistic spectra based on your system’s attributes.
Astronomical Observation Simulation: Use
randinstrumentto simulate spectral observations with noise determined by signal-to-noise ratios.Multiverse Analysis: Automate the generation of multiple spectra with random parameter variations for extensive statistical or ML-based analyses.
Downloading and Installing MultiREx
MultiREx is available on the Python Package Index (PyPI) and can be installed
on Linux using:
sudo pip install multirex
This command installs all dependencies and downloads useful data, scripts, and constants.
Note
If you do not have access to sudo, you can install MultiREx in
your local environment (usually at ~/.local/). In that case, you
need to add the local Python installation path to your PATH environment
variable. For instance, add the following line to your ~/.bashrc or
~/.bash_profile:
export PATH=$HOME/.local/bin:$PATH
If you are a developer or want to work directly with the package sources, clone
MultiREx from the GitHub repository:
git clone https://github.com/D4san/MultiREx-public
To install the package from the sources, run:
cd MultiREx-public
python3 setup.py install
Running MultiREx in Google Colab
To run MultiREx in Google Colab, execute:
!pip install -Uq multirex
After installing, reset the Colab session before importing the package. This
avoids unintended behavior from the package pybtex. Once reset, simply import:
import multirex as mrex
Quickstart
To start using MultiREx, import the package:
import multirex as mrex
MultiREx models a planetary system with three main components: a star, a
planet, and a planetary atmosphere.
First, define a star:
star = mrex.Star(temperature=5777, radius=1, mass=1)
# Radius and mass are in solar units.
Then, define a planet:
planet = mrex.Planet(radius=1, mass=1)
# Radius and mass are in Earth units.
Now give the planet an atmosphere. This is a basic example of an N2 atmosphere with 100 ppm of CO2 and 1 ppm of CH4:
atmosphere = mrex.Atmosphere(
temperature=288, # in K
base_pressure=1e5, # in Pa
top_pressure=1, # in Pa
fill_gas="N2", # the gas that fills the atmosphere
composition=dict(
CO2=-4, # log10(mix-ratio)
CH4=-6,
)
)
planet.set_atmosphere(atmosphere)
Assemble the system:
system = mrex.System(star=star, planet=planet, sma=1)
# sma (semimajor axis) is in AU (astronomical units).
Create a transmission model:
system.make_tm()
Plot the transmission spectrum:
wns = mrex.Physics.wavenumber_grid(wl_min=0.6, wl_max=10, resolution=1000)
fig, ax = system.plot_contributions(wns, xscale='log')
All of these functionalities are also available in Taurex. However, the
interface in MultiREx is more intuitive and is best suited for the package’s
true strength: creating large ensembles of random planetary systems.
For instance, you can create a random planetary system by specifying parameter ranges:
system = mrex.System(
star=mrex.Star(
temperature=(4000, 6000),
radius=(0.5, 1.5),
mass=(0.8, 1.2),
),
planet=mrex.Planet(
radius=(0.5, 1.5),
mass=(0.8, 1.2),
atmosphere=mrex.Atmosphere(
temperature=(290, 310), # K
base_pressure=(1e5, 10e5), # Pa
top_pressure=(1, 10), # Pa
fill_gas="N2",
composition=dict(
CO2=(-5, -4), # log10(mix-ratio)
CH4=(-6, -5),
),
)
),
sma=(0.5, 1) # in AU
)
Using this approach, you can generate thousands of spectra for training machine learning models or other statistical analyses.
Further Examples
Several Jupyter notebooks illustrating both basic and advanced functionalities are available in the examples/ folder. Additionally, notebooks used to generate figures for our papers are in examples/papers/.
A Note About TauREx
MultiREx is built on the spectral calculation capabilities of
TauREx.
If you use MultiREx in your research, please also cite TauREx:
A. F. Al-Refaie, Q. Changeat, I.P. Waldmann, and G. Tinetti, “TauREx III: A fast, dynamic, and extendable framework for retrievals,” arXiv:1912.07759 (2019).
TauREx requires molecular opacities or cross-sections from sources like
ExoMol or
ExoTransmit.
We have pre-downloaded some of these molecules; others can be downloaded with
multirex.Util.get_gases().
What’s New
For a detailed list of the latest features, see What’s new.