petitRADTRANS.retrieval.models
==============================

.. py:module:: petitRADTRANS.retrieval.models

.. autoapi-nested-parse::

   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:

       ModelContext : ModelContext
           An object that contains the static information about the retrieval,
           including the Radtrans object.
       PhysicalParams : PhysicalParams
           An object containing all of the physical parameters of the model,
           which can be free parameters, or fixed values.
       pt_plot_mode : bool
           If this argument is True, the model function will return the pressure
           and temperature arrays instead of computing the flux.



Attributes
----------

.. autoapisummary::

   petitRADTRANS.retrieval.models.MODEL_CONTRACT_LEGACY
   petitRADTRANS.retrieval.models.MODEL_CONTRACT_DIFFERENTIABLE
   petitRADTRANS.retrieval.models.MODEL_CONTRACT_LEGACY_ADAPTER
   petitRADTRANS.retrieval.models._MODEL_CONTRACT_ATTRIBUTE
   petitRADTRANS.retrieval.models._WRAPPED_LEGACY_MODEL_ATTRIBUTE
   petitRADTRANS.retrieval.models._TIME_INDEXED_PATTERN
   petitRADTRANS.retrieval.models._SINUSOIDAL_SUFFIXES
   petitRADTRANS.retrieval.models._EMISSION_RUNTIME_AUXILIARY_OUTPUT_EXCLUSIONS
   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


Functions
---------

.. autoapisummary::

   petitRADTRANS.retrieval.models._is_full_easychem_requested
   petitRADTRANS.retrieval.models._as_structural_int
   petitRADTRANS.retrieval.models._normalize_legacy_output_value
   petitRADTRANS.retrieval.models._compute_gravity
   petitRADTRANS.retrieval.models._resolve_guillot_gamma
   petitRADTRANS.retrieval.models._clip_easychem_temperatures
   petitRADTRANS.retrieval.models._wrap_runtime_temperature_builder
   petitRADTRANS.retrieval.models._stack_runtime_cloud_base_pressures
   petitRADTRANS.retrieval.models.molliere_2020_emission
   petitRADTRANS.retrieval.models.molliere_2020_two_column
   petitRADTRANS.retrieval.models.guillot_emission
   petitRADTRANS.retrieval.models.guillot_relative_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._build_timestep_params
   petitRADTRANS.retrieval.models.time_series_gradient_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.mark_legacy_model_function
   petitRADTRANS.retrieval.models.legacy_molliere_2020_emission
   petitRADTRANS.retrieval.models.legacy_molliere_2020_two_column
   petitRADTRANS.retrieval.models.legacy_guillot_emission
   petitRADTRANS.retrieval.models.legacy_guillot_emission_add_gaussian_temperature
   petitRADTRANS.retrieval.models.legacy_guillot_patchy_emission
   petitRADTRANS.retrieval.models.legacy_interpolated_profile_emission
   petitRADTRANS.retrieval.models.legacy_gradient_profile_emission
   petitRADTRANS.retrieval.models.legacy_power_law_profile_emission
   petitRADTRANS.retrieval.models.legacy_guillot_transmission
   petitRADTRANS.retrieval.models.legacy_guillot_patchy_transmission
   petitRADTRANS.retrieval.models.legacy_madhushudhan_seager_emission
   petitRADTRANS.retrieval.models.legacy_madhushudhan_seager_transmission
   petitRADTRANS.retrieval.models.legacy_madhu_seager_patchy_transmission
   petitRADTRANS.retrieval.models.legacy_isothermal_transmission
   petitRADTRANS.retrieval.models.legacy_power_law_profile_transmission
   petitRADTRANS.retrieval.models.add_blackbody_cpd_model
   petitRADTRANS.retrieval.models.initialize_pressure
   petitRADTRANS.retrieval.models.initialize_pressure_from_legacy_dict
   petitRADTRANS.retrieval.models._as_auxiliary_outputs
   petitRADTRANS.retrieval.models._as_filtered_auxiliary_outputs
   petitRADTRANS.retrieval.models._is_scalar_like
   petitRADTRANS.retrieval.models._build_model_context_from_parameters
   petitRADTRANS.retrieval.models._normalize_model_output
   petitRADTRANS.retrieval.models._model_result_to_legacy_output
   petitRADTRANS.retrieval.models.run_legacy_model_adapter
   petitRADTRANS.retrieval.models._infer_model_function_contract
   petitRADTRANS.retrieval.models.coerce_model_generating_function
   petitRADTRANS.retrieval.models.run_runtime_model_adapter
   petitRADTRANS.retrieval.models.make_unified_model
   petitRADTRANS.retrieval.models._initialize_runtime_pressure_grid
   petitRADTRANS.retrieval.models._resolve_runtime_abundance_state
   petitRADTRANS.retrieval.models._build_runtime_emission_model_inputs
   petitRADTRANS.retrieval.models._build_runtime_transmission_model_inputs
   petitRADTRANS.retrieval.models.calculate_emission_spectrum_runtime
   petitRADTRANS.retrieval.models.calculate_emission_spectra_batched
   petitRADTRANS.retrieval.models.calculate_transmission_spectrum_runtime
   petitRADTRANS.retrieval.models.calculate_emission_spectrum
   petitRADTRANS.retrieval.models.calculate_transmission_spectrum


Module Contents
---------------

.. py:function:: _is_full_easychem_requested(parameters) -> bool

   Return whether the retrieval explicitly requested the full easyChem path.


.. py:data:: MODEL_CONTRACT_LEGACY
   :value: 'legacy'


.. py:data:: MODEL_CONTRACT_DIFFERENTIABLE
   :value: 'differentiable'


.. py:data:: MODEL_CONTRACT_LEGACY_ADAPTER
   :value: 'runtime_legacy_adapter'


.. py:data:: _MODEL_CONTRACT_ATTRIBUTE
   :value: '_prt_model_contract'


.. py:data:: _WRAPPED_LEGACY_MODEL_ATTRIBUTE
   :value: '_prt_wrapped_legacy_model'


.. py:data:: _TIME_INDEXED_PATTERN

.. py:data:: _SINUSOIDAL_SUFFIXES
   :value: ('_amplitude', '_period', '_phase', '_offset')


.. py:function:: _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.


.. py:function:: _normalize_legacy_output_value(value)

.. py:function:: _compute_gravity(physical_params)

.. py:function:: _resolve_guillot_gamma(parameters)

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


.. py:function:: _clip_easychem_temperatures(physical_params, temperatures)

.. py:function:: _wrap_runtime_temperature_builder(physical_params, temperature_builder)

.. py:function:: _stack_runtime_cloud_base_pressures(p_bases, dtype)

.. py:function:: molliere_2020_emission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) -> petitRADTRANS.retrieval.runtime.ModelResult

.. py:function:: 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

.. py:function:: guillot_emission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) -> petitRADTRANS.retrieval.runtime.ModelResult

.. py:function:: 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 :func:`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 :func:`guillot_emission`)
   -----------------------------------------------------------
   distance_to_system : float
       Distance from the system to the observer in cm.
   log_g, planet_radius, mass : float
       Two of these three must be supplied (see :func:`_compute_gravity`).
   T_int, T_equ, gamma, log_kappa_IR : float
       Guillot temperature-profile parameters.
   Fe/H, C/O, log_pquench : float
       Equilibrium-chemistry parameters.

   Additional stellar parameters
   -----------------------------
   star_effective_temperature : float
       Effective temperature of the host star in K.  Used to interpolate the
       PHOENIX spectral grid.
   stellar_radius : float, optional
       Stellar radius in cm.  If omitted, the radius from the PHOENIX grid is
       used.


.. py:function:: 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

.. py:function:: guillot_patchy_emission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) -> petitRADTRANS.retrieval.runtime.ModelResult

.. py:function:: interpolated_profile_emission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) -> petitRADTRANS.retrieval.runtime.ModelResult

.. py:function:: gradient_profile_emission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) -> petitRADTRANS.retrieval.runtime.ModelResult

.. py:function:: _build_timestep_params(physical_params, t_idx, t_value)

   Build a :class:`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.


.. py:function:: 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 :func:`_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

   .. math::

       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.


.. py:function:: 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

.. py:function:: guillot_transmission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) -> petitRADTRANS.retrieval.runtime.ModelResult

.. py:function:: guillot_patchy_transmission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) -> petitRADTRANS.retrieval.runtime.ModelResult

.. py:function:: madhushudhan_seager_emission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) -> petitRADTRANS.retrieval.runtime.ModelResult

.. py:function:: madhushudhan_seager_transmission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) -> petitRADTRANS.retrieval.runtime.ModelResult

.. py:function:: 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

.. py:function:: isothermal_transmission(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params: petitRADTRANS.retrieval.runtime.PhysicalParams, pt_plot_mode: bool = False) -> petitRADTRANS.retrieval.runtime.ModelResult

.. py:function:: 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

.. py:function:: mark_legacy_model_function(model_function)

.. py:function:: 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_object : object
           An instance of the pRT class, with optical properties as defined in the RunDefinition.
       parameters : dict
           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_mode : bool
           Return only the pressure-temperature profile for plotting. Evaluate mode only.
       adaptive_mesh_refinement : bool
           Adaptive mesh refinement. Use the high resolution pressure grid around the cloud base.

   Returns:
       wlen_model : ArrayLike
           Wavlength array of computed model, not binned to data [um]
       spectrum_model : ArrayLike
           Computed emission spectrum [W/m2/micron]
       contr_em : Optional, ArrayLike
           Emission contribution function, relative contributions for each wavelength and pressure level.



.. py:function:: 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_object : object
           An instance of the pRT class, with optical properties as defined in the RunDefinition.
       parameters : dict
           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_mode : bool
           Return only the pressure-temperature profile for plotting. Evaluate mode only.
       adaptive_mesh_refinement : bool
           Adaptive mesh refinement. Use the high resolution pressure grid around the cloud base.

   Returns:
       wlen_model : jnp.array
           Wavlength array of computed model, not binned to data [um]
       spectrum_model : jnp.array
           Computed emission spectrum [W/m2/micron]
       contr_em : Optional, ArrayLike
           Emission contribution function, relative contributions for each wavelength and pressure level.
           Only returns the contribution of the clear atmosphere component.



.. py:function:: 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_object : object
           An instance of the pRT class, with optical properties as defined in the RunDefinition.
       parameters : dict
           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_mode : bool
           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_model : jnp.array
           Wavlength array of computed model, not binned to data [um]
       spectrum_model : jnp.array
           Computed transmission spectrum planet_radius**2/Rstar**2
       contr-em : ArrayLike
           Optional, Emission contribution function, relative contributions for each wavelength and pressure level.



.. py:function:: 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_object : object
           An instance of the pRT class, with optical properties as defined in the RunDefinition.
       parameters : dict
           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_mode : bool
           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_model : jnp.array
           Wavlength array of computed model, not binned to data [um]
       spectrum_model : jnp.array
           Computed transmission spectrum planet_radius**2/Rstar**2
       contr-em : ArrayLike
           Optional, Emission contribution function, relative contributions for each wavelength and pressure level.



.. py:function:: legacy_guillot_patchy_emission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)

   Deprecated, to be removed in future version


.. py:function:: 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_object : object
           An instance of the pRT class, with optical properties as defined in the RunDefinition.
       parameters : dict
           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]
               *  nnodes : number 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_mode : bool
           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_model : jnp.array
           Wavlength array of computed model, not binned to data [um]
       spectrum_model : jnp.array
           Computed transmission spectrum planet_radius**2/Rstar**2
       contr-em : ArrayLike
           Optional, the emission contribution function, relative contributions for each wavelength and pressure level.


.. py:function:: 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_object : object
           An instance of the pRT class, with optical properties as defined in the RunDefinition.
       parameters : dict
           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_layers : number 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_mode : bool
           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_model : jnp.array
           Wavlength array of computed model, not binned to data [um]
       spectrum_model : jnp.array
           Computed transmission spectrum planet_radius**2/Rstar**2
       contr-em : ArrayLike
           Optional, the emission contribution function, relative contributions for each wavelength and pressure level.


.. py:function:: 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_object : object
           An instance of the pRT class, with optical properties as defined in the RunDefinition.
       parameters : dict
           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_mode : bool
           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_model : jnp.array
           Wavlength array of computed model, not binned to data [um]
       spectrum_model : jnp.array
           Computed transmission spectrum planet_radius**2/Rstar**2
       contr-em : ArrayLike
           Optional, the emission contribution function, relative contributions for each wavelength and pressure level.


.. py:function:: 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_object : object
           An instance of the pRT class, with optical properties as defined in the RunDefinition.
       parameters : dict
           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_mode : bool
           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_model : jnp.array
           Wavlength array of computed model, not binned to data [um]
       spectrum_model : jnp.array
           Computed transmission spectrum planet_radius**2/Rstar**2
       contr-em : ArrayLike
           Optional, the transmission contribution function, relative contributions for each wavelength and pressure
           level.


.. py:function:: legacy_guillot_patchy_transmission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)

   Deprecated


.. py:function:: 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_object : object
           An instance of the pRT class, with optical properties as defined in the RunDefinition.
       parameters : dict
           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_mode : bool
           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_model : jnp.array
           Wavlength array of computed model, not binned to data [um]
       spectrum_model : jnp.array
           Computed transmission spectrum planet_radius**2/Rstar**2
       contr-em : ArrayLike
           Optional, the transmission contribution function, relative contributions for each wavelength and pressure
           level.
           Only the clear atmosphere contribution is returned.


.. py:function:: 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_object : object
           An instance of the pRT class, with optical properties as defined in the RunDefinition.
       parameters : dict
           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_mode : bool
           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_model : jnp.array
           Wavlength array of computed model, not binned to data [um]
       spectrum_model : jnp.array
           Computed transmission spectrum planet_radius**2/Rstar**2
       contr-em : ArrayLike
           Optional, the transmission contribution function, relative contributions for each wavelength and pressure
           level.
           Only the clear atmosphere contribution is returned.


.. py:function:: legacy_madhu_seager_patchy_transmission(prt_object, parameters, pt_plot_mode=False, adaptive_mesh_refinement=False)

   Deprecated


.. py:function:: 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_object : object
           An instance of the pRT class, with optical properties as defined in the RunDefinition.
       parameters : dict
           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_mode : bool
           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_model : jnp.array
           Wavlength array of computed model, not binned to data [um]
       spectrum_model : jnp.array
           Computed transmission spectrum planet_radius**2/Rstar**2
       contr-em : ArrayLike
           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.


.. py:function:: 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_object : object
           An instance of the pRT class, with optical properties as defined in the RunDefinition.
       parameters : dict
           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_mode : bool
           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_model : jnp.array
           Wavlength array of computed model, not binned to data [um]
       spectrum_model : jnp.array
           Computed transmission spectrum planet_radius**2/Rstar**2
       contr-em : ArrayLike
           Optional, the emission contribution function, relative contributions for each wavelength and pressure level.


.. py:function:: 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.


.. py:function:: initialize_pressure(press, parameters, adaptive_mesh_refinement)

.. py:function:: initialize_pressure_from_legacy_dict(press, parameters, adaptive_mesh_refinement)

   Legacy wrapper for :func:`initialize_pressure`.

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

   Args:
       parameters : dict
           Legacy parameter dictionary where each value is an object with a ``.value`` attribute.
       All other arguments are forwarded unchanged to :func:`initialize_pressure`.


.. py:function:: _as_auxiliary_outputs(outputs)

.. py:data:: _EMISSION_RUNTIME_AUXILIARY_OUTPUT_EXCLUSIONS

.. py:function:: _as_filtered_auxiliary_outputs(outputs, excluded_keys=())

.. py:function:: _is_scalar_like(value)

.. py:function:: _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)

.. py:function:: _normalize_model_output(model_output, pt_plot_mode=False)

.. py:function:: _model_result_to_legacy_output(model_result: petitRADTRANS.retrieval.runtime.ModelResult)

.. py:function:: 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

.. py:function:: _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 :func:`mark_legacy_model_function`).
   2. The caller-supplied *declared_contract*.
   3. Fallback to :data:`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.


.. py:function:: coerce_model_generating_function(model_function, declared_contract: str = MODEL_CONTRACT_LEGACY)

.. py:function:: 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

.. py:function:: 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 :class:`~petitRADTRANS.retrieval.runtime.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
   :class:`ModelContext`, a :class:`TypeError` is raised.

   The dispatcher carries ``_prt_model_contract == MODEL_CONTRACT_DIFFERENTIABLE``
   so that :func:`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.


.. py:function:: _initialize_runtime_pressure_grid(model_context: petitRADTRANS.retrieval.runtime.ModelContext, physical_params)

.. py:function:: _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)

.. py:function:: _build_runtime_emission_model_inputs(physical_params, abundance_state, gravity, planet_radius, cloud_properties)

.. py:function:: _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)

.. py:function:: calculate_emission_spectrum_runtime(model_context: petitRADTRANS.retrieval.runtime.ModelContext, model_inputs: petitRADTRANS.retrieval.runtime.ModelInputs) -> petitRADTRANS.retrieval.runtime.ModelResult

.. py:function:: 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)``.


.. py:function:: calculate_transmission_spectrum_runtime(model_context: petitRADTRANS.retrieval.runtime.ModelContext, model_inputs: petitRADTRANS.retrieval.runtime.ModelInputs) -> petitRADTRANS.retrieval.runtime.ModelResult

.. py:function:: 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


.. py:function:: 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_


.. py:data:: molliere_2020_emission

.. py:data:: molliere_2020_two_column

.. py:data:: guillot_emission

.. py:data:: guillot_emission_add_gaussian_temperature

.. py:data:: guillot_patchy_emission

.. py:data:: interpolated_profile_emission

.. py:data:: gradient_profile_emission

.. py:data:: power_law_profile_emission

.. py:data:: guillot_transmission

.. py:data:: guillot_patchy_transmission

.. py:data:: madhushudhan_seager_emission

.. py:data:: madhushudhan_seager_transmission

.. py:data:: madhu_seager_patchy_transmission

.. py:data:: isothermal_transmission

.. py:data:: power_law_profile_transmission

.. py:data:: time_series_gradient_emission

