petitRADTRANS.retrieval.models

Contents

petitRADTRANS.retrieval.models#

Models Module

This module contains a set of functions that generate the spectra used in the petitRADTRANS retrieval. This includes setting up the pressure-temperature structure, the chemistry, and the radiative transfer to compute the emission or transmission spectrum. See the documentation on the Retrieval Models for full details.

All models must take the same set of inputs:

ModelContextModelContext

An object that contains the static information about the retrieval, including the Radtrans object.

PhysicalParamsPhysicalParams

An object containing all of the physical parameters of the model, which can be free parameters, or fixed values.

pt_plot_modebool

If this argument is True, the model function will return the pressure and temperature arrays instead of computing the flux.

Attributes#

Functions#

_is_full_easychem_requested(→ bool)

Return whether the retrieval explicitly requested the full easyChem path.

_as_structural_int(→ int)

Return a Python int for parameters that define model structure.

_normalize_legacy_output_value(value)

_compute_gravity(physical_params)

_resolve_guillot_gamma(parameters)

Return the Guillot gamma parameter in linear units for any model contract.

_clip_easychem_temperatures(physical_params, temperatures)

_wrap_runtime_temperature_builder(physical_params, ...)

_stack_runtime_cloud_base_pressures(p_bases, dtype)

molliere_2020_emission

molliere_2020_two_column

guillot_emission

guillot_relative_emission(...)

Guillot emission model normalised by a PHOENIX stellar spectrum.

guillot_emission_add_gaussian_temperature

guillot_patchy_emission

interpolated_profile_emission

gradient_profile_emission

_build_timestep_params(physical_params, t_idx, t_value)

Build a PhysicalParams snapshot for a single model timestep.

time_series_gradient_emission

power_law_profile_emission

guillot_transmission

guillot_patchy_transmission

madhushudhan_seager_emission

madhushudhan_seager_transmission

madhu_seager_patchy_transmission

isothermal_transmission

power_law_profile_transmission

mark_legacy_model_function(model_function)

legacy_molliere_2020_emission(prt_object, parameters)

Disequilibrium Chemistry Emission Model

legacy_molliere_2020_two_column(prt_object, parameters)

Disequilibrium Chemistry Emission Model

legacy_guillot_emission(prt_object, parameters[, ...])

Emission spectrum calculation for the Guillot 2010 temperature profile.

legacy_guillot_emission_add_gaussian_temperature(...)

Emission spectrum calculation for the Guillot 2010 temperature profile.

legacy_guillot_patchy_emission(prt_object, parameters)

Deprecated, to be removed in future version

legacy_interpolated_profile_emission(prt_object, ...)

This model computes a emission spectrum based a spline temperature-pressure profile.

legacy_gradient_profile_emission(prt_object, parameters)

This model computes a emission spectrum based a gradient temperature-pressure profile (Zhang 2023).

legacy_power_law_profile_emission(prt_object, parameters)

This model computes a emission spectrum based a gradient temperature-pressure profile (Zhang 2023).

legacy_guillot_transmission(prt_object, parameters[, ...])

Transmission Model, Guillot Profile

legacy_guillot_patchy_transmission(prt_object, parameters)

Deprecated

legacy_madhushudhan_seager_emission(prt_object, parameters)

Transmission Model, Madhusudhan Seager 2009 Profile

legacy_madhushudhan_seager_transmission(prt_object, ...)

Transmission Model, Madhusudhan Seager 2009 Profile

legacy_madhu_seager_patchy_transmission(prt_object, ...)

Deprecated

legacy_isothermal_transmission(prt_object, parameters)

Equilibrium Chemistry Transmission Model, Isothermal Profile

legacy_power_law_profile_transmission(prt_object, ...)

This model computes a emission spectrum based a gradient temperature-pressure profile (Zhang 2023).

add_blackbody_cpd_model(parameters, wavelengths)

Calculates the flux of a blackbody with area 4*pi*disk_radius^2 and temperature T_disk_blackbody.

initialize_pressure(press, parameters, ...)

initialize_pressure_from_legacy_dict(press, ...)

Legacy wrapper for initialize_pressure().

_as_auxiliary_outputs(outputs)

_as_filtered_auxiliary_outputs(outputs[, excluded_keys])

_is_scalar_like(value)

_build_model_context_from_parameters(name, mode, ...)

_normalize_model_output(model_output[, pt_plot_mode])

_model_result_to_legacy_output(model_result)

run_legacy_model_adapter(...)

_infer_model_function_contract(→ str)

Resolve the model contract using explicit registration only.

coerce_model_generating_function(model_function[, ...])

run_runtime_model_adapter(...)

make_unified_model(fn[, legacy_fn])

Return a single callable that dispatches to fn or

_initialize_runtime_pressure_grid(model_context, ...)

_resolve_runtime_abundance_state(model_context, ...[, ...])

_build_runtime_emission_model_inputs(physical_params, ...)

_build_runtime_transmission_model_inputs(...)

calculate_emission_spectrum_runtime(...)

calculate_emission_spectra_batched(...)

Evaluate emission spectra for a batch of model inputs via vmap.

calculate_transmission_spectrum_runtime(...)

calculate_emission_spectrum(prt_object, parameters, ...)

Calls Radtrans.calculate_flux to compute the emission spectrum of an atmosphere.

calculate_transmission_spectrum(prt_object, ...)

_summary_

Module Contents#

petitRADTRANS.retrieval.models._is_full_easychem_requested(parameters) bool#

Return whether the retrieval explicitly requested the full easyChem path.

petitRADTRANS.retrieval.models.MODEL_CONTRACT_LEGACY = 'legacy'#
petitRADTRANS.retrieval.models.MODEL_CONTRACT_DIFFERENTIABLE = 'differentiable'#
petitRADTRANS.retrieval.models.MODEL_CONTRACT_LEGACY_ADAPTER = 'runtime_legacy_adapter'#
petitRADTRANS.retrieval.models._MODEL_CONTRACT_ATTRIBUTE = '_prt_model_contract'#
petitRADTRANS.retrieval.models._WRAPPED_LEGACY_MODEL_ATTRIBUTE = '_prt_wrapped_legacy_model'#
petitRADTRANS.retrieval.models._TIME_INDEXED_PATTERN#
petitRADTRANS.retrieval.models._SINUSOIDAL_SUFFIXES = ('_amplitude', '_period', '_phase', '_offset')#
petitRADTRANS.retrieval.models._as_structural_int(value, parameter_name: str) int#

Return a Python int for parameters that define model structure.

Counts such as nnodes, N_layers, and N_time are used in Python control flow and array-shape construction, so they must remain compile-time constants under JAX transforms.

petitRADTRANS.retrieval.models._normalize_legacy_output_value(value)#
petitRADTRANS.retrieval.models._compute_gravity(physical_params)#
petitRADTRANS.retrieval.models._resolve_guillot_gamma(parameters)#

Return the Guillot gamma parameter in linear units for any model contract.

petitRADTRANS.retrieval.models._clip_easychem_temperatures(physical_params, temperatures)#
petitRADTRANS.retrieval.models._wrap_runtime_temperature_builder(physical_params, temperature_builder)#
petitRADTRANS.retrieval.models._stack_runtime_cloud_base_pressures(p_bases, dtype)#
petitRADTRANS.retrieval.models.molliere_2020_emission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.molliere_2020_two_column(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.guillot_emission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.guillot_relative_emission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#

Guillot emission model normalised by a PHOENIX stellar spectrum.

Computes the same Guillot global temperature profile and emission spectrum as guillot_emission(), then divides the planet flux by a PHOENIX stellar spectrum binned to the same wavelength grid. The returned spectrum is the dimensionless planet-to-star flux ratio F_planet / F_star, suitable for secondary-eclipse or direct-imaging contrast retrieval.

Required parameters (shared with guillot_emission())#

distance_to_systemfloat

Distance from the system to the observer in cm.

log_g, planet_radius, massfloat

Two of these three must be supplied (see _compute_gravity()).

T_int, T_equ, gamma, log_kappa_IRfloat

Guillot temperature-profile parameters.

Fe/H, C/O, log_pquenchfloat

Equilibrium-chemistry parameters.

Additional stellar parameters#

star_effective_temperaturefloat

Effective temperature of the host star in K. Used to interpolate the PHOENIX spectral grid.

stellar_radiusfloat, optional

Stellar radius in cm. If omitted, the radius from the PHOENIX grid is used.

petitRADTRANS.retrieval.models.guillot_emission_add_gaussian_temperature(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.guillot_patchy_emission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.interpolated_profile_emission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.gradient_profile_emission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models._build_timestep_params(physical_params, t_idx, t_value)#

Build a PhysicalParams snapshot for a single model timestep.

Auto-detects time-varying parameters by scanning parameter names:

  • Per-timestep keys matching {P}_t_{int}: the value at index t_idx is stored under the base name P.

  • Sinusoidal quartets {P}_amplitude, {P}_period, {P}_phase, {P}_offset: the base name P is evaluated as offset + amplitude * sin(2π * t_value / period + phase).

All detected meta-keys are stripped from the snapshot; only the resolved base name is included. Parameters matching neither pattern are copied unchanged. This allows any parameter to vary with time simply by following the naming convention—no pre-declaration is required.

petitRADTRANS.retrieval.models.time_series_gradient_emission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#

Time-variable gradient-profile emission model.

Computes N_time emission spectra at regularly spaced model timesteps spanning the range of the observation times. Spectra at intermediate observation times are obtained by linear interpolation along the time axis.

Time-varying parameters are auto-detected from the naming convention by _build_timestep_params() — no explicit declaration is needed. Any parameter can vary with time simply by following one of the two supported patterns:

Per-timestep keys#

Supply {P}_t_0{P}_t_{N_time-1} as free parameters. At each model timestep i the snapshot will contain P set to the value of {P}_t_i.

Sinusoidal parameterisation#

Supply {P}_amplitude, {P}_period (seconds), {P}_phase (radians), and {P}_offset. The value at time t is

\[P(t) = \text{offset} + A \sin\!\left(\frac{2\pi t}{\text{period}} + \phi\right)\]

Parameters that do not match either pattern are treated as constant across all timesteps (e.g. distance_to_system, mass, planet_radius, N_layers).

Returns#

ModelResult

When pt_plot_mode=False: spectrum has shape (N_time, N_wavelength) on the shared model time grid, and auxiliary_outputs['model_times'] stores that grid. The runtime scorer projects each epoch to observation space before interpolating in time, so the model only needs to carry one spectral representation. When pt_plot_mode=True: temperatures has shape (N_time, N_pressure) and auxiliary_outputs['model_times'] gives the corresponding model time grid.

petitRADTRANS.retrieval.models.power_law_profile_emission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.guillot_transmission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.guillot_patchy_transmission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.madhushudhan_seager_emission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.madhushudhan_seager_transmission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.madhu_seager_patchy_transmission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.isothermal_transmission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.power_law_profile_transmission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.mark_legacy_model_function(model_function)#
petitRADTRANS.retrieval.models.legacy_molliere_2020_emission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=True)#

Disequilibrium Chemistry Emission Model

This model computes an emission spectrum based on the temperature profile of (Molliere 2020). (Dis)equilibrium or free chemistry, can be used. The use of easychem for on-the-fly (dis)equilibrium chemistry calculations is supported, but is currently under development. Many of the parameters are optional, but must be used in the correct combination with other parameters.

Args:
prt_objectobject

An instance of the pRT class, with optical properties as defined in the RunDefinition.

parametersdict
Dictionary of required parameters:
  • distance_to_system : Distance to the planet in [cm]

Two of
  • log_g : Log of surface gravity

  • planet_radius : planet radius [cm]

  • mass : planet mass [g]

  • T_int : Interior temperature of the planet [K]

  • T3 : Innermost temperature spline [K]

  • T2 : Middle temperature spline [K]

  • T1 : Outer temperature spline [K]

  • alpha : power law index in tau = delta * press_cgs**alpha

  • log_delta : proportionality factor in tau = delta * press_cgs**alpha

  • log_pquench : Pressure at which CO, CH4 and H2O abundances become vertically constant

  • Fe/H : Metallicity

  • C/O : Carbon to oxygen ratio

  • fsed : sedimentation parameter - can be unique to each cloud type by adding _CloudName

One of:
  • sigma_lnorm : Width of cloud particle size distribution (log normal)

  • b_hans : Width of cloud particle size distribution (hansen)

One of:
  • log_cloud_radius_* : Central particle radius (typically computed with fsed and Kzz)

  • log_kzz : Vertical mixing parameter

One of
  • eq_scaling_* : Scaling factor for equilibrium cloud abundances.

  • log_X_cb_: cloud mass fraction abundance

Optional
  • contribution : return the emission contribution function

  • patchiness : Cloud coverage fraction, mixes two columns with different cloud properties.

  • remove_cloud_species : Specifies which cloud species to remove for clear atmosphere column.

  • T_disk_blackbody : Temperature of a blackbody circumplanetary disk component.

  • disk_radius : Radius [cm] of a blackbody circumplanetary disk component.

pt_plot_modebool

Return only the pressure-temperature profile for plotting. Evaluate mode only.

adaptive_mesh_refinementbool

Adaptive mesh refinement. Use the high resolution pressure grid around the cloud base.

Returns:
wlen_modelArrayLike

Wavlength array of computed model, not binned to data [um]

spectrum_modelArrayLike

Computed emission spectrum [W/m2/micron]

contr_emOptional, ArrayLike

Emission contribution function, relative contributions for each wavelength and pressure level.

petitRADTRANS.retrieval.models.legacy_molliere_2020_two_column(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=True)#

Disequilibrium Chemistry Emission Model

This model computes an emission spectrum based on the temperature profile of (Molliere 2020). (Dis)equilibrium or free chemistry, can be used. The use of easychem for on-the-fly (dis)equilibrium chemistry calculations is supported, but is currently under development. This model includes patchy clouds, and requires a unique temperature profile for the clear atmosphere regions - ie this is a full two column model!

Args:
prt_objectobject

An instance of the pRT class, with optical properties as defined in the RunDefinition.

parametersdict
Dictionary of required parameters:
  • distance_to_system : Distance to the planet in [cm]

Two of
  • log_g : Log of surface gravity

  • planet_radius : planet radius [cm]

  • mass : planet mass [g]

  • T_int : Interior temperature of the planet [K]

  • T3 : Innermost temperature spline

  • T2 : Middle temperature spline

  • T1 : Outer temperature spline

  • T3_clear : Innermost temperature spline for clear atmosphere

  • T2_clear : Middle temperature spline for clear atmosphere

  • T1_clear : Outer temperature spline for clear atmosphere

  • alpha : power law index in tau = delta * press_cgs**alpha

  • alpha_clear : power law index in tau = delta * press_cgs**alpha for clear atmosphere

  • log_delta : proportionality factor in tau = delta * press_cgs**alpha

  • log_delta_clear : proportionality factor in tau = delta * press_cgs**alpha for clear atmosphere

  • log_pquench : Pressure at which CO, CH4 and H2O abundances become vertically constant

  • Fe/H : Metallicity

  • C/O : Carbon to oxygen ratio

  • fsed : sedimentation parameter - can be unique to each cloud type

One of:
  • sigma_lnorm : Width of cloud particle size distribution (log normal)

  • b_hans : Width of cloud particle size distribution (hansen)

One of:
  • log_cloud_radius_* : Central particle radius (typically computed with fsed and Kzz)

  • log_kzz : Vertical mixing parameter

One of
  • eq_scaling_* : Scaling factor for equilibrium cloud abundances.

  • log_X_cb_: cloud mass fraction abundance

Optional
  • contribution : return the emission contribution function

  • patchiness : Cloud coverage fraction, mixes two columns with different cloud properties.

  • remove_cloud_species : Specifies which cloud species to remove for the clear atmosphere column.

  • T_disk_blackbody : Temperature of a blackbody circumplanetary disk component.

  • disk_radius : Radius [cm] of a blackbody circumplanetary disk component.

pt_plot_modebool

Return only the pressure-temperature profile for plotting. Evaluate mode only.

adaptive_mesh_refinementbool

Adaptive mesh refinement. Use the high resolution pressure grid around the cloud base.

Returns:
wlen_modeljnp.array

Wavlength array of computed model, not binned to data [um]

spectrum_modeljnp.array

Computed emission spectrum [W/m2/micron]

contr_emOptional, ArrayLike

Emission contribution function, relative contributions for each wavelength and pressure level. Only returns the contribution of the clear atmosphere component.

petitRADTRANS.retrieval.models.legacy_guillot_emission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)#

Emission spectrum calculation for the Guillot 2010 temperature profile. (Dis)equilibrium or free chemistry, can be used. The use of easychem for on-the-fly (dis)equilibrium chemistry calculations is supported, but is currently under development.

Args:
prt_objectobject

An instance of the pRT class, with optical properties as defined in the RunDefinition.

parametersdict
Dictionary of required parameters:
  • distance_to_system : Distance to the planet in [cm]

Two of
  • log_g : Log of surface gravity

  • planet_radius : planet radius [cm]

  • mass : planet mass [g]

  • T_int : Interior temperature of the planet [K]

  • T_equ : Equilibrium temperature of the planet

  • gamma : Guillot gamma parameter

  • log_kappa_IR : The log of the ratio between the infrared and optical opacities

Either:
  • log_pquench : Pressure at which CO, CH4 and H2O abundances become vertically constant

  • Fe/H : Metallicity

  • C/O : Carbon to oxygen ratio

Or:
  • $SPECIESNAME[_$DATABASE][_R_$RESOLUTION] : The log mass fraction abundance of the species

  • fsed : sedimentation parameter - can be unique to each cloud type

One of:
  • sigma_lnorm : Width of cloud particle size distribution (log normal)

  • b_hans : Width of cloud particle size distribution (hansen)

One of:
  • log_cloud_radius_* : Central particle radius (typically computed with fsed and Kzz)

  • log_kzz : Vertical mixing parameter

One of
  • eq_scaling_* : Scaling factor for equilibrium cloud abundances.

  • log_X_cb_: cloud mass fraction abundance

Optional
  • contribution : return the emission contribution function

  • patchiness : Cloud coverage fraction, mixes two columns with different cloud properties.

  • remove_cloud_species : Specifies which cloud species to remove for the clear atmosphere column.

  • T_disk_blackbody : Temperature of a blackbody circumplanetary disk component.

  • disk_radius : Radius [cm] of a blackbody circumplanetary disk component.

pt_plot_modebool

Return only the pressure-temperature profile for plotting. Evaluate mode only.

adaptive_mesh_refinement :

Adaptive mesh refinement. Use the high resolution pressure grid around the cloud base.

Returns:
wlen_modeljnp.array

Wavlength array of computed model, not binned to data [um]

spectrum_modeljnp.array

Computed transmission spectrum planet_radius**2/Rstar**2

contr-emArrayLike

Optional, Emission contribution function, relative contributions for each wavelength and pressure level.

petitRADTRANS.retrieval.models.legacy_guillot_emission_add_gaussian_temperature(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)#

Emission spectrum calculation for the Guillot 2010 temperature profile. (Dis)equilibrium or free chemistry, can be used. The use of easychem for on-the-fly (dis)equilibrium chemistry calculations is supported, but is currently under development.

Args:
prt_objectobject

An instance of the pRT class, with optical properties as defined in the RunDefinition.

parametersdict
Dictionary of required parameters:
  • distance_to_system : Distance to the planet in [cm]

Two of
  • log_g : Log of surface gravity

  • planet_radius : planet radius [cm]

  • mass : planet mass [g]

  • T_int : Interior temperature of the planet [K]

  • T_equ : Equilibrium temperature of the planet

  • gamma : Guillot gamma parameter

  • log_kappa_IR : The log of the ratio between the infrared and optical opacities

Either:
  • log_pquench : Pressure at which CO, CH4 and H2O abundances become vertically constant

  • Fe/H : Metallicity

  • C/O : Carbon to oxygen ratio

Or:
  • $SPECIESNAME[_$DATABASE][_R_$RESOLUTION] : The log mass fraction abundance of the species

  • fsed : sedimentation parameter - can be unique to each cloud type

One of:
  • sigma_lnorm : Width of cloud particle size distribution (log normal)

  • b_hans : Width of cloud particle size distribution (hansen)

One of:
  • log_cloud_radius_* : Central particle radius (typically computed with fsed and Kzz)

  • log_kzz : Vertical mixing parameter

One of
  • eq_scaling_* : Scaling factor for equilibrium cloud abundances.

  • log_X_cb_: cloud mass fraction abundance

Optional
  • contribution : return the emission contribution function

  • patchiness : Cloud coverage fraction, mixes two columns with different cloud properties.

  • remove_cloud_species : Specifies which cloud species to remove for the clear atmosphere column.

  • T_disk_blackbody : Temperature of a blackbody circumplanetary disk component.

  • disk_radius : Radius [cm] of a blackbody circumplanetary disk component.

pt_plot_modebool

Return only the pressure-temperature profile for plotting. Evaluate mode only.

adaptive_mesh_refinement :

Adaptive mesh refinement. Use the high resolution pressure grid around the cloud base.

Returns:
wlen_modeljnp.array

Wavlength array of computed model, not binned to data [um]

spectrum_modeljnp.array

Computed transmission spectrum planet_radius**2/Rstar**2

contr-emArrayLike

Optional, Emission contribution function, relative contributions for each wavelength and pressure level.

petitRADTRANS.retrieval.models.legacy_guillot_patchy_emission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)#

Deprecated, to be removed in future version

petitRADTRANS.retrieval.models.legacy_interpolated_profile_emission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)#

This model computes a emission spectrum based a spline temperature-pressure profile. Either free or equilibrium chemistry can be used, together with a range of cloud parameterizations. It is possible to use free abundances for some species and equilibrium chemistry for the remainder.

Args:
prt_objectobject

An instance of the pRT class, with optical properties as defined in the RunDefinition.

parametersdict
Dictionary of required parameters:
  • distance_to_system : Distance to the planet in [cm]

Two of
  • log_g : Log of surface gravity

  • planet_radius : planet radius [cm]

  • mass : planet mass [g]

  • nnodesnumber of nodes to interplate, excluding the first and last points.

    so the total number of nodes is nnodes + 2

  • T{i} : One parameter for each temperature node

  • gamma : weight for penalizing the profile curvature

Either:
  • log_pquench : Pressure at which CO, CH4 and H2O abundances become vertically constant

  • Fe/H : Metallicity

  • C/O : Carbon to oxygen ratio

Or:
  • $SPECIESNAME[_$DATABASE][_R_$RESOLUTION] : The log mass fraction abundance of the species

Optional: * fsed : sedimentation parameter - can be unique to each cloud type One of:

  • sigma_lnorm : Width of cloud particle size distribution (log normal)

  • b_hans : Width of cloud particle size distribution (hansen)

One of:
  • log_cloud_radius_* : Central particle radius (typically computed with fsed and Kzz)

  • log_kzz : Vertical mixing parameter

One of
  • eq_scaling_* : Scaling factor for equilibrium cloud abundances.

  • log_X_cb_: cloud mass fraction abundance

Optional
  • contribution : return the emission contribution function

  • patchiness : Cloud coverage fraction, mixes two columns with different cloud properties.

  • remove_cloud_species : Specifies which cloud species to remove for the clear atmosphere column.

  • T_disk_blackbody : Temperature of a blackbody circumplanetary disk component.

  • disk_radius : Radius [cm] of a blackbody circumplanetary disk component.

pt_plot_modebool

Return only the pressure-temperature profile for plotting. Evaluate mode only.

adaptive_mesh_refinement :

Adaptive mesh refinement. Use the high resolution pressure grid around the cloud base.

Returns:
wlen_modeljnp.array

Wavlength array of computed model, not binned to data [um]

spectrum_modeljnp.array

Computed transmission spectrum planet_radius**2/Rstar**2

contr-emArrayLike

Optional, the emission contribution function, relative contributions for each wavelength and pressure level.

petitRADTRANS.retrieval.models.legacy_gradient_profile_emission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)#

This model computes a emission spectrum based a gradient temperature-pressure profile (Zhang 2023). Either free or equilibrium chemistry can be used, together with a range of cloud parameterizations. It is possible to use free abundances for some species and equilibrium chemistry for the remainder.

Args:
prt_objectobject

An instance of the pRT class, with optical properties as defined in the RunDefinition.

parametersdict
Dictionary of required parameters:
  • distance_to_system : Distance to the planet in [cm]

Two of
  • log_g : Log of surface gravity

  • planet_radius : planet radius [cm]

  • mass : planet mass [g]

  • N_layersnumber of nodes to interplate, excluding the first and last points.

    so the total number of nodes is nnodes + 2

  • T_bottom : temperature at the base of the atmosphere

  • PTslope_* : temperature gradient for each of the n_layers between which the profile is interpolated.

Either:
  • log_pquench : Pressure at which CO, CH4 and H2O abundances become vertically constant

  • Fe/H : Metallicity

  • C/O : Carbon to oxygen ratio

Or:
  • $SPECIESNAME[_$DATABASE][_R_$RESOLUTION] : The log mass fraction abundance of the species

Optional: * fsed : sedimentation parameter - can be unique to each cloud type One of:

  • sigma_lnorm : Width of cloud particle size distribution (log normal)

  • b_hans : Width of cloud particle size distribution (hansen)

One of:
  • log_cloud_radius_* : Central particle radius (typically computed with fsed and Kzz)

  • log_kzz : Vertical mixing parameter

One of
  • eq_scaling_* : Scaling factor for equilibrium cloud abundances.

  • log_X_cb_: cloud mass fraction abundance

Optional
  • contribution : return the emission contribution function

  • patchiness : Cloud coverage fraction, mixes two columns with different cloud properties.

  • remove_cloud_species : Specifies which cloud species to remove for the clear atmosphere column.

  • T_disk_blackbody : Temperature of a blackbody circumplanetary disk component.

  • disk_radius : Radius [cm] of a blackbody circumplanetary disk component.

pt_plot_modebool

Return only the pressure-temperature profile for plotting. Evaluate mode only.

adaptive_mesh_refinement :

Adaptive mesh refinement. Use the high resolution pressure grid around the cloud base.

Returns:
wlen_modeljnp.array

Wavlength array of computed model, not binned to data [um]

spectrum_modeljnp.array

Computed transmission spectrum planet_radius**2/Rstar**2

contr-emArrayLike

Optional, the emission contribution function, relative contributions for each wavelength and pressure level.

petitRADTRANS.retrieval.models.legacy_power_law_profile_emission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)#

This model computes a emission spectrum based a gradient temperature-pressure profile (Zhang 2023). Either free or equilibrium chemistry can be used, together with a range of cloud parameterizations. It is possible to use free abundances for some species and equilibrium chemistry for the remainder.

Args:
prt_objectobject

An instance of the pRT class, with optical properties as defined in the RunDefinition.

parametersdict
Dictionary of required parameters:
  • distance_to_system : Distance to the planet in [cm]

Two of
  • log_g : Log of surface gravity

  • planet_radius : planet radius [cm]

  • mass : planet mass [g]

  • alpha : power law slope for the temperture profile

  • T_0 : multiplicative factor for the power law slope

Either:
  • log_pquench : Pressure at which CO, CH4 and H2O abundances become vertically constant

  • Fe/H : Metallicity

  • C/O : Carbon to oxygen ratio

Or:
  • $SPECIESNAME[_$DATABASE][_R_$RESOLUTION] : The log mass fraction abundance of the species

Optional: * fsed : sedimentation parameter - can be unique to each cloud type One of:

  • sigma_lnorm : Width of cloud particle size distribution (log normal)

  • b_hans : Width of cloud particle size distribution (hansen)

One of:
  • log_cloud_radius_* : Central particle radius (typically computed with fsed and Kzz)

  • log_kzz : Vertical mixing parameter

One of
  • eq_scaling_* : Scaling factor for equilibrium cloud abundances.

  • log_X_cb_: cloud mass fraction abundance

Optional
  • contribution : return the emission contribution function

  • patchiness : Cloud coverage fraction, mixes two columns with different cloud properties.

  • remove_cloud_species : Specifies which cloud species to remove for the clear atmosphere column.

  • T_disk_blackbody : Temperature of a blackbody circumplanetary disk component.

  • disk_radius : Radius [cm] of a blackbody circumplanetary disk component.

pt_plot_modebool

Return only the pressure-temperature profile for plotting. Evaluate mode only.

adaptive_mesh_refinement :

Adaptive mesh refinement. Use the high resolution pressure grid around the cloud base.

Returns:
wlen_modeljnp.array

Wavlength array of computed model, not binned to data [um]

spectrum_modeljnp.array

Computed transmission spectrum planet_radius**2/Rstar**2

contr-emArrayLike

Optional, the emission contribution function, relative contributions for each wavelength and pressure level.

petitRADTRANS.retrieval.models.legacy_guillot_transmission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)#

Transmission Model, Guillot Profile

This model computes a transmission spectrum based on the Guillot profile Either free or (dis)equilibrium chemistry can be used, together with a range of cloud parameterizations. It is possible to use free abundances for some species and equilibrium chemistry for the remainder. Chemical clouds can be used, or a simple gray opacity source.

Args:
prt_objectobject

An instance of the pRT class, with optical properties as defined in the RunDefinition.

parametersdict
Dictionary of required parameters:
  • distance_to_system : Distance to the planet in [cm]

Two of
  • log_g : Log of surface gravity

  • planet_radius : planet radius [cm]

  • mass : planet mass [g]

  • T_int : Interior temperature of the planet [K]

  • T_equ : Equilibrium temperature of the planet

  • gamma : Guillot gamma parameter

  • log_kappa_IR : The log of the ratio between the infrared and optical opacities

Either:
  • log_pquench : Pressure at which CO, CH4 and H2O abundances become vertically constant

  • Fe/H : Metallicity

  • C/O : Carbon to oxygen ratio

Or:
  • $SPECIESNAME[_$DATABASE][.R$RESOLUTION] : The log mass fraction abundance of the species

Either:
  • [log_]Pcloud : The (log) pressure at which to place the gray cloud opacity.

Or:
  • fsed : sedimentation parameter - can be unique to each cloud type

One of:
  • sigma_lnorm : Width of cloud particle size distribution (log normal)

  • b_hans : Width of cloud particle size distribution (hansen)

One of:
  • log_cloud_radius_* : Central particle radius (typically computed with fsed and Kzz)

  • log_kzz : Vertical mixing parameter

One of
  • eq_scaling_* : Scaling factor for equilibrium cloud abundances.

  • log_X_cb_: cloud mass fraction abundance

Optional
  • contribution : return the transmission contribution function

  • power_law_opacity_coefficient : gamma, power law slope for a rayleigh-like haze

  • haze_factor : multiplicative scaling factor for the strength of the rayleigh haze

  • power_law_opacity_350nm : strength of the rayleigh haze at 350 nm.

pt_plot_modebool

Return only the pressure-temperature profile for plotting. Evaluate mode only.

adaptive_mesh_refinement :

Adaptive mesh refinement. Use the high resolution pressure grid around the cloud base.

Returns:
wlen_modeljnp.array

Wavlength array of computed model, not binned to data [um]

spectrum_modeljnp.array

Computed transmission spectrum planet_radius**2/Rstar**2

contr-emArrayLike

Optional, the transmission contribution function, relative contributions for each wavelength and pressure level.

petitRADTRANS.retrieval.models.legacy_guillot_patchy_transmission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)#

Deprecated

petitRADTRANS.retrieval.models.legacy_madhushudhan_seager_emission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)#

Transmission Model, Madhusudhan Seager 2009 Profile

This model computes a transmission spectrum based on a Guillot temperature-pressure profile. Either free or equilibrium chemistry can be used, together with a range of cloud parameterizations. It is possible to use free abundances for some species and equilibrium chemistry for the remainder. Chemical clouds can be used, or a simple gray opacity source. This model requires patchy clouds.

Args:
prt_objectobject

An instance of the pRT class, with optical properties as defined in the RunDefinition.

parametersdict
Dictionary of required parameters:
  • distance_to_system : Distance to the planet in [cm]

Two of
  • log_g : Log of surface gravity

  • planet_radius : planet radius [cm]

  • mass : planet mass [g]

  • log_P_set : Pressure value to contrain the PT profile, defaults to 10 bar.

  • T_set : temperature at P_set to constrain the PT profile. [K]

  • log_P3 : (log) Pressure value for the top of the deep atmospheric layer, [bar]

  • P2 : in range (0,1), sets the pressure level of the middle atmospheric layer

  • P1 : in range (0,1), sets the pressure level of the top atmospheric layer

  • alpha_0 : slope of the upper atmospheric layer

  • alpha_1 : slope of the middle atmospheric layer

Optional :
  • beta : power law for the slopes, default value is 0.5. Not recommended to change!

Either:
  • log_pquench : Pressure at which CO, CH4 and H2O abundances become vertically constant

  • Fe/H : Metallicity

  • C/O : Carbon to oxygen ratio

Or:
  • $SPECIESNAME[_$DATABASE][.R$RESOLUTION] : The log mass fraction abundance of the species

Optional: * fsed : sedimentation parameter - can be unique to each cloud type One of:

  • sigma_lnorm : Width of cloud particle size distribution (log normal)

  • b_hans : Width of cloud particle size distribution (hansen)

One of:
  • log_cloud_radius_* : Central particle radius (typically computed with fsed and Kzz)

  • log_kzz : Vertical mixing parameter

One of
  • eq_scaling_* : Scaling factor for equilibrium cloud abundances.

  • log_X_cb_: cloud mass fraction abundance

Optional
  • contribution : return the emission contribution function

  • patchiness : Cloud coverage fraction, mixes two columns with different cloud properties.

  • remove_cloud_species : Specifies which cloud species to remove for the clear atmosphere column.

  • T_disk_blackbody : Temperature of a blackbody circumplanetary disk component.

  • disk_radius : Radius [cm] of a blackbody circumplanetary disk component.

pt_plot_modebool

Return only the pressure-temperature profile for plotting. Evaluate mode only.

adaptive_mesh_refinement :

Adaptive mesh refinement. Use the high resolution pressure grid around the cloud base.

Returns:
wlen_modeljnp.array

Wavlength array of computed model, not binned to data [um]

spectrum_modeljnp.array

Computed transmission spectrum planet_radius**2/Rstar**2

contr-emArrayLike

Optional, the transmission contribution function, relative contributions for each wavelength and pressure level. Only the clear atmosphere contribution is returned.

petitRADTRANS.retrieval.models.legacy_madhushudhan_seager_transmission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)#

Transmission Model, Madhusudhan Seager 2009 Profile

This model computes a transmission spectrum based on a Guillot temperature-pressure profile. Either free or equilibrium chemistry can be used, together with a range of cloud parameterizations. It is possible to use free abundances for some species and equilibrium chemistry for the remainder. Chemical clouds can be used, or a simple gray opacity source. This model requires patchy clouds.

Args:
prt_objectobject

An instance of the pRT class, with optical properties as defined in the RunDefinition.

parametersdict
Dictionary of required parameters:
  • distance_to_system : Distance to the planet in [cm]

Two of
  • log_g : Log of surface gravity

  • planet_radius : planet radius [cm]

  • mass : planet mass [g]

  • log_P_set : Pressure value to contrain the PT profile, defaults to 10 bar.

  • T_set : temperature at P_set to constrain the PT profile. [K]

  • log_P3 : (log) Pressure value for the top of the deep atmospheric layer, [bar]

  • P2 : in range (0,1), sets the pressure level of the middle atmospheric layer

  • P1 : in range (0,1), sets the pressure level of the top atmospheric layer

  • alpha_0 : slope of the upper atmospheric layer

  • alpha_1 : slope of the middle atmospheric layer

Optional :
  • beta : power law for the slopes, default value is 0.5. Not recommended to change!

Either:
  • log_pquench : Pressure at which CO, CH4 and H2O abundances become vertically constant

  • Fe/H : Metallicity

  • C/O : Carbon to oxygen ratio

Or:
  • $SPECIESNAME[_$DATABASE][.R$RESOLUTION] : The log mass fraction abundance of the species

Either:
  • [log_]Pcloud : The (log) pressure at which to place the gray cloud opacity.

Or:
  • fsed : sedimentation parameter - can be unique to each cloud type

One of:
  • sigma_lnorm : Width of cloud particle size distribution (log normal)

  • b_hans : Width of cloud particle size distribution (hansen)

One of:
  • log_cloud_radius_* : Central particle radius (typically computed with fsed and Kzz)

  • log_kzz : Vertical mixing parameter

One of
  • eq_scaling_* : Scaling factor for equilibrium cloud abundances.

  • log_X_cb_: cloud mass fraction abundance

Optional
  • contribution : return the transmission contribution function

  • power_law_opacity_coefficient : gamma, power law slope for a rayleigh-like haze

  • haze_factor : multiplicative scaling factor for the strength of the rayleigh haze

  • power_law_opacity_350nm : strength of the rayleigh haze at 350 nm.

pt_plot_modebool

Return only the pressure-temperature profile for plotting. Evaluate mode only.

adaptive_mesh_refinement :

Adaptive mesh refinement. Use the high resolution pressure grid around the cloud base.

Returns:
wlen_modeljnp.array

Wavlength array of computed model, not binned to data [um]

spectrum_modeljnp.array

Computed transmission spectrum planet_radius**2/Rstar**2

contr-emArrayLike

Optional, the transmission contribution function, relative contributions for each wavelength and pressure level. Only the clear atmosphere contribution is returned.

petitRADTRANS.retrieval.models.legacy_madhu_seager_patchy_transmission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)#

Deprecated

petitRADTRANS.retrieval.models.legacy_isothermal_transmission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)#

Equilibrium Chemistry Transmission Model, Isothermal Profile

This model computes a transmission spectrum based on an isothermal temperature-pressure profile.

Args:
prt_objectobject

An instance of the pRT class, with optical properties as defined in the RunDefinition.

parametersdict
Dictionary of required parameters:
  • distance_to_system : Distance to the planet in [cm]

Two of
  • log_g : Log of surface gravity

  • planet_radius : planet radius [cm]

  • mass : planet mass [g]

  • temperature : Interior temperature of the planet [K]

Either:
  • log_pquench : Pressure at which CO, CH4 and H2O abundances become vertically constant

  • Fe/H : Metallicity

  • C/O : Carbon to oxygen ratio

Or:
  • $SPECIESNAME[_$DATABASE][.R$RESOLUTION] : The log mass fraction abundance of the species

Either:
  • [log_]Pcloud : The (log) pressure at which to place the gray cloud opacity.

Or:
  • fsed : sedimentation parameter - can be unique to each cloud type

One of:
  • sigma_lnorm : Width of cloud particle size distribution (log normal)

  • b_hans : Width of cloud particle size distribution (hansen)

One of:
  • log_cloud_radius_* : Central particle radius (typically computed with fsed and Kzz)

  • log_kzz : Vertical mixing parameter

One of
  • eq_scaling_* : Scaling factor for equilibrium cloud abundances.

  • log_X_cb_: cloud mass fraction abundance

Optional
  • contribution : return the transmission contribution function

  • power_law_opacity_coefficient : gamma, power law slope for a rayleigh-like haze

  • haze_factor : multiplicative scaling factor for the strength of the rayleigh haze

  • power_law_opacity_350nm : strength of the rayleigh haze at 350 nm.

pt_plot_modebool

Return only the pressure-temperature profile for plotting. Evaluate mode only.

adaptive_mesh_refinement :

Adaptive mesh refinement. Use the high resolution pressure grid around the cloud base.

Returns:
wlen_modeljnp.array

Wavlength array of computed model, not binned to data [um]

spectrum_modeljnp.array

Computed transmission spectrum planet_radius**2/Rstar**2

contr-emArrayLike

Optional, the transmission contribution function, relative contributions for each wavelength and pressure level. Only the clear atmosphere contribution is returned if patchy clouds are considered.

petitRADTRANS.retrieval.models.legacy_power_law_profile_transmission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)#

This model computes a emission spectrum based a gradient temperature-pressure profile (Zhang 2023). Either free or equilibrium chemistry can be used, together with a range of cloud parameterizations. It is possible to use free abundances for some species and equilibrium chemistry for the remainder.

Args:
prt_objectobject

An instance of the pRT class, with optical properties as defined in the RunDefinition.

parametersdict
Dictionary of required parameters:
  • distance_to_system : Distance to the planet in [cm]

Two of
  • log_g : Log of surface gravity

  • planet_radius : planet radius [cm]

  • mass : planet mass [g]

  • alpha : power law slope for the temperture profile

  • T_0 : multiplicative factor for the power law slope

Either:
  • log_pquench : Pressure at which CO, CH4 and H2O abundances become vertically constant

  • Fe/H : Metallicity

  • C/O : Carbon to oxygen ratio

Or:
  • $SPECIESNAME[_$DATABASE][_R_$RESOLUTION] : The log mass fraction abundance of the species

Optional: * fsed : sedimentation parameter - can be unique to each cloud type One of:

  • sigma_lnorm : Width of cloud particle size distribution (log normal)

  • b_hans : Width of cloud particle size distribution (hansen)

One of:
  • log_cloud_radius_* : Central particle radius (typically computed with fsed and Kzz)

  • log_kzz : Vertical mixing parameter

One of
  • eq_scaling_* : Scaling factor for equilibrium cloud abundances.

  • log_X_cb_: cloud mass fraction abundance

Optional
  • contribution : return the emission contribution function

  • patchiness : Cloud coverage fraction, mixes two columns with different cloud properties.

  • remove_cloud_species : Specifies which cloud species to remove for the clear atmosphere column.

  • T_disk_blackbody : Temperature of a blackbody circumplanetary disk component.

  • disk_radius : Radius [cm] of a blackbody circumplanetary disk component.

pt_plot_modebool

Return only the pressure-temperature profile for plotting. Evaluate mode only.

adaptive_mesh_refinement :

Adaptive mesh refinement. Use the high resolution pressure grid around the cloud base.

Returns:
wlen_modeljnp.array

Wavlength array of computed model, not binned to data [um]

spectrum_modeljnp.array

Computed transmission spectrum planet_radius**2/Rstar**2

contr-emArrayLike

Optional, the emission contribution function, relative contributions for each wavelength and pressure level.

petitRADTRANS.retrieval.models.add_blackbody_cpd_model(parameters, wavelengths)#

Calculates the flux of a blackbody with area 4*pi*disk_radius^2 and temperature T_disk_blackbody. This is in units of W/m2/micron, and can be added to a planetary spectrum to model the contribution of a circumplanetary disk

Args:

parameters (dict): dictionary of atmospheric and disk parameters wavelengths (ArrayLike): Wavelength grid of atmospheric model in micron

Returns:

blackbody_spectrum (ArrayLike): 1D Planck emission spectrum for a circular CPD.

petitRADTRANS.retrieval.models.initialize_pressure(press, parameters, adaptive_mesh_refinement)#
petitRADTRANS.retrieval.models.initialize_pressure_from_legacy_dict(press, parameters, adaptive_mesh_refinement)#

Legacy wrapper for initialize_pressure().

Converts a legacy parameter dictionary (values accessed via .value) to a plain-value mapping before forwarding to initialize_pressure().

Args:
parametersdict

Legacy parameter dictionary where each value is an object with a .value attribute.

All other arguments are forwarded unchanged to initialize_pressure().

petitRADTRANS.retrieval.models._as_auxiliary_outputs(outputs)#
petitRADTRANS.retrieval.models._EMISSION_RUNTIME_AUXILIARY_OUTPUT_EXCLUSIONS#
petitRADTRANS.retrieval.models._as_filtered_auxiliary_outputs(outputs, excluded_keys=())#
petitRADTRANS.retrieval.models._is_scalar_like(value)#
petitRADTRANS.retrieval.models._build_model_context_from_parameters(name, mode, prt_object, parameters, adaptive_mesh_refinement=False, variability_atmospheric_column_model_flux_return_mode=False, model_metadata=None)#
petitRADTRANS.retrieval.models._normalize_model_output(model_output, pt_plot_mode=False)#
petitRADTRANS.retrieval.models._model_result_to_legacy_output(model_result: petitRADTRANS.retrieval.runtime.ModelResult)#
petitRADTRANS.retrieval.models.run_legacy_model_adapter(model_function, model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, *, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models._infer_model_function_contract(model_function, declared_contract: str) str#

Resolve the model contract using explicit registration only.

Contract detection follows strict precedence: 1. Explicit _prt_model_contract attribute (set by mark_legacy_model_function()). 2. The caller-supplied declared_contract. 3. Fallback to MODEL_CONTRACT_LEGACY.

No signature inspection is performed — models must opt in to the runtime-native contract via the decorator or by setting the attribute directly.

petitRADTRANS.retrieval.models.coerce_model_generating_function(model_function, declared_contract: str = MODEL_CONTRACT_LEGACY)#
petitRADTRANS.retrieval.models.run_runtime_model_adapter(model_function, model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, *, pt_plot_mode: bool = False) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.make_unified_model(fn, legacy_fn=None)#

Return a single callable that dispatches to fn or legacy_fn based on the type of the first positional argument.

When the first argument is a ModelContext instance, the differentiable code path is taken. Any other type routes to the legacy calling convention (prt_object, parameters, ...). If no legacy_fn is supplied and the first argument is not a ModelContext, a TypeError is raised.

The dispatcher carries _prt_model_contract == MODEL_CONTRACT_DIFFERENTIABLE so that coerce_model_generating_function() and the retrieval runtime treat it as a first-class differentiable function. The constituent functions remain accessible as .___ and .__legacy__ attributes.

petitRADTRANS.retrieval.models._initialize_runtime_pressure_grid(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params)#
petitRADTRANS.retrieval.models._resolve_runtime_abundance_state(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params, p_use, p_global, temperatures, *, temperature_builder=None, pt_plot_mode: bool = False)#
petitRADTRANS.retrieval.models._build_runtime_emission_model_inputs(physical_params, abundance_state, gravity, planet_radius, cloud_properties)#
petitRADTRANS.retrieval.models._build_runtime_transmission_model_inputs(physical_params, abundance_state, gravity, planet_radius, *, reference_pressure, opaque_cloud_top_pressure, haze_factor, power_law_opacity_coefficient, power_law_opacity_350nm, cloud_properties)#
petitRADTRANS.retrieval.models.calculate_emission_spectrum_runtime(model_context: petitRADTRANS.retrieval.runtime.ModelContext, model_inputs: petitRADTRANS.retrieval.runtime.ModelInputs) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.calculate_emission_spectra_batched(model_context: petitRADTRANS.retrieval.runtime.ModelContext, batched_model_inputs: petitRADTRANS.retrieval.runtime.ModelInputs) petitRADTRANS.retrieval.runtime.ModelResult#

Evaluate emission spectra for a batch of model inputs via vmap.

model_context (including the Radtrans object and all static flags) is treated as static across the batch. Only the per-sample arrays inside batched_model_inputs are mapped over. Each leaf of batched_model_inputs must carry a leading batch dimension.

This is the preferred entry point when the caller has already constructed batched ModelInputs and wants to run the RT kernel efficiently without wrapping the full evaluation pipeline.

Args:

model_context: Static evaluation context shared across all samples. batched_model_inputs: A ModelInputs pytree whose leaves each have

shape (batch_size, ...) — i.e. the first axis is the batch dim.

Returns:

A ModelResult whose wavelengths and spectrum leaves have a leading batch dimension (batch_size, n_wavelengths).

petitRADTRANS.retrieval.models.calculate_transmission_spectrum_runtime(model_context: petitRADTRANS.retrieval.runtime.ModelContext, model_inputs: petitRADTRANS.retrieval.runtime.ModelInputs) petitRADTRANS.retrieval.runtime.ModelResult#
petitRADTRANS.retrieval.models.calculate_emission_spectrum(prt_object, parameters, temperatures, abundances, gravity, mean_molar_masses, planet_radius, sigma_lnorm, cloud_particle_mean_radii, cloud_f_sed, eddy_diffusion_coefficients, cloud_hansen_b, cloud_fraction, patchy_clouds, distribution)#

Calls Radtrans.calculate_flux to compute the emission spectrum of an atmosphere. This function automatically checks if patchiness is included in the retrieval, and mixes the clear and cloudy columns. Patchiness can be applied to all of the cloud species, or individual clouds can be chosen using the remove_cloud_species parameter. A circumplanetary disk model is optionally included, modelled as a blackbody with some temperature T_disk_blackbody and a radius disk_radius.

Args:

prt_object (Radtrans): The Radtrans object used to calculate the spectrum parameters (dict): Dictionary of atmospheric parameters. temperatures (ArrayLike): Array of temperatures for each pressure level in the atmosphere abundances (dict): Dictionary of molecular mass fraction abundances for each level in the atmosphere gravity (ArrayLike): Gravitational acceleration at each pressure level mean_molar_masses (ArrayLike): Mean molecular mass at each pressure level planet_radius (float): Planet radius in cm sigma_lnorm (float): Width of the cloud particle size distribution (log-normal) cloud_particle_mean_radii (ArrayLike): Mean particle radius cloud_f_sed (ArrayLike): Sedimentation fraction eddy_diffusion_coefficients (ArrayLike): Vertical mixing strength (Kzz) cloud_hansen_b (ArrayLike): Cloud particle distribution width, hansen distsribution cloud_fraction (float) : fraction of planet covered by clouds patchy_clouds (list(str)) : Which clouds are patchy distribution (string): Which cloud particle size distribution to use

petitRADTRANS.retrieval.models.calculate_transmission_spectrum(prt_object, parameters, temperatures, abundances, gravity, mean_molar_masses, planet_radius, reference_pressure, opaque_cloud_top_pressure, sigma_lnorm, cloud_particle_mean_radii, cloud_f_sed, eddy_diffusion_coefficients, haze_factor, power_law_opacity_coefficient, power_law_opacity_350nm, cloud_hansen_b, cloud_fraction, patchy_clouds, distribution)#

_summary_

Args:

prt_object (Radtrans): The Radtrans object used to calculate the spectrum parameters (dict): Dictionary of atmospheric parameters. temperatures (ArrayLike): Array of temperatures for each pressure level in the atmosphere abundances (dict): Dictionary of molecular mass fraction abundances for each level in the atmosphere gravity (ArrayLike): Gravitational acceleration at each pressure level mean_molar_masses (ArrayLike): Mean molecular mass at each pressure level planet_radius (float):Planet radius in cm reference_pressure (float): Pressure at which the planet radius is defined opaque_cloud_top_pressure (float): Pressure where an opaque grey cloud deck is placed sigma_lnorm (float): Width of the cloud particle size distribution (log-normal) cloud_particle_mean_radii (ArrayLike): Mean particle radius cloud_f_sed (ArrayLike): Sedimentation fraction eddy_diffusion_coefficients (ArrayLike): Vertical mixing strength (Kzz) haze_factor (float): Multiplicative factor on the strength of a power law haze slope power_law_opacity_coefficient (float): Exponent for the slope of a power law haze power_law_opacity_350nm (float): Strength of the power law scattering at 350nm cloud_hansen_b (ArrayLike): Cloud particle distribution width, hansen distsribution cloud_fraction (float) : fraction of planet covered by clouds patchy_clouds (list(str)) : Which clouds are patchy distribution (string): Log normal or hansen particle size distribution

Returns:

_type_: _description_

petitRADTRANS.retrieval.models.molliere_2020_emission#
petitRADTRANS.retrieval.models.molliere_2020_two_column#
petitRADTRANS.retrieval.models.guillot_emission#
petitRADTRANS.retrieval.models.guillot_emission_add_gaussian_temperature#
petitRADTRANS.retrieval.models.guillot_patchy_emission#
petitRADTRANS.retrieval.models.interpolated_profile_emission#
petitRADTRANS.retrieval.models.gradient_profile_emission#
petitRADTRANS.retrieval.models.power_law_profile_emission#
petitRADTRANS.retrieval.models.guillot_transmission#
petitRADTRANS.retrieval.models.guillot_patchy_transmission#
petitRADTRANS.retrieval.models.madhushudhan_seager_emission#
petitRADTRANS.retrieval.models.madhushudhan_seager_transmission#
petitRADTRANS.retrieval.models.madhu_seager_patchy_transmission#
petitRADTRANS.retrieval.models.isothermal_transmission#
petitRADTRANS.retrieval.models.power_law_profile_transmission#
petitRADTRANS.retrieval.models.time_series_gradient_emission#