petitRADTRANS.physics

Module Contents

Functions

doppler_shift(wavelength_0, velocity)

Calculate the Doppler-shifted wavelength for electromagnetic waves.

guillot_global(P, kappa_IR, gamma, grav, T_int, T_equ)

Returns a temperature array, in units of K,

guillot_global_ret(P, delta, gamma, T_int, T_equ)

guillot_metallic_temperature_profile(pressures, gamma, ...)

Get a Guillot temperature profile depending on metallicity.

guillot_modif(P, delta, gamma, T_int, T_equ, ptrans, alpha)

hz2um(frequency)

Convert frequencies into wavelengths

isothermal(P, T)

running_mean(x, N)

make_press_temp(rad_trans_params)

make_press_temp_iso(rad_trans_params)

PT_ret_model(T3, delta, alpha, tint, press, FeH, CO[, ...])

Self-luminous retrieval P-T model.

madhu_seager_2009(press, pressure_points, T_set, ...)

Calculate temperatures based on the Madhusudhan and Seager (2009) parameterization.

cubic_spline_profile(press, temperature_points, gamma)

Compute a cubic spline profile for temperature based on pressure points.

linear_spline_profile(press, temperature_points, gamma)

Compute a linear spline profile for temperature based on pressure points.

temperature_curvature_prior(press, temps, gamma)

Compute a curvature prior for a temperature-pressure profile.

dTdP_temperature_profile(press, num_layer, ...)

This function takes the temperature gradient at a set number of spline points and interpolates a temperature profile as a function of pressure.

radiosity_erg_cm2radiosity_erg_hz(radiosity_erg_cm, ...)

Convert a radiosity from erg.s-1.cm-2.sr-1/cm to erg.s-1.cm-2.sr-1/Hz at a given wavelength.

radiosity_erg_hz2radiosity_erg_cm(radiosity_erg_hz, ...)

Convert a radiosity from erg.s-1.cm-2.sr-1/Hz to erg.s-1.cm-2.sr-1/cm at a given frequency.

radiosity2irradiance(spectral_radiosity, ...)

Calculate the spectral irradiance of a spherical source on a target from its spectral radiosity.

petitRADTRANS.physics.doppler_shift(wavelength_0, velocity)

Calculate the Doppler-shifted wavelength for electromagnetic waves.

A negative velocity means that the source is going toward the observer. A positive velocity means the source is going away from the observer.

Args:

wavelength_0: (cm) wavelength of the wave in the referential of the source velocity: (cm.s-1) velocity of the source relative to the observer

Returns:
  1. the wavelength of the source as measured by the observer

petitRADTRANS.physics.guillot_global(P, kappa_IR, gamma, grav, T_int, T_equ)

Returns a temperature array, in units of K, of the same dimensions as the pressure P (in bar). For this the temperature model of Guillot (2010) is used (his Equation 29).

Args:
P:

numpy array of floats, containing the input pressure in bars.

kappa_IR (float):

The infrared opacity in units of \(\rm cm^2/s\).

gamma (float):

The ratio between the visual and infrated opacity.

grav (float):

The planetary surface gravity in units of \(\rm cm/s^2\).

T_int (float):

The planetary internal temperature (in units of K).

T_equ (float):

The planetary equilibrium temperature (in units of K).

petitRADTRANS.physics.guillot_global_ret(P, delta, gamma, T_int, T_equ)
petitRADTRANS.physics.guillot_metallic_temperature_profile(pressures, gamma, surface_gravity, intrinsic_temperature, equilibrium_temperature, kappa_ir_z0, metallicity=None)

Get a Guillot temperature profile depending on metallicity.

Args:

pressures: (bar) pressures of the profile gamma: ratio between visual and infrated opacity surface_gravity: (cm.s-2) surface gravity intrinsic_temperature: (K) intrinsic temperature equilibrium_temperature: (K) equilibrium temperature kappa_ir_z0: (cm2.s-1) infrared opacity metallicity: ratio of heavy elements abundance over H abundance with respect to the solar ratio

Returns:

temperatures: (K) the temperature at each pressures of the atmosphere

petitRADTRANS.physics.guillot_modif(P, delta, gamma, T_int, T_equ, ptrans, alpha)
petitRADTRANS.physics.hz2um(frequency)

Convert frequencies into wavelengths

Args:

frequency: (Hz) the frequency to convert

Returns:

(um) the corresponding wavelengths

petitRADTRANS.physics.isothermal(P, T)
petitRADTRANS.physics.running_mean(x, N)
petitRADTRANS.physics.make_press_temp(rad_trans_params)
petitRADTRANS.physics.make_press_temp_iso(rad_trans_params)
petitRADTRANS.physics.PT_ret_model(T3, delta, alpha, tint, press, FeH, CO, conv=True)

Self-luminous retrieval P-T model.

Args:
T3np.array([t1, t2, t3])

temperature points to be added on top radiative Eddington structure (above tau = 0.1). Use spline interpolation, t1 < t2 < t3 < tconnect as prior.

deltafloat

proportionality factor in tau = delta * press_cgs**alpha

alphafloat

power law index in tau = delta * press_cgs**alpha For the tau model: use proximity to kappa_rosseland photosphere as prior.

tintfloat

internal temperature of the Eddington model

pressnp.ndarray

input pressure profile in bar

convbool

enforce convective adiabat yes/no

COfloat

C/O for the nabla_ad interpolation

FeHfloat

metallicity for the nabla_ad interpolation

Returns:
Tretnp.ndarray

The temperature as a function of atmospheric pressure.

petitRADTRANS.physics.madhu_seager_2009(press, pressure_points, T_set, alpha_points, beta_points)

Calculate temperatures based on the Madhusudhan and Seager (2009) parameterization.

This function computes temperatures using the Madhu and Seager (2009) parameterization for a given set of pressure values, pressure breakpoints, temperature breakpoints, alpha values, and beta values.

Based off of the POSEIDON implementation: https://github.com/MartianColonist/POSEIDON/blob/main/POSEIDON/atmosphere.py

Parameters:
press(numpy.ndarray)

An array of pressure values (in bar) at which to calculate temperatures.

pressure_points(list)

A list of pressure breakpoints defining different temperature regimes.

T_set(float)

A temperature at pressure_points[4] used to constrain the temperature profile.

alpha_points(list)

A list of alpha values used in the parameterization for different regimes.

beta_points(list)

A list of beta values used in the parameterization for different regimes. By default b[0] == b[1] == 0.5, unclear how well this will work if these aren’t used!

Returns:
temperatures(numpy.ndarray)

An array of calculated temperatures (in K) corresponding to the input pressure values.

Note: - This function assumes that pressure_points, temperature_points, alpha_points, and beta_points

are lists with the same length, defining different pressure-temperature regimes. The function uses logarithmic relationships to calculate temperatures within these regimes.

Reference: - Madhusudhan, N., & Seager, S. (2009). A Temperature and Abundance Retrieval Method for Exoplanet Atmospheres.

The Astrophysical Journal, 707(1), 24-39. https://doi.org/10.1088/0004-637X/707/1/24

petitRADTRANS.physics.cubic_spline_profile(press, temperature_points, gamma, nnodes=0)

Compute a cubic spline profile for temperature based on pressure points.

This function computes a cubic spline profile for temperature using pressure and temperature data points, along with a curvature prior.

Args:

press (array-like): An array or list of pressure data points. temperature_points (array-like): An array or list of temperature data points. gamma (float): A parameter controlling the curvature of the spline. nnodes (int, optional): Number of nodes to use in the spline interpolation.

Defaults to 0, which means automatic determination of nodes.

Returns:
tuple: A tuple containing two elements:
  • interpolated_temps (array-like): Interpolated temperature values based on the cubic spline.

  • prior (array-like): Curvature prior values calculated for the spline.

petitRADTRANS.physics.linear_spline_profile(press, temperature_points, gamma, nnodes=0)

Compute a linear spline profile for temperature based on pressure points.

This function computes a linear spline profile for temperature using pressure and temperature data points, along with a curvature prior.

Args:

press (array-like): An array or list of pressure data points. temperature_points (array-like): An array or list of temperature data points. gamma (float): A parameter controlling the curvature of the spline. nnodes (int, optional): Number of nodes to use in the spline interpolation.

Defaults to 0, which means automatic determination of nodes.

Returns:
tuple: A tuple containing two elements:
  • interpolated_temps (array-like): Interpolated temperature values based on the linear spline.

  • prior (array-like): Curvature prior values calculated for the spline.

petitRADTRANS.physics.temperature_curvature_prior(press, temps, gamma)

Compute a curvature prior for a temperature-pressure profile.

This function calculates a curvature prior for a temperature-pressure profile, penalizing deviations from a smooth, low-curvature profile, based on Line 2015

Args:

press (array-like): An array or list of pressure data points. temps (array-like): An array or list of temperature data points. gamma (float): The curvature penalization factor.

Returns:

float: The curvature prior value.

petitRADTRANS.physics.dTdP_temperature_profile(press, num_layer, layer_pt_slopes, T_bottom)

This function takes the temperature gradient at a set number of spline points and interpolates a temperature profile as a function of pressure.

Args:
pressarray_like

The pressure array.

num_layerint

The number of layers.

layer_pt_slopesarray_like

The temperature gradient at the spline points.

T_bottomfloat

The temperature at the bottom of the atmosphere.

Returns:
temperaturesarray_like

The temperature profile.

petitRADTRANS.physics.radiosity_erg_cm2radiosity_erg_hz(radiosity_erg_cm, wavelength)

Convert a radiosity from erg.s-1.cm-2.sr-1/cm to erg.s-1.cm-2.sr-1/Hz at a given wavelength. Steps:

[cm] = c[cm.s-1] / [Hz] => d[cm]/d[Hz] = d(c / [Hz])/d[Hz] => d[cm]/d[Hz] = c / [Hz]**2 integral of flux must be conserved: radiosity_erg_cm * d[cm] = radiosity_erg_hz * d[Hz] radiosity_erg_hz = radiosity_erg_cm * d[cm]/d[Hz] => radiosity_erg_hz = radiosity_erg_cm * wavelength**2 / c

Args:

radiosity_erg_cm: (erg.s-1.cm-2.sr-1/cm) wavelength: (cm)

Returns:

(erg.s-1.cm-2.sr-1/cm) the radiosity in converted units

petitRADTRANS.physics.radiosity_erg_hz2radiosity_erg_cm(radiosity_erg_hz, frequency)

Convert a radiosity from erg.s-1.cm-2.sr-1/Hz to erg.s-1.cm-2.sr-1/cm at a given frequency.

Steps:

[cm] = c[cm.s-1] / [Hz] => d[cm]/d[Hz] = d(c / [Hz])/d[Hz] => d[cm]/d[Hz] = c / [Hz]**2 => d[Hz]/d[cm] = [Hz]**2 / c integral of flux must be conserved: radiosity_erg_cm * d[cm] = radiosity_erg_hz * d[Hz] radiosity_erg_cm = radiosity_erg_hz * d[Hz]/d[cm] => radiosity_erg_cm = radiosity_erg_hz * frequency**2 / c

Args:

radiosity_erg_hz: (erg.s-1.cm-2.sr-1/Hz) frequency: (Hz)

Returns:

(erg.s-1.cm-2.sr-1/cm) the radiosity in converted units

petitRADTRANS.physics.radiosity2irradiance(spectral_radiosity, source_radius, target_distance)

Calculate the spectral irradiance of a spherical source on a target from its spectral radiosity.

Args:

spectral_radiosity: (M.L-1.T-3) spectral radiosity of the source source_radius: (L) radius of the spherical source target_distance: (L) distance from the source to the target

Returns:

The irradiance of the source on the target (M.L-1.T-3).