---
title: 'petitRADTRANS: Exoplanet Spectra Modeling'
url: https://www.emergentmind.com/topics/petitradtrans
type: topic
---

# petitRADTRANS: Exoplanet Spectra Modeling

petitRADTRANS is an open-source Python package for the radiative transfer modeling and atmospheric retrieval of exoplanet and substellar companion spectra. Designed for both low-resolution and high-resolution applications, it enables fast, physically consistent calculations of emission and transmission spectra, integrating flexible opacity, chemistry, and cloud modules. Its modular architecture and efficient computational backend have made it a reference forward model for atmospheric retrievals across diverse targets and observing regimes [1904.11504, 2309.06755].

## 1. Code Architecture and Radiative Transfer Formalism

petitRADTRANS combines a highly optimized FORTRAN backend—responsible for all opacity interpolation, correlated-k binning, and radiative-transfer integration—with a Python user interface that exposes physical and numerical controls [2309.06755]. The core radiative-transfer equation is solved either in emission or transmission geometry, in 1D plane-parallel layers under local thermodynamic equilibrium (LTE):

\[
\frac{dI_\nu}{d\tau_\nu} = I_\nu - S_\nu
\]
where \(S_\nu = (1-\omega_\nu)B_\nu(T) + \omega_\nu J_\nu\), with \(\omega_\nu\) as the single-scattering albedo, \(B_\nu(T)\) the Planck function, and \(J_\nu\) the mean intensity [2309.06755, 2301.06575].

Transmission spectra are computed by integrating the slant optical depth along the line of sight:

\[
\tau_\lambda^{\rm slant} = \int_\mathrm{limb} \kappa_\lambda(P,T)\, \rho\, ds
\]
The emergent spectrum or transit radius is then derived from the appropriate integration or exponential attenuation [1904.11504, 2309.06755, 2412.03675].

petitRADTRANS supports both correlated-k (c-k, R~10³) and line-by-line (lbl, R~10⁶) modes, enabling application to a wide range of spectral resolutions from JWST, HST to high-dispersion ground-based spectrographs [1904.11504, 2407.20952].

## 2. Opacity Handling and Supported Species

The opacity infrastructure in petitRADTRANS is designed to be extensible and compatible with ExoMol, HITEMP, HITRAN, and custom user-provided databases. In c-k mode, the code utilizes precomputed k-distribution tables accelerated with Gaussian-quadrature in the cumulative opacity coordinate [1904.11504, 2009.00687]. For high-resolution modeling, it performs direct line-by-line Voigt-profile computations, allowing simultaneous treatment of multiple isotopologues (e.g., ¹²CO, ¹³CO, H₂¹⁶O, H₂¹⁸O) [2507.02706, 2501.01789, 2512.13889].

Supported opacity sources include:
- Molecular line lists: H₂O, CO, CO₂, CH₄, NH₃, HCN, FeH, alkalis (Na, K), TiO, among others, with custom isotopologue selection [2404.03776, 2507.02706, 2405.10841].
- Continuum absorbers: collision-induced absorption (CIA; e.g., H₂–H₂, H₂–He, N₂–N₂), H⁻ bound-free/free-free [2309.06755, 2501.01789].
- Rayleigh scattering: H₂, He, N₂, and others.
- Cloud and haze: clouds implemented via gray decks, power-law, or microphysical (Ackerman & Marley 2001) approaches, with full Mie or Distribution of Hollow Spheres (DHS) scattering for well-characterized condensates [1904.11504, 2301.06575].

The code supports custom addition of new opacities, including recent developments in isotope-specific cross-section grids (e.g., 12 isotopologues of CO₂ via ExoMolOP [2512.13889]) and PAH extinction [2411.07738].

## 3. Atmospheric Structure, Chemistry, and Clouds

petitRADTRANS provides extensive flexibility in parameterizing P–T profiles and atmospheric composition:
- Temperature–pressure (T–P) profiles can be supplied as analytic (e.g., Guillot 2010), node-based splines, seven-knot gradient profiles (e.g., Zhang et al. 2023), or modular user-defined functions [2407.20952, 2404.03776, 2501.01789].
- Chemistry can be modeled as equilibrium (pre-computed abundance grids, e.g., easyCHEM or FastChem), free parameterized VMRs for each species, or hybrid disequilibrium schemes (quench pressure, K_zz prescription) [2404.03776, 2501.01789, 2507.02706].
- Cloud opacities are included through both empirical (gray/power-law) and physically motivated microphysical cloud models, with particle size, mass fraction, base pressure, sedimentation efficiency (f_sed), and vertical mixing (K_zz) as free or grid-based parameters [1904.11504, 2507.02706, 2301.06575].

Advanced retrievals can handle vertical abundance gradients and disequilibrium as a function of pressure, as demonstrated in the analysis of JWST time-resolved data [2507.07772].

## 4. Retrieval Framework and Statistical Methods

petitRADTRANS is directly integrated with Bayesian nested-sampling engines, notably PyMultiNest and UltraNest, for parameter estimation and model selection [2309.06755, 2507.02706, 2404.03776]. Model parameters typically span T–P gradients, molecular and isotopologue abundances, global metallicity ([M/H]), C/O ratio, cloud properties, wind/rotation (v sin i), surface gravity (log g), planetary radius, and noise/covariance hyperparameters.

Likelihood functions are formulated as Gaussian in the observed spectrum or data vector, with analytic marginalization over linear parameters common for scaling and instrumental nuisance terms. Full correlated-noise treatments employ order-by-order or Gaussian-process kernels in the covariance matrix [2501.01789, 2405.10841].

Recent developments include Neural Posterior Estimation (NPE), which amortizes inference and enables rapid, simulation-based approximations of posteriors while maintaining accuracy compared to standard nested-sampling [2301.06575].

## 5. Benchmarking, Validation, and Use Cases

petitRADTRANS has been benchmarked against retrieval codes such as PLATON, POSEIDON, TauREx, ARCiS, and NEMESIS, with typical spectral differences <1–5% (often within a fraction of typical JWST noise floors) [2309.06755, 2009.00687, 2512.13889]. Opacity cross-section and k-table outputs have been validated across independent codes using the same ExoMolOP grids [2512.13889, 2009.00687].

Key scientific applications include:
- Precision retrievals of elemental and isotopic ratios (e.g., ¹²CO/¹³CO, H₂O/HDO, C/O) for directly imaged exoplanets and brown dwarfs [2507.02706, 2606.11972, 2501.01789, 2405.10841].
- Time-resolved mapping of temperature inversions and weather phenomena from JWST phase series [2507.07772].
- Testing chemical equilibrium vs. disequilibrium chemistry, with robust model selection via Bayesian evidence [2404.03776, 2405.10841].
- Spectral synthesis with custom high-resolution k-tables and cross-sections generated from the ExoMolOP pipeline, including alkali broadening and isotopic mixtures [2512.13889, 2009.00687].

## 6. Practical Configuration and Example Usage

A typical petitRADTRANS workflow involves:
1. Instantiation of a `Radtrans` object with specified line/continuum species, cloud modules, and wavelength grid.
2. Loading or precomputing opacity tables (either c-k or lbl), optionally employing ExoMolOP-formatted HDF5 files for custom or isotope-resolved opacities [2512.13889, 2009.00687].
3. Defining the atmospheric structure: pressure grid, P–T profile, and abundance profiles (free or grid-based).
4. Configuration of the retrieval parameter set—priors on physical, chemical, and nuisance parameters.
5. Forward modeling/emission or transmission spectrum computation across sampled parameter space.
6. (If applicable) Instrumental convolution, Doppler/rotational broadening, and Gaussian process noise models for high-resolution data [2405.10841, 2501.01789, 2507.02706].
7. Bayesian inference and diagnostic plotting via built-in tools.

Sample pseudocode for a high-resolution emission spectrum with free abundances and gradient P–T profile:

```python
from petitRADTRANS import Radtrans
import numpy as np

# Define line species and configure high res (lbl) mode
atm = Radtrans(
    line_species=['H2O', 'CO', '13CO', 'CH4', 'NH3', 'HCN'],
    rayleigh_species=['H2', 'He'],
    continuum_opacities=['H2-H2', 'H2-He'],
    wlen_bords_micron=[2.0, 2.45],
    R=1e6 # high resolution
)

pressures = np.logspace(2, -6, 50)  # 50 layers from 100 bar to 1e-6 bar
# Generate T-P profile and abundance vectors per retrieval sample
# ...

atm.setup_opa_structure(pressures)
atm.calc_flux(temperature=T_profile, abundances=abund_dict, gravity=10**logg)
# Post-processing: Doppler shift, rotational convolution, instrument LSF, GP noise
```

## 7. Limitations and Ongoing Developments

The current pressure-temperature-coverage of the main opacity database extends to 3000–3400 K; modeling of ultra-hot exoplanets requires further extension, currently under development [1904.11504, 2512.13889]. The correlated-k implementation currently makes the uncorrelated-species approximation, which can introduce small errors in strongly overlapping bands. Dedicated H₂/He pressure broadening for lines is a forthcoming feature (currently air-broadening is standard) [1904.11504].

The emission module neglects scattering in emission spectra by default, but plans exist for consistent radiative transfer including scattering source terms in future releases [1904.11504].

## References

- "petitRADTRANS: a Python radiative transfer package for exoplanet characterization and retrieval" [1904.11504]
- "Atmospheric retrievals with petitRADTRANS" [2309.06755]
- "The ESO SupJup Survey VIII. Chemical fingerprints of young L dwarf twins" [2507.02706]
- "ExoMol line lists -- LXIII: ExoMol line lists for 12 isotopologues of CO$_2$" [2512.13889]
- "The ExoMolOP Database: Cross-sections and k-tables for Molecules of Interest in High-Temperature Exoplanet Atmospheres" [2009.00687]
- "Four-of-a-kind? Comprehensive atmospheric characterisation of the HR 8799 planets with VLTI/GRAVITY" [2404.03776]
- "Surface pressure impact on nitrogen-dominated USP super-Earth atmospheres" [2304.08690]
- "The ESO SupJup Survey I: Chemical and isotopic characterisation of the late L-dwarf DENIS J0255-4700 with CRIRES$^+$" [2405.10841]
- "Neural posterior estimation for exoplanetary atmospheric retrieval" [2301.06575]
- "The JWST Weather Report: retrieving temperature variations, auroral heating, and static cloud coverage on SIMP-0136" [2507.07772]
- "JWST-TST DREAMS: A Precise Water Abundance for Hot Jupiter WASP-17b from the NIRISS SOSS Transmission Spectrum" [2412.03675]

Source: https://www.emergentmind.com/topics/petitradtrans