petitRADTRANS.physics#

Stores useful physical functions.

Functions#

calculate_distance_from_luminosity(t_irr, dist, ...)

compute_effective_temperature(→ float)

Calculates the effective temperature by integrating the model and using the stefan boltzmann law.

doppler_shift(→ [jax.Array, float])

Calculate the Doppler-shifted wavelength for electromagnetic waves.

flux_cm2flux_hz(→ [jax.Array, float])

Convert a flux from [flux units]/cm to [flux units]/Hz at a given wavelength.

flux_hz2flux_cm(→ [jax.Array, float])

Convert a flux from [flux units]/Hz to [flux units]/cm at a given frequency.

flux2irradiance(→ [jax.Array, float])

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

frequency2wavelength(→ [jax.Array, float])

Convert frequencies into wavelength in centimeter.

hz2um(→ [jax.Array, float])

Convert frequencies into wavelengths in micrometer.

ism_extinction(av_mag, rv_red, wavelengths)

Function for calculating the optical and IR extinction

apply_ism_ext(wavelengths, flux, v_band_ext, v_band_red)

Function for applying ISM extinction to a spectrum.

planck_function_cm(→ [jax.Array, float])

Returns the Planck function \(B_{\lambda}(T)\) in units of

planck_function_hz(→ [jax.Array, float])

Returns the Planck function \(B_{\nu}(T)\) in units of

planck_function_hz_temperature_derivative(...)

Returns the derivative of the Planck function with respect to the temperature in units of

shift_wavelengths_by_radial_velocity(radial_velocity)

um2hz(→ [jax.Array, float])

Convert wavelengths in micrometer into frequencies.

wavelength2frequency(→ [jax.Array, float])

Convert wavelengths in centimeter to frequencies.

Module Contents#

petitRADTRANS.physics.calculate_distance_from_luminosity(t_irr, dist, t_star, r_star, mode, mode_what)#
petitRADTRANS.physics.compute_effective_temperature(wavelengths: jax.typing.ArrayLike, flux: jax.typing.ArrayLike, orbit_semi_major_axis: float = 1.0, planet_radius: float = 1.0, use_si_units: bool = False) float#

Calculates the effective temperature by integrating the model and using the stefan boltzmann law.

Args:
wavelengthsnumpy.ndarray

Wavelength grid

fluxnumpy.ndarray

Flux density grid

orbit_semi_major_axisOptional(float)

Distance to the object. Must have same units as planet_radius

planet_radiusOptional(float)

Object radius. Must have same units as orbit_semi_major_axis

use_si_unitsOptional(bool)

If the flux is in W/m2/micron, this should be true

petitRADTRANS.physics.doppler_shift(wavelength_0: [jax.typing.ArrayLike, float], velocity: [jax.typing.ArrayLike, float]) [jax.Array, float]#

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.flux_cm2flux_hz(flux_cm: [jax.typing.ArrayLike, float], wavelength: [jax.typing.ArrayLike, float]) [jax.Array, float]#

Convert a flux from [flux units]/cm to [flux units]/Hz at a given wavelength. Flux units can be, e.g., erg.s-1.cm-2.

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: flux_cm * d[cm] = flux_hz * d[Hz] flux_hz = flux_cm * d[cm]/d[Hz] => flux_hz = flux_cm * wavelength**2 / c

Args:

flux_cm: ([flux units]/cm) wavelength: (cm)

Returns:

([flux units]/Hz) the radiosity in converted units

petitRADTRANS.physics.flux_hz2flux_cm(flux_hz: [jax.typing.ArrayLike, float], frequency: [jax.typing.ArrayLike, float]) [jax.Array, float]#

Convert a flux from [flux units]/Hz to [flux units]/cm at a given frequency. Flux units can be, e.g., erg.s-1.cm-2.

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: flux_cm * d[cm] = flux_hz * d[Hz] flux_cm = flux_hz * d[Hz]/d[cm] => flux_cm = flux_hz * frequency**2 / c

Args:

flux_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.flux2irradiance(flux: [jax.typing.ArrayLike, float], source_radius: float, target_distance: float) [jax.Array, float]#

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

Args:

flux: (M.L-1.T-3) flux 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).

petitRADTRANS.physics.frequency2wavelength(frequency: [jax.typing.ArrayLike, float]) [jax.Array, float]#

Convert frequencies into wavelength in centimeter.

Args:

frequency: frequency: (Hz) the frequency to convert

Returns:
  1. the corresponding wavelengths

petitRADTRANS.physics.hz2um(frequency: [jax.typing.ArrayLike, float]) [jax.Array, float]#

Convert frequencies into wavelengths in micrometer.

Args:

frequency: (Hz) the frequency to convert

Returns:

(um) the corresponding wavelengths

petitRADTRANS.physics.ism_extinction(av_mag, rv_red, wavelengths)#

Function for calculating the optical and IR extinction with the empirical relation from Cardelli et al. (1989). Reimplemented from species.utils.dust_utils to avoid circular dependencies.

Parameters#

av_magfloat

Extinction (mag) in the $V$ band.

rv_redfloat

Reddening in the $V$ band, R_V = A_V / E(B-V).

wavelengthsnp.ndarray, list(float), float

Array or list with the wavelengths (um) for which the extinction is calculated. It is also possible to provide a single value as float.

Returns#

np.ndarray

Extinction (mag) at wavelengths.

petitRADTRANS.physics.apply_ism_ext(wavelengths, flux, v_band_ext, v_band_red)#

Function for applying ISM extinction to a spectrum. Reimplemented from species.utils.dust_utils to avoid circular dependencies.

wavelengthsjnp.ndarray

Wavelengths (um) of the spectrum.

fluxjnp.ndarray

Fluxes (W m-2 um-1) of the spectrum.

v_band_extfloat

Extinction (mag) in the $V$ band.

v_band_redfloat

Reddening in the $V$ band.

Returns#

jnp.ndarray

Fluxes (W m-2 um-1) with the extinction applied.

petitRADTRANS.physics.planck_function_cm(temperature: float, wavelength: [jax.typing.ArrayLike, float]) [jax.Array, float]#

Returns the Planck function \(B_{\lambda}(T)\) in units of \(\rm erg/s/cm^2/cm/steradian\).

Args:
temperature (float):

Temperature in K.

wavelength:

Array containing the wavelength in cm.

petitRADTRANS.physics.planck_function_hz(temperature: float, frequency: [jax.typing.ArrayLike, float]) [jax.Array, float]#

Returns the Planck function \(B_{\nu}(T)\) in units of \(\rm erg/s/cm^2/Hz/steradian\).

Args:
temperature (float):

Temperature in K.

frequency:

Array containing the frequency in Hz.

petitRADTRANS.physics.planck_function_hz_temperature_derivative(temperature: float, frequency: [jax.typing.ArrayLike, float]) [jax.Array, float]#

Returns the derivative of the Planck function with respect to the temperature in units of \(\rm erg/s/cm^2/Hz/steradian\).

Args:
temperature:

Temperature in K.

frequency:

Array containing the frequency in Hz.

Returns:

petitRADTRANS.physics.shift_wavelengths_by_radial_velocity(radial_velocity)#
petitRADTRANS.physics.um2hz(wavelength: [jax.typing.ArrayLike, float]) [jax.Array, float]#

Convert wavelengths in micrometer into frequencies.

Args:

wavelength: (um) the wavelengths to convert

Returns:

(Hz) the corresponding frequencies

petitRADTRANS.physics.wavelength2frequency(wavelength: [jax.typing.ArrayLike, float]) [jax.Array, float]#

Convert wavelengths in centimeter to frequencies.

Args:

wavelength: (cm) the wavelengths to convert

Returns:

(Hz) the converted frequencies