exojax.spec packageο
Submodulesο
exojax.spec.api moduleο
Molecular database API class using a common API w/ RADIS = (CAPI)
MdbExomol is the MDB for ExoMol
MdbHitran is the MDB for HITRAN
MdbHitemp is the MDB for HITEMP
MdbCommonHitempHitran is the common MDB for HITEMP and HITRAN
Notes
If you use vaex as radis engine, hdf5 files are saved while pytables uses .h5 files.
- class exojax.spec.api.MdbExomol(path, nurange=[- inf, inf], crit=0.0, elower_max=None, Ttyp=1000.0, bkgdatm='H2', broadf=True, broadf_download=True, gpu_transfer=True, inherit_dataframe=False, optional_quantum_states=False, activation=True, local_databases='./', engine=None)ο
Bases:
MdbExomol
molecular database of ExoMol form.
MdbExomol is a class for ExoMol database. It inherits the CAPI class MdbExomol and adds some additional features.
- simple_molecule_nameο
simple molecule name
- nurangeο
nu range [min,max] (cm-1)
- nu_linesο
line center (cm-1)
- Type:
nd array
- Sij0ο
line strength at T=Tref (cm)
- Type:
nd array
- logsij0ο
log line strength at T=Tref
- Type:
jnp array
- Aο
Einstein A coeeficient
- Type:
jnp array
- gamma_naturalο
gamma factor of the natural broadening
- Type:
DataFrame or jnp array
- elowerο
the lower state energy (cm-1)
- Type:
DataFrame or jnp array
- gppο
statistical weight
- Type:
DataFrame or jnp array
- jlowerο
J_lower
- Type:
DataFrame or jnp array
- jupperο
J_upper
- Type:
DataFrame or jnp array
- n_Texpο
temperature exponent
- Type:
DataFrame or jnp array
- dev_nu_linesο
line center in device (cm-1)
- Type:
jnp array
- alpha_refο
alpha_ref (gamma0), Lorentzian half-width at reference temperature and pressure in cm-1/bar
- Type:
jnp array
- n_Texp_defο
default temperature exponent in .def file, used for jlower not given in .broad
- alpha_ref_defο
default alpha_ref (gamma0) in .def file, used for jlower not given in .broad
- QT_interp(T)ο
interpolated partition function.
- Parameters:
T β temperature
- Returns:
Q(T) interpolated in jnp.array
- activate(df, mask=None)ο
Activates of moldb for Exomol, including making attributes, computing broadening parameters, natural width, and transfering attributes to gpu arrays when self.gpu_transfer = True
Notes
activation includes, making attributes, computing broadening parameters, natural width, and transfering attributes to gpu arrays when self.gpu_transfer = True
- Parameters:
df β DataFrame
mask β mask of DataFrame to be used for the activation, if None, no additional mask is applied.
Note
self.df_load_mask is always applied when the activation.
Examples
>>> # we would extract the line with delta nu = 2 here >>> mdb = api.MdbExomol(emf, nus, optional_quantum_states=True, activation=False) >>> load_mask = (mdb.df["v_u"] - mdb.df["v_l"] == 2) >>> mdb.activate(mdb.df, load_mask)
- apply_mask_mdb(mask)ο
Applys mask for mdb class for Exomol
- Parameters:
mask β mask to be applied
Examples
>>> mdb = api.MdbExomol(emf, nus) >>> # we would extract the lines with elower > 100. >>> mask = mdb.elower > 100. >>> mdb.apply_mask_mdb(mask)
- attributes_from_dataframes(df_masked)ο
Generates attributes from (usually masked) data frame for Exomol
- Parameters:
df_masked (DataFrame) β (masked) data frame
- Raises:
ValueError β _description_
- compute_load_mask(df)ο
- generate_jnp_arrays()ο
(re)generates jnp.arrays.
Note
We have nd arrays and jnp arrays. We usually apply the mask to nd arrays and then generate jnp array from the corresponding nd array. For instance, self._A is nd array and self.A is jnp array. logsij0 is computed assuming Tref=Tref_original because it is not used for PreMODIT.
- line_strength(T)ο
line strength at T
- Parameters:
T (float) β temperature
- Returns:
line strength at T
- Return type:
float
- qr_interp(T, Tref)ο
interpolated partition function ratio.
- Parameters:
T β temperature
Tref β reference temperature
- Returns:
qr(T)=Q(T)/Q(Tref) interpolated
- set_wavenum(nurange)ο
- class exojax.spec.api.MdbHitemp(molecule_path, nurange=[- inf, inf], crit=0.0, elower_max=None, Ttyp=1000.0, isotope=1, gpu_transfer=False, inherit_dataframe=False, activation=True, parfile=None, with_error=False, engine=None)ο
Bases:
MdbCommonHitempHitran
,HITEMPDatabaseManager
molecular database of HITEMP.
- simple_molecule_nameο
simple molecule name
- nurangeο
nu range [min,max] (cm-1)
- nu_linesο
line center (cm-1)
- Type:
nd array
- Sij0ο
line strength at T=Tref (cm)
- Type:
nd array
- dev_nu_linesο
line center in device (cm-1)
- Type:
jnp array
- logsij0ο
log line strength at T=Tref
- Type:
jnp array
- Aο
Einstein A coeeficient
- Type:
jnp array
- gamma_naturalο
gamma factor of the natural broadening
- Type:
jnp array
- gamma_airο
gamma factor of air pressure broadening
- Type:
jnp array
- gamma_selfο
gamma factor of self pressure broadening
- Type:
jnp array
- elowerο
the lower state energy (cm-1)
- Type:
jnp array
- gppο
statistical weight
- Type:
jnp array
- n_airο
air temperature exponent
- Type:
jnp array
- attributes_from_dataframes(df_masked)ο
generate attributes from (usually masked) data farame
- Parameters:
df_load_mask (DataFrame) β (masked) data frame
- generate_jnp_arrays()ο
(re)generate jnp.arrays.
Note
We have nd arrays and jnp arrays. We usually apply the mask to nd arrays and then generate jnp array from the corresponding nd array. For attributes, self._A is nd array and self.A is jnp array.
- class exojax.spec.api.MdbHitran(molecule_path, nurange=[- inf, inf], crit=0.0, elower_max=None, Ttyp=1000.0, isotope=0, gpu_transfer=False, inherit_dataframe=False, activation=True, parfile=None, nonair_broadening=False, with_error=False, engine=None)ο
Bases:
MdbCommonHitempHitran
,HITRANDatabaseManager
molecular database of HITRAN
- simple_molecule_nameο
simple molecule name
- nurangeο
nu range [min,max] (cm-1)
- nu_linesο
line center (cm-1)
- Type:
nd array
- Sij0ο
line strength at T=Tref (cm)
- Type:
nd array
- dev_nu_linesο
line center in device (cm-1)
- Type:
jnp array
- logsij0ο
log line strength at T=Tref
- Type:
jnp array
- Aο
Einstein A coeeficient
- Type:
jnp array
- gamma_naturalο
gamma factor of the natural broadening
- Type:
jnp array
- gamma_airο
gamma factor of air pressure broadening
- Type:
jnp array
- gamma_selfο
gamma factor of self pressure broadening
- Type:
jnp array
- elowerο
the lower state energy (cm-1)
- Type:
jnp array
- gppο
statistical weight
- Type:
jnp array
- n_airο
air temperature exponent
- Type:
jnp array
- attributes_from_dataframes(df_load_mask)ο
generate attributes from (usually masked) data farame
- Parameters:
df_load_mask (DataFrame) β (masked) data frame
- Raises:
ValueError β _description_
- generate_jnp_arrays()ο
(re)generate jnp.arrays.
Note
We have nd arrays and jnp arrays. We usually apply the mask to nd arrays and then generate jnp array from the corresponding nd array. For instance, self._A is nd array and self.A is jnp array.
exojax.spec.atmrt moduleο
Atmospheric Radiative Transfer (art) class
Notes
The opacity is computed in art because it uses planet physical quantities such as gravity, mmr. βrunβ method computes a spectrum.
- class exojax.spec.atmrt.ArtAbsPure(pressure_top=1e-08, pressure_btm=100.0, nlayer=100, nu_grid=None)ο
Bases:
ArtCommon
- run(dtau, pressure_surface, incoming_flux, mu_in, mu_out)ο
run radiative transfer
- Parameters:
dtau (2D array) β optical depth matrix, dtau (N_layer, N_nus)
pressure_surface β pressure at the surface (bar)
flux (incoming) β incoming flux (x reflectivity) (N_nus)
mu_in (float>0) β cosine of the viewing angle for incoming ray (>0.0)
mu_out (float>0 or None) β cosine of the viewing angle for outgoing ray, (>0.0) when mu_out is given (is not None), the observer is located at the top of the atmosphere if None, the observe is located at the ground.
Notes
We include the reflectivity by surface in βincoming fluxβ for the simplicity when the obserber is located at the top of atmosphere (mu_out is not None).
- Returns:
spectrum
- Return type:
1D array
- class exojax.spec.atmrt.ArtCommon(pressure_top, pressure_btm, nlayer, nu_grid=None)ο
Bases:
object
Common Atmospheric Radiative Transfer
- atmosphere_height(temperature, mean_molecular_weight, radius_btm, gravity_btm)ο
atmosphere height and radius
- Parameters:
temperature (1D array) β temparature profile (Nlayer)
mean_molecular_weight (float/1D array) β mean molecular weight profile (float/Nlayer)
radius_btm (float) β the bottom radius of the atmospheric layer
gravity_btm (float) β the bottom gravity cm2/s at radius_btm, i.e. G M_p/radius_btm
- Returns:
height normalized by radius_btm (Nlayer) 1D array: layer radius r_n normalized by radius_btm (Nlayer)
- Return type:
1D array
Notes
Our definitions of the radius_lower, radius_layer, and height are as follows: n=0,1,β¦,N-1 radius_lower[N-1] = radius_btm (i.e. R0) radius_lower[n-1] = radius_lower[n] + height[n] βnormalizedβ means physical length divided by radius_btm
- change_temperature_range(Tlow, Thigh)ο
temperature range to be assumed.
Note
The default temperature range is self.Tlow = 0 K, self.Thigh = jnp.inf.
- Parameters:
Tlow (float) β lower temperature
Thigh (float) β higher temperature
- check_pressure()ο
- clip_temperature(temperature)ο
temperature clipping
- Parameters:
temperature (array) β temperature profile
- Returns:
temperature profile clipped in the range of (self.Tlow-self.Thigh)
- Return type:
array
- constant_gravity_profile(value)ο
- constant_mmr_profile(value)ο
- constant_profile(value)ο
- custom_temperature(np_temperature)ο
custom temperature profile from numpy ndarray
Notes: this function is equivalen to jnp.array(np_temperature), but it is necessary for the compatibility.
- Parameters:
np_temperature (numpy nd array) β temperature profile
- Returns:
jnp.array temperature profile
- Return type:
array
- gravity_profile(temperature, mean_molecular_weight, radius_btm, gravity_btm)ο
gravity layer profile assuming hydrostatic equilibrium
- Parameters:
temperature (1D array) β temparature profile (Nlayer)
mean_molecular_weight (float/1D array) β mean molecular weight profile (float/Nlayer)
radius_btm (float) β the bottom radius of the atmospheric layer
gravity_btm (float) β the bottom gravity cm2/s at radius_btm, i.e. G M_p/radius_btm
- Returns:
gravity in cm2/s (Nlayer, 1), suitable for the input of opacity_profile_lines
- Return type:
2D array
- gray_temperature(gravity, kappa, Tint)ο
gray temperature profile
- Parameters:
gravity β gravity (cm/s2)
kappa β infrared opacity
Tint β temperature equivalence of the intrinsic energy flow in K
- Returns:
temperature profile
- Return type:
array
- guillot_temperature(gravity, kappa, gamma, Tint, Tirr)ο
Guillot tempearture profile
Notes
Set self.fguillot (default 0.25) to change the assumption of irradiation. self.fguillot = 1. at the substellar point, self.fguillot = 0.5 for a day-side average and self.fguillot = 0.25 for an averaging over the whole planetary surface See Guillot (2010) Equation (29) for details.
- Parameters:
gravity β gravity (cm/s2)
kappa β thermal/IR opacity (kappa_th in Guillot 2010)
gamma β ratio of optical and IR opacity (kappa_v/kappa_th), gamma > 1 means thermal inversion
Tint β temperature equivalence of the intrinsic energy flow in K
Tirr β temperature equivalence of the irradiation in K
- Returns:
temperature profile
- Return type:
array
- init_pressure_profile()ο
- opacity_profile_cia(logacia_matrix, temperature, vmr1, vmr2, mmw, gravity)ο
opacity profile (delta tau) from collision-induced absorption
- Parameters:
logacia_matrix (_type_) β _description_
temperature (_type_) β _description_
vmr1 (_type_) β _description_
vmr2 (_type_) β _description_
mmw (_type_) β _description_
gravity (_type_) β _description_
- Returns:
_description_
- Return type:
_type_
- opacity_profile_cloud_lognormal(extinction_coefficient, condensate_substance_density, mmr_condensate, rg, sigmag, gravity)ο
opacity profile (delta tau) from extinction coefficient assuming the AM cloud model with a lognormal cloud distribution :param extinction coefficient: extinction coefficient in cgs (cm-1) [N_layer, N_nus] :param condensate_substance_density: condensate substance density (g/cm3) :param mmr_condensate: Mass mixing ratio (array) of condensate [Nlayer] :param rg: rg parameter in the lognormal distribution of condensate size, defined by (9) in AM01 :param sigmag: sigmag parameter (geometric standard deviation) in the lognormal distribution of condensate size, defined by (9) in AM01, must be sigmag > 1 :param gravity: gravity (cm/s2)
- Returns:
optical depth matrix, dtau [N_layer, N_nus]
- Return type:
2D array
- opacity_profile_lines(xs, mixing_ratio, molmass, gravity)ο
- opacity_profile_xs(xs, mixing_ratio, molmass, gravity)ο
opacity profile (delta tau) from cross section matrix or vector, molecular line/Rayleigh scattering
- Parameters:
xs (2D array/1D array) β cross section matrix i.e. xsmatrix (Nlayer, N_wavenumber) or vector i.e. xsvector (N_wavenumber)
mixing_ratio (1D array) β mass mixing ratio, Nlayer, (or volume mixing ratio profile)
molmass (float) β molecular mass (or mean molecular weight)
gravity (float/1D profile) β constant or 1d profile of gravity in cgs
- Returns:
opacity profile, whose element is optical depth in each layer.
- Return type:
dtau
- powerlaw_temperature(T0, alpha)ο
powerlaw temperature profile
- Parameters:
T0 (float) β T at P=1 bar in K
alpha (float) β powerlaw index
- Returns:
temperature profile
- Return type:
array
- powerlaw_temperature_boundary(T0, alpha)ο
powerlaw temperature at the upper point (overline{T}) + TB profile
- Parameters:
T0 (float) β T at P=1 bar in K
alpha (float) β powerlaw index
- Returns:
layer boundary temperature profile (Nlayer + 1)
- Return type:
array
- class exojax.spec.atmrt.ArtEmisPure(pressure_top=1e-08, pressure_btm=100.0, nlayer=100, nu_grid=None, rtsolver='ibased', nstream=8)ο
Bases:
ArtCommon
Atmospheric RT for emission w/ pure absorption
Notes
The default radiative transfer scheme has been the intensity-based transfer since version 1.5
- pressure_layerο
pressure profile in bar
- run(dtau, temperature, nu_grid=None)ο
run radiative transfer
- Parameters:
dtau (2D array) β optical depth matrix, dtau (N_layer, N_nus)
temperature (1D array) β temperature profile (Nlayer)
nu_grid (1D array) β if nu_grid is not initialized, provide it.
- Returns:
emission spectrum
- Return type:
1D array
- set_capable_rtsolvers()ο
- validate_rtsolver(rtsolver, nstream)ο
validates rtsolver
- Parameters:
rtsolver (str) β rtsolver
nstream (int) β the number of streams
- class exojax.spec.atmrt.ArtEmisScat(pressure_top=1e-08, pressure_btm=100.0, nlayer=100, nu_grid=None, rtsolver='fluxadding_toon_hemispheric_mean')ο
Bases:
ArtCommon
Atmospheric RT for emission w/ scattering
- pressure_layerο
pressure profile in bar
- run(dtau, single_scattering_albedo, asymmetric_parameter, temperature, nu_grid=None, show=False)ο
run radiative transfer
- Parameters:
dtau (2D array) β optical depth matrix, dtau (N_layer, N_nus)
temperature (1D array) β temperature profile (Nlayer)
nu_grid (1D array) β if nu_grid is not initialized, provide it.
show β plot intermediate results
- Returns:
spectrum
- Return type:
1D array
- class exojax.spec.atmrt.ArtReflectEmis(pressure_top=1e-08, pressure_btm=100.0, nlayer=100, nu_grid=None, rtsolver='fluxadding_toon_hemispheric_mean')ο
Bases:
ArtCommon
Atmospheric RT for Reflected light with Source Term
- pressure_layerο
pressure profile in bar
- run(dtau, single_scattering_albedo, asymmetric_parameter, temperature, source_surface, reflectivity_surface, incoming_flux, nu_grid=None)ο
run radiative transfer
- Parameters:
dtau (2D array) β optical depth matrix, dtau (N_layer, N_nus)
single_scattering_albedo β single scattering albedo (Nlayer, N_nus)
asymmetric_parameter β assymetric parameter (Nlayer, N_nus)
temperature (1D array) β temperature profile (Nlayer)
source_surface β source from the surface (N_nus)
reflectivity_surface β reflectivity from the surface (N_nus)
flux (incoming) β incoming flux F_0^- (N_nus)
nu_grid (1D array) β if nu_grid is not initialized, provide it.
- Returns:
spectrum
- Return type:
1D array
- class exojax.spec.atmrt.ArtReflectPure(pressure_top=1e-08, pressure_btm=100.0, nlayer=100, nu_grid=None, rtsolver='fluxadding_toon_hemispheric_mean')ο
Bases:
ArtCommon
Atmospheric RT for Pure Reflected light (no source term)
- pressure_layerο
pressure profile in bar
- run(dtau, single_scattering_albedo, asymmetric_parameter, reflectivity_surface, incoming_flux)ο
run radiative transfer
- Parameters:
dtau (2D array) β optical depth matrix, dtau (N_layer, N_nus)
single_scattering_albedo β single scattering albedo (Nlayer, N_nus)
asymmetric_parameter β assymetric parameter (Nlayer, N_nus)
reflectivity_surface β reflectivity from the surface (N_nus)
flux (incoming) β incoming flux F_0^- (N_nus)
- Returns:
spectrum
- Return type:
1D array
- class exojax.spec.atmrt.ArtTransPure(pressure_top=1e-08, pressure_btm=100.0, nlayer=100, integration='simpson')ο
Bases:
ArtCommon
Atmospheric Radiative Transfer for transmission spectroscopy
- Parameters:
ArtCommon β ArtCommon class
- run(dtau, temperature, mean_molecular_weight, radius_btm, gravity_btm)ο
run radiative transfer
- Parameters:
dtau (2D array) β optical depth matrix, dtau (N_layer, N_nus)
temperature (1D array) β temperature profile (Nlayer)
mean_molecular_weight (1D array) β mean molecular weight profile, (Nlayer, from atmospheric top to bottom)
radius_btm (float) β radius (cm) at the lower boundary of the bottom layer, R0 or r_N
gravity_btm (float) β gravity (cm/s2) at the lower boundary of the bottom layer, g_N
- Returns:
transit squared radius normalized by radius_btm**2, i.e. it returns (radius/radius_btm)**2
- Return type:
1D array
Notes
This function gives the sqaure of the transit radius. If you would like to obtain the transit radius, take sqaure root of the output and multiply radius_btm. If you would like to compute the transit depth, divide the output by (stellar radius/radius_btm)**2
- set_capable_integration()ο
sets integration scheme directory
- set_integration_scheme(integration)ο
sets and validates integration
- Parameters:
integration (str) β integration scheme, i.e. βtrapezoidβ or βsimpsonβ
exojax.spec.atomll moduleο
- exojax.spec.atomll.Sij0(A, gupper, nu_lines, elower, QTref_284, QTmask, Irwin=False)ο
Reference Line Strength in Tref=296K, S0.
- Parameters:
A β Einstein coefficient (s-1)
gupper β the upper state statistical weight
nu_lines β line center wavenumber (cm-1)
elower β elower
QTref_284 β partition function Q(Tref)
QTmask β mask to identify a rows of QTref_284 to apply for each line
Irwin β if True(1), the partition functions of Irwin1981 is used, otherwise those of Barklem&Collet2016
- Returns:
Line strength (cm)
- Return type:
Sij(T)
- exojax.spec.atomll.gamma_KA3(T, PH, PHH, PHe, ielem, iion, nu_lines, elower, eupper, atomicmass, ionE, gamRad, gamSta, vdWdamp, enh_damp=1.0, Nelec=0.0)ο
HWHM of Lorentzian (cm-1) caluculated with the 3rd equation in p.4 of Kurucz&Avrett1981.
- Parameters:
T β temperature (K)
PH β hydrogen pressure (bar) #1 bar = 1e6 dyn/cm2
PHH β H2 molecule pressure (bar)
PHe β helium pressure (bar)
ielem β atomic number (e.g., Fe=26)
iion β ionized level (e.g., neutral=1, singly ionized=2, etc.)
nu_lines β transition waveNUMBER in [cm-1] (NOT frequency in [s-1])
elower β excitation potential (lower level) [cm-1]
eupper β excitation potential (upper level) [cm-1]
atomicmass β atomic mass [amu]
ionE β ionization potential [eV]
gamRad β log of gamma of radiation damping (s-1) #(https://www.astro.uu.se/valdwiki/Vald3Format)
gamSta β log of gamma of Stark damping ((s * Nelec)^-1)
vdWdamp β log of (van der Waals damping constant / neutral hydrogen number) (s-1)
enh_damp β empirical βenhancement factorβ for classical Unsoeldβs damping constant cf.) This coefficient (enh_damp) depends on each species in some codes such as Turbospectrum. #tako210917
Nelec β number density of electron
chi_lam (=h*nu=1.2398e4/wvl[AA]) β energy of a photon in the line (computed)
C6 β interaction constant (Eq.11.17 in Gray2005) (computed)
logg6 β log(gamma6) (Eq.11.29 in Gray2005) (computed)
gam6H β 17*v**(0.6)*C6**(0.4)*N (v:relative velocity, N:number density of neutral perturber) (computed)
Texp β temperature dependency (gamma6 sim T**((1-Ξ±)/2) ranging 0.3β0.4) (computed)
Returns: gamma: pressure gamma factor (cm-1)
Note: β/(4*np.pi*ccgs)β means: damping constant -> HWHM of Lorentzian in [cm^-1]
Reference of van der Waals damping constant (pressure/collision gamma):
Kurucz+1981: https://ui.adsabs.harvard.edu/abs/1981SAOSR.391β¦..K
Barklem+1998: https://ui.adsabs.harvard.edu/abs/1998MNRAS.300..863B
Barklem+2000: https://ui.adsabs.harvard.edu/abs/2000A&AS..142..467B
Gray+2005: https://ui.adsabs.harvard.edu/abs/2005oasp.bookβ¦..G
- exojax.spec.atomll.gamma_KA3s(T, PH, PHH, PHe, ielem, iion, nu_lines, elower, eupper, atomicmass, ionE, gamRad, gamSta, vdWdamp, enh_damp=1.0, Nelec=0.0)ο
(supplemetary:) HWHM of Lorentzian (cm-1) caluculated with the 3rd equation in p.4 of Kurucz&Avrett1981 but without discriminating iron group elements.
- Parameters:
T β temperature (K)
PH β hydrogen pressure (bar) #1 bar = 1e6 dyn/cm2
PHH β H2 molecule pressure (bar)
PHe β helium pressure (bar)
ielem β atomic number (e.g., Fe=26)
iion β ionized level (e.g., neutral=1, singly ionized=2, etc.)
nu_lines β transition waveNUMBER in [cm-1] (NOT frequency in [s-1])
elower β excitation potential (lower level) [cm-1]
eupper β excitation potential (upper level) [cm-1]
atomicmass β atomic mass [amu]
ionE β ionization potential [eV]
gamRad β log of gamma of radiation damping (s-1) #(https://www.astro.uu.se/valdwiki/Vald3Format)
gamSta β log of gamma of Stark damping ((s * Nelec)^-1)
vdWdamp β log of (van der Waals damping constant / neutral hydrogen number) (s-1)
enh_damp β empirical βenhancement factorβ for classical Unsoeldβs damping constant cf.) This coefficient (enh_damp) depends on each species in some codes such as Turbospectrum. #tako210917
Nelec β number density of electron
chi_lam (=h*nu=1.2398e4/wvl[AA]) β energy of a photon in the line (computed)
C6 β interaction constant (Eq.11.17 in Gray2005) (computed)
logg6 β log(gamma6) (Eq.11.29 in Gray2005) (computed)
gam6H β 17*v**(0.6)*C6**(0.4)*N (v:relative velocity, N:number density of neutral perturber) (computed)
Texp β temperature dependency (gamma6 sim T**((1-Ξ±)/2) ranging 0.3β0.4)(computed)
- Returns:
pressure gamma factor (cm-1)
- Return type:
gamma
Note
β/(4*np.pi*ccgs)β means: damping constant -> HWHM of Lorentzian in [cm^-1]
Reference of van der Waals damping constant (pressure/collision gamma):
Kurucz+1981: https://ui.adsabs.harvard.edu/abs/1981SAOSR.391β¦..K
Barklem+1998: https://ui.adsabs.harvard.edu/abs/1998MNRAS.300..863B
Barklem+2000: https://ui.adsabs.harvard.edu/abs/2000A&AS..142..467B
Gray+2005: https://ui.adsabs.harvard.edu/abs/2005oasp.bookβ¦..G
- exojax.spec.atomll.gamma_KA4(T, PH, PHH, PHe, ielem, iion, nu_lines, elower, eupper, atomicmass, ionE, gamRad, gamSta, vdWdamp, enh_damp=1.0, Nelec=0.0)ο
HWHM of Lorentzian (cm-1) caluculated with the 4rd equation in p.4 of Kurucz&Avrett1981.
- Parameters:
T β temperature (K)
PH β hydrogen pressure (bar) #1 bar = 1e6 dyn/cm2
PHH β H2 molecule pressure (bar)
PHe β helium pressure (bar)
ielem β atomic number (e.g., Fe=26)
iion β ionized level (e.g., neutral=1, singly ionized=2, etc.)
nu_lines β transition waveNUMBER in [cm-1] (NOT frequency in [s-1])
elower β excitation potential (lower level) [cm-1]
eupper β excitation potential (upper level) [cm-1]
atomicmass β atomic mass [amu]
ionE β ionization potential [eV]
gamRad β log of gamma of radiation damping (s-1) #(https://www.astro.uu.se/valdwiki/Vald3Format)
gamSta β log of gamma of Stark damping ((s * Nelec)^-1)
vdWdamp β log of (van der Waals damping constant / neutral hydrogen number) (s-1)
enh_damp β empirical βenhancement factorβ for classical Unsoeldβs damping constant #cf.) This coefficient (enh_damp) depends on each species in some codes such as Turbospectrum. #tako210917
Nelec β number density of electron
chi_lam (=h*nu=1.2398e4/wvl[AA]) β energy of a photon in the line (computed)
C6 β interaction constant (Eq.11.17 in Gray2005) (computed)
logg6 β log(gamma6) (Eq.11.29 in Gray2005) (computed)
gam6H β 17*v**(0.6)*C6**(0.4)*N (v:relative velocity, N:number density of neutral perturber) (computed)
Texp β temperature dependency (gamma6 sim T**((1-Ξ±)/2) ranging 0.3β0.4) (computed)
- Returns:
pressure gamma factor (cm-1)
- Return type:
gamma
Note
Approximation of case4 assume βthat the atomic weight A is much greater than 4, and that the mean-square-radius of the lower level <r^2>_lo is small compared to <r^2>_upβ.
β/(4*np.pi*ccgs)β means: damping constant -> HWHM of Lorentzian in [cm^-1]
Reference of van der Waals damping constant (pressure/collision gamma):
Kurucz+1981: https://ui.adsabs.harvard.edu/abs/1981SAOSR.391β¦..K
Barklem+1998: https://ui.adsabs.harvard.edu/abs/1998MNRAS.300..863B
Barklem+2000: https://ui.adsabs.harvard.edu/abs/2000A&AS..142..467B
Gray+2005: https://ui.adsabs.harvard.edu/abs/2005oasp.bookβ¦..G
- exojax.spec.atomll.gamma_uns(T, PH, PHH, PHe, ielem, iion, nu_lines, elower, eupper, atomicmass, ionE, gamRad, gamSta, vdWdamp, enh_damp=1.0, Nelec=0.0)ο
HWHM of Lorentzian (cm-1) estimated with the classical approximation by Unsoeld (1955)
- Parameters:
T β temperature (K)
PH β hydrogen pressure (bar) #1 bar = 1e6 dyn/cm2
PHH β H2 molecule pressure (bar)
PHe β helium pressure (bar)
ielem β atomic number (e.g., Fe=26)
iion β ionized level (e.g., neutral=1, singly ionized=2, etc.)
nu_lines β transition waveNUMBER in [cm-1] (NOT frequency in [s-1])
elower β excitation potential (lower level) [cm-1]
eupper β excitation potential (upper level) [cm-1]
atomicmass β atomic mass [amu]
ionE β ionization potential [eV]
gamRad β log of gamma of radiation damping (s-1) #(https://www.astro.uu.se/valdwiki/Vald3Format)
gamSta β log of gamma of Stark damping ((s * Nelec)^-1)
vdWdamp β log of (van der Waals damping constant / neutral hydrogen number) (s-1)
enh_damp β empirical βenhancement factorβ for classical Unsoeldβs damping constant cf.) This coefficient (enh_damp) depends on each species in some codes such as Turbospectrum. #tako210917
Nelec β number density of electron
chi_lam (=h*nu=1.2398e4/wvl[AA]) β energy of a photon in the line (computed)
C6 β interaction constant (Eq.11.17 in Gray2005) (computed)
logg6 β log(gamma6) (Eq.11.29 in Gray2005) (computed)
gam6H β 17*v**(0.6)*C6**(0.4)*N (v:relative velocity, N:number density of neutral perturber) (computed)
Texp β temperature dependency (gamma6 sim T**((1-Ξ±)/2) ranging 0.3β0.4)(computed)
- Returns:
pressure gamma factor (cm-1)
- Return type:
gamma
Note
β/(4*np.pi*ccgs)β means: damping constant -> HWHM of Lorentzian in [cm^-1]
Reference of van der Waals damping constant (pressure/collision gamma):
UnsΓΆld1955: https://ui.adsabs.harvard.edu/abs/1955psmb.bookβ¦..U
Kurucz+1981: https://ui.adsabs.harvard.edu/abs/1981SAOSR.391β¦..K
Barklem+1998: https://ui.adsabs.harvard.edu/abs/1998MNRAS.300..863B
Barklem+2000: https://ui.adsabs.harvard.edu/abs/2000A&AS..142..467B
Gray+2005: https://ui.adsabs.harvard.edu/abs/2005oasp.bookβ¦..G
- exojax.spec.atomll.gamma_vald3(T, PH, PHH, PHe, ielem, iion, nu_lines, elower, eupper, atomicmass, ionE, gamRad, gamSta, vdWdamp, enh_damp=1.0, Nelec=0.0)ο
HWHM of Lorentzian (cm-1) caluculated as gamma/(4*pi*c) [cm-1] for lines with the van der Waals gamma in the line list (VALD or Kurucz), otherwise estimated according to the Unsoeld (1955)
- Parameters:
T β temperature (K)
PH β hydrogen pressure (bar) #1 bar = 1e6 dyn/cm2
PHH β H2 molecule pressure (bar)
PHe β helium pressure (bar)
ielem β atomic number (e.g., Fe=26)
iion β ionized level (e.g., neutral=1, singly ionized=2, etc.)
nu_lines β transition waveNUMBER in [cm-1] (NOT frequency in [s-1])
elower β excitation potential (lower level) [cm-1]
eupper β excitation potential (upper level) [cm-1]
atomicmass β atomic mass [amu]
ionE β ionization potential [eV]
gamRad β log of gamma of radiation damping (s-1) (https://www.astro.uu.se/valdwiki/Vald3Format)
gamSta β log of gamma of Stark damping ((s * Nelec)^-1)
vdWdamp β log of (van der Waals damping constant / neutral hydrogen number) (s-1)
enh_damp β empirical βenhancement factorβ for classical Unsoeldβs damping constant cf.) This coefficient (enh_damp) depends on each species in some codes such as Turbospectrum. #tako210917
Nelec β number density of electron
chi_lam (=h*nu=1.2398e4/wvl[AA]) β energy of a photon in the line (computed)
C6 β interaction constant (Eq.11.17 in Gray2005) (computed)
logg6 β log(gamma6) (Eq.11.29 in Gray2005) (computed)
gam6H β 17*v**(0.6)*C6**(0.4)*N (computed) (v:relative velocity, N:number density of neutral perturber)
Texp β temperature dependency (gamma6 sim T**((1-Ξ±)/2) ranging 0.3β0.4) (computed)
- Returns:
pressure gamma factor (cm-1)
- Return type:
gamma
Note
β/(4*np.pi*ccgs)β means: damping constant -> HWHM of Lorentzian in [cm^-1]
Reference of van der Waals damping constant (pressure/collision gamma):
UnsΓΆld1955: https://ui.adsabs.harvard.edu/abs/1955psmb.bookβ¦..U
Kurucz+1981: https://ui.adsabs.harvard.edu/abs/1981SAOSR.391β¦..K
Barklem+1998: https://ui.adsabs.harvard.edu/abs/1998MNRAS.300..863B
Barklem+2000: https://ui.adsabs.harvard.edu/abs/2000A&AS..142..467B
Gray+2005: https://ui.adsabs.harvard.edu/abs/2005oasp.bookβ¦..G
- exojax.spec.atomll.get_VMR_uspecies(uspecies, mods_ID=Array([[0, 0]], dtype=int32), mods=Array([0], dtype=int32))ο
Extract VMR arrays of the species that contribute the opacity (βuspeciesβ made with βget_unique_speciesβ)
- Parameters:
uspecies β jnp.array of unique list of the species contributing the opacity [N_species x 2(ielem and iion)]
mods_ID β jnp.array listing the species whose abundances are different from the solar [N_modified_species x 2(ielem and iion)]
mods β jnp.array of each abundance deviation from the Sun [dex] for each modified species listed in mods_ID [N_modified_species]
- Returns:
jnp.array of volume mixing ratio [N_species]
- Return type:
VMR_uspecies
- exojax.spec.atomll.get_VMR_uspecies_FC(FCSpIndex_uspecies, mixing_ratios)ο
By using FastChem, extract volume mixing ratio (VMR) of the species that contribute the opacity (βuspeciesβ made with βget_unique_speciesβ)
- Parameters:
FCSpIndex_uspecies β SpeciesIndex in FastChem for each species of interest [N_species]
mixing_ratios β volume mixing ratios of all available gases calculated using fastchem2_call.run_fastchem [N_layer x N_species]
- Returns:
VMR of each species in each atmospheric layer [N_species x N_layer]
- Return type:
VMR_uspecies
- exojax.spec.atomll.get_unique_species(adb)ο
Extract a unique list of line contributing species from VALD atomic database (adb)
- Parameters:
adb β adb instance made by the AdbVald class in moldb.py
- Returns:
unique elements of the combination of ielem and iion (jnp.array with a shape of N_UniqueSpecies x 2(ielem and iion))
- Return type:
uspecies
- exojax.spec.atomll.ielemion_to_FastChemSymbol(ielem, iion)ο
Translate atomic number and ionization level into SpeciesSymbol in FastChem.
- Parameters:
ielem β atomic number (int) (e.g., Fe=26)
iion β ionized level (int) (e.g., neutral=1, singly)
- Returns:
//github.com/exoclime/FastChem/blob/master/input/logK_ext.dat)
- Return type:
SpeciesSymbol in FastChem (str) (cf. https
- exojax.spec.atomll.interp_QT_284(T, T_gQT, gQT_284species)ο
interpolated partition function of all 284 species.
- Parameters:
T β temperature
T_gQT β temperature in the grid obtained from the adb instance [N_grid(42)]
gQT_284species β partition function in the grid from the adb instance [N_species(284) x N_grid(42)]
- Returns:
interpolated partition function at T Q(T) for all 284 Atomic Species [284]
- Return type:
QT_284
- exojax.spec.atomll.padding_2Darray_for_each_atom(orig_arr, adb, sp)ο
Extract only data of the species of interest from 2D-array and pad with zeros to adjust the length.
- Parameters:
orig_arr β array [N_any (e.g., N_nu or N_layer), N_line] Note that if your ARRAY is 1D, it must be broadcasted with ARRAY[None,:], and the output must be also reshaped with OUTPUTARRAY.reshape(ARRAY.shape)
adb β adb instance made by the AdbVald class in moldb.py
sp β array of [ielem, iion]
- Returns:
padded_valid_arr
- exojax.spec.atomll.sep_arr_of_sp(arr, adb, trans_jnp=True, inttype=False)ο
Separate by species (atoms or ions) the jnp.array stored as an instance variable in adb, and pad with zeros to adjust the length
- Parameters:
arr β array of a parameter (one of the attributes of adb below) to be separated [N_line]
adb β adb instance made by the AdbVald class in moldb.py
trans_jnp β if True, the output is converted to jnp.array (dtype=βfloat32β)
inttype β if True (along with trans_jnp = True), the output is converted to jnp.array of dtype=βint32β
- Returns:
species-separated array [N_species x N_line_max]
- Return type:
arr_stacksp
- exojax.spec.atomll.uspecies_info(uspecies, ielem_to_index_of_ipccd, mods_ID=Array([[0, 0]], dtype=int32), mods=Array([0], dtype=int32), mods_id_trans=Array([], shape=(0,), dtype=float32))ο
Provide arrays of information of the species that contribute the opacity (βuspeciesβ made with βget_unique_speciesβ)
- Parameters:
uspecies β jnp.array of unique list of the species contributing the opacity
ielem_to_index_of_ipccd β jnp.array for conversion from ielem to the index of ipccd
mods_ID β jnp.array listing the species whose abundances are different from the solar
mods β jnp.array of each abundance deviation from the Sun [dex] for each modified species in mods_ID
mods_id_trans β jnp.array for converting index in βmods_IDβ of each species into index in uspecies
- Returns:
jnp.array of mass mixing ratio in the Sun of each species in βuspeciesβ atomicmass_uspecies_list: jnp.array of atomic mass [amu] of each species in βuspeciesβ mods_uspecies_list: jnp.array of abundance deviation from the Sun [dex] for each species in βuspeciesβ
- Return type:
MMR_uspecies_list
exojax.spec.atomllapi moduleο
API for VALD 3.
- exojax.spec.atomllapi.air_to_vac(wlair)ο
Convert wavelengths [AA] in air into those in vacuum.
- Parameters:
wlair β wavelengthe in air [Angstrom]
n β Refractive Index in dry air at 1 atm pressure and 15ΒΊC with 0.045% CO2 by volume (Birch and Downs, 1994, Metrologia, 31, 315)
- Returns:
wavelength in vacuum [Angstrom]
- Return type:
wlvac
- exojax.spec.atomllapi.load_atomicdata()ο
load atomic data and solar composition.
See Asplund et al. 2009, Gerevesse et al. 1996
- Returns:
table of atomic data
- Return type:
ipccd (pd.DataFrame)
Note
atomic.txt is in data/atom
- exojax.spec.atomllapi.load_ionization_energies()ο
Load atomic ionization energies.
- Returns:
table of ionization energies
- Return type:
df_ionE (pd.DataFrame)
Note
NIST_Atomic_Ionization_Energies.txt is in data/atom
- exojax.spec.atomllapi.load_pf_Barklem2016()ο
load a table of the partition functions for 284 atomic species.
See Table 8 of Barklem & Collet (2016); https://doi.org/10.1051/0004-6361/201526961
- Returns:
steps of temperature (K) pfdat (pd.DataFrame): partition functions for 284 atomic species
- Return type:
pfTdat (pd.DataFrame)
- exojax.spec.atomllapi.make_ielem_to_index_of_ipccd()ο
index conversion for atomll.uspecies_info (Preparation for LPF)
- Returns:
jnp.array to convert ielem into index of ipccd
- Return type:
ielem_to_index_of_ipccd
- exojax.spec.atomllapi.partfn_Fe(T)ο
Partition function of Fe I from Irwin_1981.
- Parameters:
T β temperature
- Returns:
partition function Q
- exojax.spec.atomllapi.pick_ionE(ielem, iion, df_ionE)ο
Pick up ionization energy of a specific atomic species.
- Parameters:
ielem (int) β atomic number (e.g., Fe=26)
iion (int) β ionized level (e.g., neutral=1, singly ionized=2, etc.)
df_ionE (pd.DataFrame) β table of ionization energies
- Returns:
ionization energy
- Return type:
ionE (float)
Note
NIST_Atomic_Ionization_Energies.txt is in data/atom
- exojax.spec.atomllapi.pickup_param(ExAll)ο
extract transition parameters from VALD3 line list and insert the same DataFrame.
- Parameters:
ExAll β VALD3 line list as pandas DataFrame (Output of read_ExAll)
- Returns:
Einstein coefficient in [s-1] nu_lines: transition waveNUMBER in [cm-1] (#NOT frequency in [s-1]) elower: lower excitation potential [cm-1] (#converted from eV) eupper: upper excitation potential [cm-1] (#converted from eV) gupper: upper statistical weight jlower: lower J (rotational quantum number, total angular momentum) jupper: upper J ielem: atomic number (e.g., Fe=26) iion: ionized level (e.g., neutral=1, singly) gamRad: log of gamma of radiation damping (s-1) #(https://www.astro.uu.se/valdwiki/Vald3Format) gamSta: log of gamma of Stark damping (s-1) vdWdamp: log of (van der Waals damping constant / neutral hydrogen number) (s-1)
- Return type:
A
- exojax.spec.atomllapi.read_ExAll(allf, engine='vaex')ο
IO for linelists downloaded from VALD3 with a query of βLong formatβ in the format of βExtract Allβ or βExtract Elementβ.
Note
About input linelists obtained from VALD3 (http://vald.astro.uu.se/). VALD data access is free but requires registration through the Contact form (http://vald.astro.uu.se/~vald/php/vald.php?docpage=contact.html). After the registration, you can login and choose the βExtract Elementβ mode. For example, if you want the Fe I linelist, the request form should be filled as
>>> Starting wavelength : 1500 >>> Ending wavelength : 100000 >>> Element [ + ionization ] : Fe 1 >>> Extraction format : Long format >>> Retrieve data via : FTP >>> Linelist configuration : Default >>> Unit selection: Energy unit: eV - Medium: vacuum - Wavelength unit: angstrom - VdW syntax: default
Please assign the fullpath of the output file sent by VALD ([user_name_at_VALD].[request_number_at_VALD].gz) to the variable βallfβ. See https://www.astro.uu.se/valdwiki/presformat_output for the detail of the format.
- Parameters:
allf β fullpath to the input VALD linelist (See Notes above for more details.)
Ion (Elm) β
WL_vac (AA) β
gf* (log) β
E_low (eV) β lower excitation potential
lo (J) β lower rotational quantum number
E_up (eV) β upper excitation potential
up (J) β upper rotational quantum number
lower (Lande) β
upper (Lande) β
mean (Lande) β
Rad. (Damping) β
Stark (Damping) β
Waals (Damping) β
engine β βvaexβ or βpytablesβ (default: βvaexβ)
- Returns:
line data in vaex/pytables DataFrame
- exojax.spec.atomllapi.read_kurucz(kuruczf)ο
Input Kurucz line list (http://kurucz.harvard.edu/linelists/)
- Parameters:
kuruczf β file path
- Returns:
Einstein coefficient in [s-1] nu_lines: transition waveNUMBER in [cm-1] (#NOT frequency in [s-1]) elower: lower excitation potential [cm-1] (#converted from eV) eupper: upper excitation potential [cm-1] (#converted from eV) gupper: upper statistical weight jlower: lower J (rotational quantum number, total angular momentum) jupper: upper J ielem: atomic number (e.g., Fe=26) iion: ionized level (e.g., neutral=1, singly) gamRad: log of gamma of radiation damping (s-1) #(https://www.astro.uu.se/valdwiki/Vald3Format) gamSta: log of gamma of Stark damping (s-1) gamvdW: log of (van der Waals damping constant / neutral hydrogen number) (s-1)
- Return type:
A
- exojax.spec.atomllapi.vac_to_air(wlvac)ο
Convert wavelengths [AA] in vacuum into those in air.
- Parameters:
wlvac β wavelength in vacuum [Angstrom]
n β Refractive Index in dry air at 1 atm pressure and 15ΒΊC with 0.045% CO2 by volume (Birch and Downs, 1994, Metrologia, 31, 315)
- Returns:
wavelengthe in air [Angstrom]
- Return type:
wlair
exojax.spec.contdb moduleο
Continuum database (CDB) class.
CdbCIA is the CDB for CIA
exojax.spec.customapi moduleο
- exojax.spec.customapi.Einstein_coeff_from_line_strength(nu_lines, Sij, elower, g, Q, T)ο
Einstein coefficient from line strength
- Parameters:
nu_lines (float) β line center wavenumber (cm-1)
Sij (float) β line strength (cm)
elower (float) β elower
g (float) β upper state statistical weight
Q (float) β partition function
T (float) β temperature
- Returns:
Einstein coefficient (s-1)
- class exojax.spec.customapi.MdbHargreaves(path, nurange=[- inf, inf], QTref_original=215.3488, QTref_raw=11691.1386, scale_intensity=0.3333333333333333, engine=None, verbose=True, download=False, cache=True)ο
Bases:
HargreavesDatabaseManager
molecular database of Hargreaves et al. (2010) in ExoMol form.
- pathο
Path to the local database file
- Type:
str
- databaseο
Name of the database
- Type:
str
- exact_molecule_nameο
Exact name of the molecule
- Type:
str
- simple_molecule_nameο
Simple name of the molecule
- Type:
str
- engineο
Computational engine to use
- Type:
str
- QTref_originalο
Original partition function at reference temperature
- Type:
float
- QTref_rawο
Raw partition function at reference temperature
- Type:
float
- dfο
Dataframe containing the converted data
- Type:
pd.DataFrame
- activate_with_exomol(mdb_exomol, extend=True)ο
Activate the Hargreaves database with an existing ExoMol database. :param mdb_exomol: An existing ExoMol database to extend :type mdb_exomol: MdbExomol :param extend: If True, extend the existing database with Hargreaves data :type extend: bool
- Returns:
A new ExoMol database with Hargreaves data activated
- Return type:
- convert_to_exomol(df_raw)ο
Convert the raw (original) dataframe to ExoMol format.
- exojax.spec.customapi.set_wavenum(nurange)ο
Set the wavenumber range for the database.
- Parameters:
nurange (list) β Wavenumber range for the database
- Returns:
Minimum and maximum wavenumber
- Return type:
tuple
exojax.spec.dbmanager moduleο
- class exojax.spec.dbmanager.CustomDatabaseManager(name, molecule, local_databases, url, engine='default', verbose=True, parallel=True)ο
Bases:
DatabaseManager
common base class for custom database managers
- download(urlname)ο
download the data file from the given URL
- Parameters:
urlname (str) β URL of the data file
- Returns:
Response object containing the downloaded data
- Return type:
response (requests.Response)
- fetch_urlnames()ο
fetch the URL names of the data files
- Returns:
List of URL names
- Return type:
list
- class exojax.spec.dbmanager.HargreavesDatabaseManager(name, molecule, local_databases, url, engine='default', verbose=True, parallel=True)ο
Bases:
CustomDatabaseManager
database manager for the line list of the transition of FeH (Hargreaves et al., 2010)
- parse_to_local_file(urlname, local_file)ο
download and parse the data file to a local file
- Parameters:
urlname (str) β URL of the data file
local_file (str) β Local file path to save the data
- Returns:
Number of lines in the downloaded data
- Return type:
int
exojax.spec.dit moduleο
Line profile computation using Discrete Integral Transform.
Line profile computation of Discrete Integral Transform for rapid spectral synthesis, originally proposed by D.C.M van den Bekerom and E.Pannier.
This module consists of selected functions in addit package.
The concept of βfoldingβ can be understood by reading the discussion by D.C.M van den Bekerom.
- exojax.spec.dit.dgmatrix(x, dit_grid_resolution=0.1, adopt=True)ο
DIT GRID MATRIX (alias)
- Parameters:
x β simgaD or gammaL matrix (Nlayer x Nline)
dit_grid_resolution β grid resolution. dit_grid_resolution=0.1 (defaut) means a grid point per digit
adopt β if True, min, max grid points are used at min and max values of x. In this case, the grid width does not need to be dit_grid_resolution exactly.
- Returns:
grid for DIT (Nlayer x NDITgrid)
- exojax.spec.dit.ditgrid(x, dit_grid_resolution=0.1, adopt=True)ο
DIT GRID (deplicated).
- Parameters:
x β simgaD or gammaL array (Nline)
dit_grid_resolution β grid resolution. res=0.1 (defaut) means a grid point per digit
adopt β if True, min, max grid points are used at min and max values of x. In this case, the grid width does not need to be res exactly.
- Returns:
grid for DIT
- exojax.spec.dit.dtauM_vald(dParr, g, adb, nus, cnu, indexnu, pmarray, SijM, gammaLM, sigmaDM, uspecies, mods_uspecies_list, MMR_uspecies_list, atomicmass_uspecies_list, dgm_sigmaD, dgm_gammaL)ο
Compute dtau caused by VALD lines from cross section xs (DIT)
- Parameters:
dParr β delta pressure profile (bar) [N_layer]
g β gravity (cm/s^2)
adb β adb instance made by the AdbVald class in moldb.py
nus β wavenumber matrix (cm-1) [N_nus]
cnu β cont (contribution) jnp.array [N_line]
indexnu β index (index) jnp.array [N_line]
pmarray β (+1,-1) array [len(nu_grid)+1,]
SijM β line intensity matrix [N_layer x N_line]
gammaLM β gammaL matrix [N_layer x N_line]
sigmaDM β sigmaD matrix [N_layer x N_line]
uspecies β unique elements of the combination of ielem and iion [N_UniqueSpecies x 2(ielem and iion)]
mods_uspecies_list β jnp.array of abundance deviation from the Sun [dex] for each species in βuspeciesβ [N_UniqueSpecies]
MMR_uspecies_list β jnp.array of mass mixing ratio in the Sun of each species in βuspeciesβ [N_UniqueSpecies]
atomicmass_uspecies_list β jnp.array of atomic mass [amu] of each species in βuspeciesβ [N_UniqueSpecies]
- Returns:
optical depth matrix [N_layer, N_nus]
- Return type:
dtauatom
- exojax.spec.dit.sigma_voigt(dgm_sigmaD, dgm_gammaL)ο
compute sigma of the Voigt profile.
- Parameters:
dgm_sigmaD β DIT grid matrix for sigmaD
dgm_gammaL β DIT grid matrix for gammaL
- Returns:
sigma
- exojax.spec.dit.vald(adb, Tarr, PH, PHe, PHH)ο
(alias of lpf.vald)
- Parameters:
adb β adb instance made by the AdbVald class in moldb.py
Tarr β Temperature array
PH β Partial pressure array of neutral hydrogen (H)
PHe β Partial pressure array of neutral helium (He)
PHH β Partial pressure array of molecular hydrogen (H2)
- Returns:
line intensity matrix gammaLM: gammaL matrix sigmaDM: sigmaD matrix
- Return type:
SijM
- exojax.spec.dit.xsmatrix(cnu, indexnu, pmarray, sigmaDM, gammaLM, SijM, nu_grid, dgm_sigmaD, dgm_gammaL)ο
Cross section matrix (DIT/2D+ version)
- Parameters:
cnu β contribution by npgetix for wavenumber
indexnu β index by npgetix for wavenumber
pmarray β (+1,-1) array whose length of len(nu_grid)+1
sigmaDM β doppler sigma matrix in R^(Nlayer x Nline)
gammaLM β gamma factor matrix in R^(Nlayer x Nline)
SijM β line strength matrix in R^(Nlayer x Nline)
nu_grid β linear wavenumber grid
dgm_sigmaD β DIT Grid Matrix for sigmaD R^(Nlayer, NDITgrid)
dgm_gammaL β DIT Grid Matrix for gammaL R^(Nlayer, NDITgrid)
- Returns:
cross section matrix in R^(Nlayer x Nwav)
Warning
This function have not been well tested.
- exojax.spec.dit.xsvector(cnu, indexnu, pmarray, sigmaD, gammaL, S, nu_grid, sigmaD_grid, gammaL_grid)ο
Cross section vector (DIT/2D+ version; default)
The original code is rundit in [addit package](https://github.com/HajimeKawahara/addit)
- Parameters:
cnu β contribution by npgetix for wavenumber
indexnu β index by npgetix for wavenumber
pmarray β (+1,-1) array whose length of len(nu_grid)+1
sigmaD β Gaussian STD (Nlines)
gammaL β Lorentzian half width (Nlines)
S β line strength (Nlines)
nu_grid β linear wavenumber grid
sigmaD_grid β sigmaD grid
gammaL_grid β gammaL grid
- Returns:
Cross section in the linear nu grid
Note
This function uses the precomputed neibouring contribution function for wavenumber (nu_ncf). Use npnc1D to compute nu_ncf in float64 precision.
exojax.spec.ditkernel moduleο
Kernels for Discrete Integral Transform.
Fourier kernels for the Voigt are given in this module
For coarsed wavenumber grids, folded one is needed to avoid negative values, See discussion by Dirk van den Bekerom at https://github.com/radis/radis/issues/186#issuecomment-764465580 for details.
- exojax.spec.ditkernel.fold_voigt_kernel(k, beta, gammaL, vmax, pmarray)ο
Fourier Kernel of the Voigt Profile.
- Parameters:
k β conjugated of wavenumber
beta β Gaussian standard deviation
gammaL β Lorentian Half Width
vmax β Nnu x dq
pmarray β (+1,-1) array whose length of len(nu_grid)+1
- Returns:
kernel (N_x,N_beta,N_gammaL)
Note
Conversions to the (full) width, wG and wL are as follows: wG=2*sqrt(2*ln2) beta wL=2*gamma
- exojax.spec.ditkernel.fold_voigt_kernel_logst(k, beta, log_ngammaL, vmax, pmarray)ο
Folded Fourier Kernel of the Voigt Profile for a common normalized beta. See https://github.com/dcmvdbekerom/discrete-integral- transform/blob/master/demo/discrete_integral_transform_log.py for the alias correction.
- Parameters:
k β conjugate wavenumber
beta β normalized Gaussian standard deviation (scalar, not log)
log_ngammaL β log normalized Lorentian Half Width (Nlines)
vmax β vmax
pmarray β (+1,-1) array whose length of len(nu_grid)+1
- Returns:
kernel (N_x,N_gammaL)
Note
Conversions to the (full) width, wG and wL are as follows: wG=2*sqrt(2*ln2) beta wL=2*gamma
- exojax.spec.ditkernel.voigt_kernel(k, beta, gammaL)ο
Fourier Kernel of the Voigt Profile.
- Parameters:
k β conjugated of wavenumber
beta β Gaussian standard deviation
gammaL β Lorentzian Half Width
- Returns:
kernel (N_x,N_beta,N_gammaL)
Note
Conversions to the (full) width, wG and wL are as follows: wG=2*sqrt(2*ln2) beta wL=2*gamma
- exojax.spec.ditkernel.voigt_kernel_logst(k, beta, log_ngammaL)ο
Fourier Kernel of the Voigt Profile for a common normalized beta.
- Parameters:
k β conjugate wavenumber
beta β normalized Gaussian standard deviation (scalar)
log_ngammaL β log normalized Lorentian Half Width (Nlines)
- Returns:
kernel (N_x,N_gammaL)
Note
Conversions to the (full) width, wG and wL are as follows: wG=2*sqrt(2*ln2) beta wL=2*gamma
exojax.spec.dtau_mmwl moduleο
compute dtau (opacity difference in atmospheric layers) using mean molecular weight
- exojax.spec.dtau_mmwl.dtauCIA_mmwl(nus, Tarr, Parr, dParr, vmr1, vmr2, mmw, g, nucia, tcia, logac)ο
- dtau of the CIA continuum.
(for the case where mmw is given for each atmospheric layer)
- Parameters:
nus β wavenumber matrix (cm-1)
Tarr β temperature array (K)
Parr β temperature array (bar)
dParr β delta temperature array (bar)
vmr1 β volume mixing ratio (VMR) for molecules 1 [N_layer]
vmr2 β volume mixing ratio (VMR) for molecules 2 [N_layer]
mmw β mean molecular weight of atmosphere [N_layer]
g β gravity (cm2/s)
nucia β wavenumber array for CIA
tcia β temperature array for CIA
logac β log10(absorption coefficient of CIA)
- Returns:
optical depth matrix [N_layer, N_nus]
- exojax.spec.dtau_mmwl.dtauHminus_mmwl(nus, Tarr, Parr, dParr, vmre, vmrh, mmw, g)ο
- dtau of the H- continuum.
(for the case where mmw is given for each atmospheric layer)
- Parameters:
nus β wavenumber matrix (cm-1)
Tarr β temperature array (K)
Parr β temperature array (bar)
dParr β delta temperature array (bar)
vmre β volume mixing ratio (VMR) for e- [N_layer]
vmrH β volume mixing ratio (VMR) for H atoms [N_layer]
mmw β mean molecular weight of atmosphere [N_layer]
g β gravity (cm2/s)
- Returns:
optical depth matrix [N_layer, N_nus]
- exojax.spec.dtau_mmwl.dtauM_mmwl(dParr, xsm, MR, mass, g)ο
- dtau of the molecular cross section.
(for the case where mmw is given for each atmospheric layer)
Note
opfac=bar_cgs/(m_u (g)). m_u: atomic mass unit. It can be obtained by fac=1.e3/m_u, where m_u = scipy.constants.m_u.
- Parameters:
dParr β delta pressure profile (bar) [N_layer]
xsm β cross section matrix (cm2) [N_layer, N_nus]
MR β volume mixing ratio (VMR) or mass mixing ratio (MMR) [N_layer]
mass β mean molecular weight for VMR or molecular mass for MMR [N_layer]
g β gravity (cm/s2)
- Returns:
optical depth matrix [N_layer, N_nus]
exojax.spec.exomol moduleο
- exojax.spec.exomol.gamma_exomol(P, T, n_air, alpha_ref)ο
gamma factor by a pressure broadening.
- Parameters:
P β pressure (bar)
T β temperature (K)
n_air β coefficient of the temperature dependence of the air-broadened halfwidth
alpha_ref β broadening parameter
- Returns:
pressure gamma factor (cm-1)
- Return type:
gamma
- exojax.spec.exomol.gamma_natural(A)ο
gamma factor by natural broadning.
1/(4 pi c) = 2.6544188e-12 (cm-1 s)
- Parameters:
A β Einstein A-factor (1/s)
- Returns:
natural width (cm-1)
- Return type:
gamma_natural
- exojax.spec.exomol.line_strength_from_Einstein_coeff(A, g, nu_lines, elower, QTref)ο
Reference Line Strength in Tref=296K, S0 from Einstein coefficient.
Note
This function is not used in other codes in ExoJAX. But it can be used for the conversion of the line strength from the original ExoMol form into HITRAN form.
- Parameters:
A β Einstein coefficient (s-1)
g β the upper state statistical weight
nu_lines β line center wavenumber (cm-1)
elower β elower
QTref β partition function Q(Tref)
Mmol β molecular mass (normalized by m_u)
- Returns:
Line strength (cm)
exojax.spec.exomolhr moduleο
- class exojax.spec.exomolhr.XdbExomolHR(exact_molecule_name, nurange, temperature, crit=1e-40, gpu_transfer=True, activation=True, inherit_dataframe=False, local_databases='./opacity_zips')ο
Bases:
object
XdbExomolHR class for ExomolHR database
Warning
XdbExomolHR is not MDB.
Notes
The ExomolHR database (eXtra db) is emprical high-res line strengths/info for a given single temperature. Xdb is a database that does not belong to regular types of ExoJAX databases.
- simple_molecule_nameο
simple molecule name
- nurangeο
nu range [min,max] (cm-1)
- nu_linesο
line center (cm-1)
- Type:
nd array
- Sij0ο
line strength at T=Tref (cm)
- Type:
nd array
- logsij0ο
log line strength at T=Tref
- Type:
jnp array
- Aο
Einstein A coeeficient
- Type:
jnp array
- gamma_naturalο
gamma factor of the natural broadening
- Type:
DataFrame or jnp array
- elowerο
the lower state energy (cm-1)
- Type:
DataFrame or jnp array
- gppο
statistical weight
- Type:
DataFrame or jnp array
- jlowerο
J_lower
- Type:
DataFrame or jnp array
- jupperο
J_upper
- Type:
DataFrame or jnp array
- n_Texpο
temperature exponent
- Type:
DataFrame or jnp array
- dev_nu_linesο
line center in device (cm-1)
- Type:
jnp array
- activate(df, mask=None)ο
Activates of moldb for Exomol, including making attributes, computing broadening parameters, natural width, and transfering attributes to gpu arrays when self.gpu_transfer = True
Notes
activation includes, making attributes, computing broadening parameters, natural width, and transfering attributes to gpu arrays when self.gpu_transfer = True
- Parameters:
df β DataFrame
mask β mask of DataFrame to be used for the activation, if None, no additional mask is applied.
Note
self.df_load_mask is always applied when the activation.
Examples
>>> # we would extract the line with delta nu = 2 here >>> mdb = api.MdbExomolHR(emf, nus, optional_quantum_states=True, activation=False) >>> load_mask = (mdb.df["v_u"] - mdb.df["v_l"] == 2) >>> mdb.activate(mdb.df, load_mask)
- attributes_from_dataframes(df_masked)ο
Generates attributes from (usually masked) data frame for Exomol
- Parameters:
df_masked (DataFrame) β (masked) data frame
- Raises:
ValueError β _description_
- fetch_data()ο
- exojax.spec.exomolhr.fetch_opacity_zip(*, wvmin: float, wvmax: float | None, numin: float, numax: float, T: int, Smin: float, iso: str, out_dir: str | os.PathLike = '.', session: Optional[Session] = None, chunk: int = 524288) Path ο
Return a local ExoMolHR CSVβdownloaded only if necessary.
The function skips the network step when a file with the same physics (identical iso and T) is already present in out_dir; only the timestamp differs between downloads.
- Parameters:
wvmax (wvmin /) β float | None Viewer wavenumber limits (nm). Pass
None
to omit wvmax.numax (numin /) β float Lineβlist limits in cmβ»ΒΉ requested from the service.
T β int Temperature [K].
Smin β float Lower cutβoff for line strength (cmβ―moleculeβ»ΒΉ).
iso β str Isotopologue tag, e.g.
"12C-16O2"
.out_dir β str | os.PathLike, optional Directory for ZIP/CSV files (default
"."
).session β requests.Session | None, optional Reβuse a
requests.Session
if supplied.chunk β int, optional Streaming block size in bytes (default 512Β kB).
- Returns:
- pathlib.Path
Path to the local CSV file.
- Raises:
RuntimeError β When the expected download link is missing or HTTP fails.
- exojax.spec.exomolhr.list_exomolhr_molecules(html_source: Optional[Union[str, bytes, Path]] = None, *, session: Optional[Session] = None) Sequence[str] ο
Return the list of molecule formulas shown on the ExoMolHR landing page.
The function can work in three modes:
Online html_source is None β download https://www.exomol.com/exomolhr/ live.
From file html_source is a pathlib.Path or filename β read the saved HTML.
From string/bytes html_source is raw HTML content β parse directly.
- Parameters:
html_source β str | bytes | pathlib.Path | None, optional Where to get the HTML. Pass
None
(default) to fetch online.session β requests.Session | None, optional Re-use a session if you call repeatedly.
- Returns: Sequence[str]
Formulas in the order they appear in the table (duplicates are removed).
- Raises:
RuntimeError β If the molecule table cannot be located in the HTML.
- exojax.spec.exomolhr.list_isotopologues(simple_molecule_list: Iterable[str], *, max_workers: Optional[int] = None) dict[str, list[str]] ο
Return {molecule: [isoβ, isoβ, β¦]} for the given molecules.
- Parameters:
simple_molecule_list β list of simple molecule names, e.g. [AlCl, AlH, AlO, C2, C2H2, CaH, CH4, CN, CO2]
max_workers β number of workers for parallel processing
- Returns:
dictionary of isotopologues (simple_molecule_name:[list of exact_molecule_name]) for each molecule e.g. {βH2Oβ: [β1H2-16Oβ], βC2H2β: [β12C2-1H2β], βH3O+β: [β1H3-16O_pβ]}
- Return type:
dict[str, list[str]]
- exojax.spec.exomolhr.load_exomolhr_csv(csv_path: str | pathlib.Path) DataFrame ο
Load a CSV file from an ExoMolHR ZIP archive into a DataFrame.
exojax.spec.generate_elower_grid_trange moduleο
elower grid trange file
- exojax.spec.generate_elower_grid_trange.generate_elower_grid_trange(N_Twt, N_Tref, N_Trange, N_dE, Treflow, Trefhigh, Twtlow, Twthigh, Tsearchl, Tsearchh, dErangel, dErangeh, filename, precision_criterion=0.01)ο
generates βelower_grid_trangeβ file, i.e. robust temperature range (Tlow, Thigh) as a function of dE, Tre, Twt, (and diffmode)
- Parameters:
N_Twt (int) β the number of Twt grid
N_Tref (int) β the number of Tref grid
N_Trange (int) β the number of Trange to serach for Tlow and Thigh
N_dE (int) β the number of dE grid
Treflow (float) β lower limit of Tref grid
Trefhigh (float) β upper limit of Tref grid
Twtlow (float) β lower limit of Twt grid
Twthigh (float) β upper limit of Twt grid
Tsearchl (float) β lower limit of Trange grid
Tsearchh (float) β upper limit of Trange grid
dErangel (float) β lower limit of dE grid
dErangeh (float) β upper limit of dE grid
filename (str) β output filename
precision_criterion (float, optional) β _description_. Defaults to 0.01.
- Raises:
ValueError β _description_
ValueError β _description_
- exojax.spec.generate_elower_grid_trange.params_version1()ο
parameters for the defaut elower grid trange version 1
- Returns:
params for generate_elower_grid_trange
- exojax.spec.generate_elower_grid_trange.params_version2()ο
parameters for the defaut elower grid trange version 2
- Returns:
params for generate_elower_grid_trange
exojax.spec.hitran moduleο
- exojax.spec.hitran.doppler_sigma(nu_lines, T, M)ο
Dopper width (sigmaD)
Note
c3 is sqrt(kB/m_u)/c
- Parameters:
nu_lines β line center wavenumber (cm-1)
T β temperature (K)
M β atom/molecular mass
- Returns:
doppler width (standard deviation) (cm-1)
- Return type:
sigma
- exojax.spec.hitran.gamma_hitran(P, T, Pself, n_air, gamma_air_ref, gamma_self_ref)ο
gamma factor by a pressure broadening.
- Parameters:
P β pressure (bar)
T β temperature (K)
Pself β partial pressure (bar)
n_air β coefficient of the temperature dependence of the air-broadened halfwidth
gamma_air_ref β gamma air
gamma_self_ref β gamma self
- Returns:
pressure gamma factor (cm-1)
- Return type:
gamma
- exojax.spec.hitran.gamma_natural(A)ο
gamma factor by natural broadning.
1/(4 pi c) = 2.6544188e-12 (cm-1 s)
- Parameters:
A β Einstein A-factor (1/s)
- Returns:
natural width (cm-1)
- Return type:
gamma_natural
- exojax.spec.hitran.line_strength(T, logsij0, nu_lines, elower, qr, Tref)ο
Line strength as a function of temperature, JAX/XLA compatible
Notes
Tref=296.0 (default) in moldb, but it might have been changed by OpaPremodit.
- Parameters:
T β temperature (K)
logsij0 β log(Sij(Tref)) (Tref=296K)
nu_lines β line center wavenumber (cm-1)
elower β elower
qr β partition function ratio qr(T) = Q(T)/Q(Tref)
Tref β reference temperature
- Returns:
Line strength (cm)
- Return type:
Sij(T)
- exojax.spec.hitran.line_strength_numpy(T, Sij0, nu_lines, elower, qr, Tref=296.0)ο
Line strength as a function of temperature, numpy version
- Parameters:
T β temperature (K)
Sij0 β line strength at Tref=296K
elower β elower
nu_lines β line center wavenumber
qr β partition function ratio qr(T) = Q(T)/Q(Tref)
Tref β reference temeparture
- Returns:
line strength at Ttyp
- exojax.spec.hitran.normalized_doppler_sigma(T, M, R)ο
Normalized Dopper width (nsigmaD) by wavenumber difference at line centers.
Note
This quantity is used in MODIT. c3 is sqrt(kB/m_u)/c
- Parameters:
T β temperature (K)
M β atom/molecular mass
R β spectral resolution
- Returns:
normalized Doppler width (standard deviation)
- Return type:
nsigma
exojax.spec.hitranapi moduleο
API for HITRAN and HITEMP outside HAPI.
- exojax.spec.hitranapi.make_partition_function_grid_hitran(M, I_list)ο
HITRAN/HITEMP IO for partition function
- Parameters:
M β HITRAN molecule number
I_list β HITRAN isotopologue number list
- Returns:
jnp array of partition function grid T_gQT: jnp array of temperature grid for gQT
- Return type:
gQT
- exojax.spec.hitranapi.molecid_hitran(molec)ο
molec id from Hitran/Hitemp filename or molecule name or molecid itself.
- Parameters:
molec β Hitran/Hitemp filename or molecule name or molec id itself.
- Returns:
molecid (HITRAN molecular id)
- Return type:
int
exojax.spec.hitrancia moduleο
- exojax.spec.hitrancia.interp_logacia_matrix(Tarr, nu_grid, nucia, tcia, logac)ο
interpolated function of log10(alpha_CIA)
- Parameters:
Tarr (1D array) β temperature array (K) [Nlayer]
nu_grid (1D array) β wavenumber array (cm-1) [Nnus]
nucia β CIA wavenumber (cm-1)
tcia β CIA temperature (K)
logac β log10 cia coefficient
- Returns:
logarithm of absorption coefficient [Nlayer, Nnus] in the unit of cm5
Example
nucia,tcia,ac=read_cia(β../../data/CIA/H2-H2_2011.ciaβ,nus[0]-1.0,nus[-1]+1.0) logac=jnp.array(np.log10(ac)) interp_logacia_matrix(Tarr,nus,nucia,tcia,logac)
- exojax.spec.hitrancia.interp_logacia_vector(T, nu_grid, nucia, tcia, logac)ο
interpolated function of log10(alpha_CIA)
- Parameters:
T (float) β temperature (K)
nu_grid β wavenumber array (cm-1)
nucia β CIA wavenumber (cm-1)
tcia β CIA temperature (K)
logac β log10 cia coefficient
- Returns:
logarithm of absorption coefficient [Nnus] at T in the unit of cm5
- exojax.spec.hitrancia.read_cia(filename, nus, nue)ο
READ HITRAN CIA data.
- Parameters:
filename β HITRAN CIA file name (_2011.cia)
nus β wavenumber min (cm-1)
nue β wavenumber max (cm-1)
- Returns:
wavenumber (cm-1) tcia: temperature (K) ac: cia coefficient
- Return type:
nucia
exojax.spec.hminus moduleο
H minus opacity by John (1988)
- exojax.spec.hminus.bound_free_absorption(wavelength_um, temperature)ο
bound free absorption of H-
Note
alpha has a value of 1.439e4 micron-1 K-1, the value stated in John (1988) is wrong
- Parameters:
wavelength_um β wavelength in the unit of micron
temperature β temperature in the unit of Kelvin
- Returns:
absorption coefficient [cm4/dyne]
- exojax.spec.hminus.free_free_absorption(wavelength_um, temperature)ο
free free absorption of H- (coefficients from John (1988))
Note
to follow his notation (which starts at an index of 1), the 0-index components are 0 for wavelengths larger than 0.3645 micron
- Parameters:
wavelength_um β wavelength in the unit of micron
temperature β temperature in the unit of Kelvin
- Returns:
absorption coefficient [cm4/dyne]
- exojax.spec.hminus.log_hminus_continuum(nu_grid, temperatures, number_density_e, number_density_h)ο
John (1988) H- continuum opacity.
- Parameters:
nu_grid β wavenumber grid (cm-1) [Nnu]
temperature β gas temperature array [K] [Nlayer]
number_density_e β electron number density array [Nlayer]
number_density_h β H atom number density array [Nlayer]
- Returns:
log10(absorption coefficient in cm-1) [Nlayer,Nnu]
- exojax.spec.hminus.log_hminus_continuum_single(nu_grid, temperature, number_density_e, number_density_h)ο
John (1988) H- continuum opacity for single temperature, number_density_e, number_density_h. used in single_layer_optical_depth_Hminus
- Parameters:
nu_grid β wavenumber grid (cm-1) [Nnu]
temperature (float) β gas temperature [K]
number_density_e (float) β electron number density
number_density_h (float) β H atom number density
- Returns:
log10(absorption coefficient in cm-1) [Nnu]
exojax.spec.initspec moduleο
Initialization for opacity computation.
The functions in this module are a wrapper for initialization processes for opacity computation.
- exojax.spec.initspec.broadening_grid_for_single_broadening_mode(nu_lines, gamma_ref, n_Texp, single_broadening_parameters, R)ο
- exojax.spec.initspec.init_dit(nu_lines, nu_grid, warning=False)ο
- Initialization for DIT. i.e. Generate nu contribution and index for the
line shape density (actually, this is a numpy version of getix)
- Parameters:
nu_lines β wavenumber list of lines [Nline] (should be numpy F64)
nu_grid β wavenumenr grid [Nnugrid] (should be numpy F64)
- Returns:
cont (contribution) jnp.array index (index) jnp.array pmarray: (+1.,-1.) array whose length of len(nu_grid)+1
Note
cont is the contribution for i=index+1. 1 - cont is the contribution for i=index. For other i, the contribution should be zero.
- exojax.spec.initspec.init_lpf(nu_lines, nu_grid)ο
Initialization for LPF.
- Parameters:
nu_lines β wavenumber list of lines [Nline] (should be numpy F64)
nu_grid β wavenumenr grid [Nnugrid] (should be numpy F64)
- Returns:
numatrix [Nline,Nnu]
- exojax.spec.initspec.init_modit(nu_lines, nu_grid, warning=False)ο
Initialization for MODIT. i.e. Generate nu contribution and index for the line shape density (actually, this is a numpy version of getix)
- Parameters:
nu_lines β wavenumber list of lines [Nline] (should be numpy F64)
nu_grid β wavenumenr grid [Nnugrid] (should be numpy F64)
- Returns:
(contribution for q) jnp.array index: (index for q) jnp.array spectral_resolution: spectral resolution (R) pmarray: (+1.,-1.) array whose length of len(nu_grid)+1
- Return type:
cont
Note
cont is the contribution for i=index+1. 1 - cont is the contribution for i=index. For other i, the contribution should be zero. dq is computed using numpy not jnp.numpy. If you use jnp, you might observe a significant residual because of the float32 truncation error.
- exojax.spec.initspec.init_modit_vald(nu_linesM, nus, N_usp)ο
Initialization for MODIT for asdb from VALD
- Parameters:
nu_linesM β wavenumbers of lines for each species [N_species x N_line] (should be numpy F64)
nu_grid β wavenumenr grid [Nnugrid] (should be numpy F64)
N_usp β number of species
- Returns:
(contribution) jnp.array [N_species x N_line] indexS: (index) jnp.array [N_species x N_line] R: spectral resolution
pmarray: (+1,-1) array whose length of len(nu_grid)+1
- Return type:
contS
- exojax.spec.initspec.init_premodit(nu_lines, nu_grid, elower, gamma_ref, n_Texp, line_strength_ref, Twt, Tref, Tref_broadening, Tmax=None, Tmin=None, dE=160.0, dit_grid_resolution=0.2, diffmode=0, single_broadening=False, single_broadening_parameters=None, warning=False)ο
Initialization for PreMODIT.
- Parameters:
nu_lines β wavenumber list of lines [Nline] (should be numpy F64)
nu_grid β wavenumenr grid [Nnugrid] (should be numpy F64)
elower β elower of lines
gamma_ref β half-width at reference (alpha_ref for ExoMol, gamma_air for HITRAN/HITEMP etc)
n_Texp β temperature exponent (n_Texp for ExoMol, n_air for HITRAN/HITEMP)
line_strength_ref β line strength at reference Tref
Twt β temperature for weight in Kelvin
Tref β reference temperature of premodit grid
Tref_broadening β reference temperature for broadening.
Tmax β max temperature to construct n_Texp grid, if None, max(Twt and Tref) is used
Tmin β min temperature to construct n_Texp grid, if None, max(Twt and Tref) is used
dE β Elower grid interval
dit_grid_resolution (float) β DIT grid resolution. when np.inf, the minmax simplex is used
diffmode (int) β i-th Taylor expansion is used for the weight, default is 1.
single_broadening (optional) β if True, single_braodening_parameters is used. Defaults to False.
single_broadening_parameters (optional) β [gamma_ref, n_Texp] at 296K for single broadening. When None, the median is used.
- Returns:
contribution for wavenumber jnp.array index_nu: index for wavenumber jnp.array elower_grid: elower grid cont_broadpar: contribution for broadening parmaeters index_broadpar: index for broadening parmaeters R: spectral resolution pmarray: (+1,-1) array whose length of len(nu_grid)+1
- Return type:
cont_nu
Note
cont is the contribution for i=index+1. 1 - cont is the contribution for i=index. For other i, the contribution should be zero. dq is computed using numpy not jnp.numpy. If you use jnp, you might observe a significant residual because of the float32 truncation error.
- exojax.spec.initspec.warn_dtype64(arr, warning, tag='')ο
check arrβs dtype.
- Parameters:
arr β input array
warning β True/False
tag β
- exojax.spec.initspec.warn_out_of_nu_grid(nu_lines, nu_grid)ο
warning for out-of-nu grid
Note
See Issue 341, https://github.com/HajimeKawahara/exojax/issues/341 Only for DIT and MODIT. For PreMODIT or newer Opacalc, this issue is automatically fixed.
- Parameters:
nu_lines (_type_) β line center
nu_grid (_type_) β wavenumber grid
- exojax.spec.initspec.warn_outside_wavenumber_grid(nu_lines, nu_grid)ο
Check if all the line centers are in the wavenumber grid.
- Parameters:
nu_lines β line center
nu_grid β wavenumber grid
Note
For MODIT/DIT, if the lines whose center are outside of the wavenumber grid, they contribute the edges of the wavenumber grid. This function is to check it. This warning often occurs when you set non-negative value to
margin
in MdbExomol, MdbHit, AdbVALD, and AdbKurucz in moldb. See #190 for the details.
exojax.spec.layeropacity moduleο
compute opacity difference in atmospheric layers
- exojax.spec.layeropacity.layer_optical_depth(dParr, xsmatrix, mixing_ratio, mass, gravity)ο
dtau matrix from the cross section matrix/vector.
Note
opfac=bar_cgs/(m_u (g)). m_u: atomic mass unit. It can be obtained by fac=1.e3/m_u, where m_u = scipy.constants.m_u.
- Parameters:
dParr (array) β delta pressure profile (bar) [N_layer]
xsmatrix (2D or 1D array) β cross section matrix (cm2) [N_layer, N_nus] or cross section vector (cm2) [N_nus]
mixing_ratio (array) β volume mixing ratio (VMR) or mass mixing ratio (MMR) [N_layer]
mass β mean molecular weight for VMR or molecular mass for MMR
gravity β gravity (cm/s2)
- Returns:
optical depth matrix, dtau [N_layer, N_nus]
- Return type:
2D array
- exojax.spec.layeropacity.layer_optical_depth_CIA(nu_grid, temperature, pressure, dParr, vmr1arr, vmr2arr, mmw, g, nucia, tcia, logac)ο
dtau of the CIA continuum.
Warning
Not used in art.
- Parameters:
nu_grid (array) β wavenumber matrix (cm-1)
temperature (array) β temperature array (K)
pressure (array) β pressure array (bar)
dParr (array) β delta temperature array (bar)
vmr1arr (array) β volume mixing ratio (VMR) for molecules 1 [N_layer]
vmr2arr (array) β volume mixing ratio (VMR) for molecules 2 [N_layer]
mmw β mean molecular weight of atmosphere
g β gravity (cm2/s)
nucia (array) β wavenumber array for CIA
tcia (array) β temperature array for CIA
logac β log10(absorption coefficient of CIA)
- Returns:
optical depth matrix, dtau [N_layer, N_nus]
- Return type:
2D array
- exojax.spec.layeropacity.layer_optical_depth_Hminus(nu_grid, temperature, pressure, dParr, vmre, vmrh, mmw, gravity)ο
dtau of the H- continuum.
- Parameters:
nu_grid (array) β wavenumber matrix (cm-1) [N_nus]
temperature (array) β temperature array (K) [N_layer]
pressure (array) β pressure array (bar) [N_layer]
dParr (array) β delta temperature array (bar) [N_layer]
vmre (array) β volume mixing ratio (VMR) for e- [N_layer]
vmrH β volume mixing ratio (VMR) for H atoms [N_layer]
mmw β mean molecular weight of atmosphere
gravity β gravity (cm2/s)
- Returns:
optical depth matrix [N_layer, N_nus]
- exojax.spec.layeropacity.layer_optical_depth_VALD(dParr, xsm, VMR, mean_molecular_weight, gravity)ο
dtau of the atomic (+ionic) cross section from VALD.
- Parameters:
dParr β delta pressure profile (bar) [N_layer]
xsm β cross section matrix (cm2) [N_species x N_layer x N_wav]
VMR β volume mixing ratio [N_species x N_layer]
mean_molecular_weight β mean molecular weight [N_layer]
gravity β gravity (cm/s2)
- Returns:
optical depth matrix, dtau [N_layer, N_nus]
- Return type:
2D array
- exojax.spec.layeropacity.layer_optical_depth_cloudgeo(dParr, condensate_substance_density, mmr_condensate, rg, sigmag, gravity)ο
the optical depth using a geometric cross-section approximation, based on (16) in AM01.
- Parameters:
dParr β delta pressure profile (bar)
condensate_substance_density β condensate substance density (g/cm3)
mmr_condensate β Mass mixing ratio (array) of condensate [Nlayer]
rg β rg parameter in the lognormal distribution of condensate size, defined by (9) in AM01
sigmag β sigmag parameter (geometric standard deviation) in the lognormal distribution of condensate size, defined by (9) in AM01, must be sigmag > 1
gravity β gravity (cm/s2)
- exojax.spec.layeropacity.layer_optical_depth_clouds_lognormal(dParr, extinction_coefficient, condensate_substance_density, mmr_condensate, rg, sigmag, gravity, N0=1.0)ο
dtau matrix from the cross section matrix/vector for the lognormal particulate distribution.
- Parameters:
dParr (array) β delta pressure profile (bar) [N_layer]
coefficient (extinction) β extinction coefficient in cgs (cm-1) [N_layer, N_nus]
condensate_substance_density (float) β condensate substance density (g/cm3)
mmr_condensate (array) β Mass mixing ratio (array) of condensate [Nlayer]
rg (float) β rg parameter in the lognormal distribution of condensate size, defined by (9) in AM01
sigmag (float) β sigmag parameter (geometric standard deviation) in the lognormal distribution of condensate size, defined by (9) in AM01, must be sigmag > 1
gravity (float) β gravity (cm/s2)
N0 (float, optional) β the normalization of the lognormal distribution ($N_0$). Defaults to 1.0.
- Returns:
optical depth matrix, dtau [N_layer, N_nus]
- Return type:
2D array
- exojax.spec.layeropacity.single_layer_optical_depth(dpressure, xsv, mixing_ratio, mass, gravity)ο
opacity for a single layer (delta tau) from cross section vector, molecular line/Rayleigh scattering (for opart)
- Parameters:
dpressure (float) β pressure difference (dP) of the layer in bar
xsv (array) β cross section vector i.e. xsvector (N_wavenumber)
mixing_ratio (float) β mass mixing ratio, (or volume mixing ratio profile)
mass (float) β molecular mass (or mean molecular weight)
gravity (float) β constant or 1d profile of gravity in cgs
- Returns:
opacity whose element is optical depth in a single layer [N_wavenumber].
- Return type:
dtau (array)
- exojax.spec.layeropacity.single_layer_optical_depth_CIA(temperature, pressure, dpressure, vmr1, vmr2, mmw, g, logacia_vector)ο
dtau of the CIA continuum for a single layer (for opart).
- Parameters:
temperature (float) β layer temperature (K)
pressure (float) β layer pressure (bar)
dpressure (float) β delta temperature (bar)
vmr1 (float) β volume mixing ratio (VMR) for molecules 1
vmr2 (float) β volume mixing ratio (VMR) for molecules 2
mmw β mean molecular weight of atmosphere
g β gravity (cm2/s)
logacia_vector β log CIA coefficient vector [N_nus], usually obtained by opacont.OpaCIA.logacia_vector(temperature)
- Returns:
optical depth matrix, dtau [N_nus]
- Return type:
1D array
- exojax.spec.layeropacity.single_layer_optical_depth_Hminus(nu_grid, temperature, pressure, dpressure, vmre, vmrh, mmw, g)ο
dtau of the H- continuum for a single layer (e.g. for opart).
- Parameters:
nu_grid (array) β wavenumber matrix (cm-1) [N_nus]
temperature (float) β temperature (K)
pressure (float) β pressure (bar)
dpressure (float) β delta pressure (bar)
vmre β volume mixing ratio (VMR) for e- [N_layer]
vmrH β volume mixing ratio (VMR) for H atoms [N_layer]
mmw β mean molecular weight of atmosphere
g β gravity (cm2/s)
- Returns:
optical depth matrix [N_layer, N_nus]
- exojax.spec.layeropacity.single_layer_optical_depth_clouds_lognormal(dpressure, extinction_coefficient, condensate_substance_density, mmr_condensate, rg, sigmag, gravity, N0=1.0)ο
dtau matrix from the cross section matrix/vector for the lognormal particulate distribution, for a single layer.
- Parameters:
dpressure (float) β delta pressure (bar)
coefficient (extinction) β extinction coefficient in cgs (cm-1) [N_nus]
condensate_substance_density (float) β condensate substance density (g/cm3)
mmr_condensate (float) β Mass mixing ratio of condensate
rg (float) β rg parameter in the lognormal distribution of condensate size, defined by (9) in AM01
sigmag (float) β sigmag parameter (geometric standard deviation) in the lognormal distribution of condensate size, defined by (9) in AM01, must be sigmag > 1
gravity (float) β gravity (cm/s2)
N0 (float, optional) β the normalization of the lognormal distribution ($N_0$). Defaults to 1.0.
- Returns:
optical depth matrix, dtau [N_nus]
- Return type:
1D array
exojax.spec.lbd moduleο
- exojax.spec.lbd.lbd_coefficients(elower_lines, elower_grid, Tref, Twt, diffmode=2, conversion_dtype=<class 'numpy.float64'>)ο
compute the LBD zeroth and first coefficients
- Parameters:
elower_lines β Lineβs Elower
elower_grid β Elower grid for LBD
Tref β reference tempreature to be used for the line strength S0
Twt β temperature used for the weight coefficient computation
diffmode (int) β i-th Taylor expansion is used for the weight, default is 2.
converted_dtype β data type for conversion. Needs enough large because this code uses exp.
- Returns:
the zeroth coefficient at Point 2 the first coefficient at Point 2 index
Note
Twp (Temperature at the weight point) corresponds to Ttyp, but not typical temparture at all. zeroth and first coefficients are at Point 2, i.e. for i=index+1. 1 - zeroth_coefficient gives the zeroth coefficient at Point 1, i.e. for i=index. - first_coefficient gives the first coefficient at Point 1.
- exojax.spec.lbd.weight(T, Twt, zeroth_coeff, first_coeff)ο
construct lbd from zeroth and first terms in the first Taylor approximation
- Parameters:
Tref β reference tempreature to be used for the line strength S0
Twt (float) β temperature used for the weight coefficient computation
T (float) β _description_
Twt β _description_
zeroth_coeff (ndarray) β zeroth coefficient of the Taylor expansion of the weight at Twt
first_coeff (ndarray) β first coefficient of the Taylor expansion of the weight at Twt
- Returns:
weight at the points 1 and 2
- Return type:
ndarray
exojax.spec.lbderror moduleο
- exojax.spec.lbderror.default_elower_grid_trange_file(version)ο
default elower_grid_trange filename
- Parameters:
version (int) β version of default elower_grid_trange file, 1 or 2
- Returns:
default_elower_grid_trange (degt) filename
Note
This file assumes 1 % precision of line strength within [Tl, Tu] default_elower_grid_trange_file generated by spec/generate_elower_grid_trange.py. Version 1 The original one when premodit was implemented Version 2 a wider temperature range (Jan 2024)
- exojax.spec.lbderror.evaluate_trange(Tarr, tlide_line_strength, crit, Twt)ο
evaluate robust temperature range
- Parameters:
Tarr (ndarray) β temperature array, shape = (N,)
tlide_line_strength (ndarray) β line strength error, shape = (N,)
crit (float) β criterion of line strength error (0.01=1%)
Twt (float) β weight temperature
- Returns:
Tl, Tu. The line strength error is below crit within [Tl, Tu]
- Return type:
float, float
- exojax.spec.lbderror.optimal_params(Tl, Tu, diffmode=2, version=2, makefig=False, filename=None)ο
derive the optimal parameters for a given Tu and Tl, which satisfies x % (1% if filename=None) precision within [Tl, Tu]
- Parameters:
Tl (float) β lower temperature
Tu (float) β upper temperature
diffmode (int, optional) β diff mode. Defaults to 2.
version (int, optional) β version of the default_elower_grid_trange_file, 1 or 2 (default)
makefig (bool, optional) β if you wanna make a fig. Defaults to False.
filename β grid_trange file, if None default_elower_grid_trange_file is used.
- Returns:
dE, Tref, Twt (optimal ones)
- Return type:
float
- exojax.spec.lbderror.single_tilde_line_strength(t, w1, w2, tref, dE, p=0.5)ο
- Parameters:
t (float) β inverse temperature
w1 (_type_) β weight at point 1
w2 (_type_) β weight at point 2
tref (_type_) β reference temperature
dE (_type_) β energy interval in cm-1
p (float, optional) β between 0 to 1 Defaults to 0.5.
- Returns:
_description_
- Return type:
_type_
- exojax.spec.lbderror.single_tilde_line_strength_first(t, twp, tref, dE, p=0.5)ο
Single Line Line strength prediction for Premodit/diffmode=1
- Parameters:
t (_type_) β inverse temperature
twp (_type_) β inverse weight temperature
tref (_type_) β inverse reference temperature
dE (_type_) β Elower interval
p (float, optional) β fraction of the line point. Defaults to 0.5.
- Returns:
_description_
- Return type:
_type_
- exojax.spec.lbderror.single_tilde_line_strength_second(t, twp, tref, dE, p=0.5)ο
Single Line Line strength prediction for Premodit/diffmode=1
- Parameters:
t (_type_) β inverse temperature
twp (_type_) β inverse weight temperature
tref (_type_) β inverse reference temperature
dE (_type_) β Elower interval
p (float, optional) β fraction of the line point. Defaults to 0.5.
- Returns:
_description_
- Return type:
_type_
- exojax.spec.lbderror.single_tilde_line_strength_zeroth(t, twp, tref, dE, p=0.5)ο
- exojax.spec.lbderror.weight_point1_dE(t, tref, dE, p=0.5)ο
dE version of the weight at point 1 for PreMODIT
- Parameters:
t (float) β inverse temperature
tref (float) β reference inverse temperature
dE (float) β envergy interval between points 1 nad 2 (cm-1)
p (float) β between 0 to 1
- Returns:
weight at point 1
- exojax.spec.lbderror.weight_point2_dE(t, tref, dE, p=0.5)ο
dE version of the weight at point 2 for PreMODIT
- Parameters:
t (float) β inverse temperature
tref (float) β reference inverse temperature
dE (float) β envergy interval between points 1 nad 2 (cm-1)
p (float) β between 0 to 1
- Returns:
weight at point 2
- exojax.spec.lbderror.worst_tilde_line_strength_first(T, Ttyp, Tref, dE)ο
worst deviation of single tilde line search first in terms of p
- Parameters:
T (float, ndarray) β temperature (array) K
Twp (float) β weight temperature K
Tref (float) β reference tempearture K
dE (float) β Elower interval cm-1
- Returns:
worst value of single_tilde_line_strength_first in terms of p
- exojax.spec.lbderror.worst_tilde_line_strength_second(T, Ttyp, Tref, dE)ο
worst deviation of single tilde line search first in terms of p
- Parameters:
T (float, ndarray) β temperature (array) K
Twp (float) β weight temperature K
Tref (float) β reference tempearture K
dE (float) β Elower interval cm-1
- Returns:
worst value of single_tilde_line_strength_first in terms of p
exojax.spec.limb_darkening moduleο
Limb darkening functions.
- exojax.spec.limb_darkening.ld_kipping(q1, q2)ο
Uninformative prior conversion of the limb darkening by Kipping (arxiv:1308.0009)
- Parameters:
q1 β U(0,1)
q2 β U(0,1)
- Returns:
quadratic LD coefficient u1 u2: quadratic LD coefficient u2
- Return type:
u1
exojax.spec.lpf moduleο
Line Profile Functions method for opacity calculation.
- exojax.spec.lpf.exomol(mdb, Tarr, Parr, molmass)ο
Computes molecular line information required for MODIT using Exomol mdb.
- Parameters:
mdb β mdb instance
Tarr β Temperature array
Parr β Pressure array
molmass β molecular mass
- Returns:
line intensity matrix, gammaL matrix, sigmaD matrix
- exojax.spec.lpf.hjert_jvp(primals, tangents)ο
- exojax.spec.lpf.ljert(x, a)ο
ljert function, consisting of a combination of imwofz and imag(asymptiotic wofz).
- Parameters:
x β
a β
- Returns:
L(x,a) or Imag(wofz(x+ia))
Note
ljert provides a L(x,a) function. This function accepts a scalar value as an input. Use jax.vmap to use a vector as an input.
- exojax.spec.lpf.vald(adb, Tarr, PH, PHe, PHH)ο
Computes VALD line information required for LPF using VALD atomic database (adb)
- Parameters:
adb β adb instance made by the AdbVald class in moldb.py
Tarr β Temperature array
PH β Partial pressure array of neutral hydrogen (H)
PHe β Partial pressure array of neutral helium (He)
PHH β Partial pressure array of molecular hydrogen (H2)
- Returns:
line intensity matrix gammaLM: gammaL matrix sigmaDM: sigmaD matrix
- Return type:
SijM
- exojax.spec.lpf.vald_each(Tarr, PH, PHe, PHH, qt_284_T, QTmask, QTref_284, logsij0, nu_lines, ielem, iion, dev_nu_lines, elower, eupper, atomicmass, ionE, gamRad, gamSta, vdWdamp, Tref)ο
Compute VALD line information required for LPF for separated each species
- Parameters:
Tarr β temperature array [N_layer]
PH β partial pressure array of neutral hydrogen (H) [N_layer]
PHe β partial pressure array of neutral helium (He) [N_layer]
PHH β partial pressure array of molecular hydrogen (H2) [N_layer]
qt_284_T β partition function at the temperature T Q(T), for 284 species
QTmask β array of index of Q(Tref) grid (gQT) for each line
QTref_284 β partition function at the reference temperature Q(Tref), for 284 species
logsij0 β log line strength at T=Tref
nu_lines β line center (cm-1) in np.array (float64)
ielem β atomic number (e.g., Fe=26)
iion β ionized level (e.g., neutral=1, singly ionized=2, etc.)
dev_nu_lines β line center (cm-1) in device (float32)
elower β the lower state energy (cm-1)
eupper β the upper state energy (cm-1)
atomicmass β atomic mass (amu)
ionE β ionization potential (eV)
gamRad β log of gamma of radiation damping (s-1)
gamSta β log of gamma of Stark damping (s-1)
vdWdamp β log of (van der Waals damping constant / neutral hydrogen number) (s-1)
- Returns:
line intensity matrix [N_layer x N_line] gammaLM: gammaL matrix [N_layer x N_line] sigmaDM: sigmaD matrix [N_layer x N_line]
- Return type:
SijM
- exojax.spec.lpf.voigt(nuvector, sigmaD, gammaL)ο
Custom JVP version of Voigt profile using Voigt-Hjerting function.
- Parameters:
nu β wavenumber array
sigmaD β sigma parameter in Doppler profile
gammaL β broadening coefficient in Lorentz profile
- Returns:
Voigt profile
- Return type:
v
- exojax.spec.lpf.voigtone(nu, sigmaD, gammaL)ο
Custom JVP version of (non-vmapped) Voigt function using Voigt-Hjerting function.
- Parameters:
nu β wavenumber
sigmaD β sigma parameter in Doppler profile
gammaL β broadening coefficient in Lorentz profile
- Returns:
Voigt funtion
- Return type:
v
- exojax.spec.lpf.vvoigt(numatrix, sigmaD, gammaL)ο
Custom JVP version of vmaped voigt profile.
- Parameters:
numatrix β wavenumber matrix in R^(Nline x Nwav)
sigmaD β doppler sigma vector in R^Nline
gammaL β gamma factor vector in R^Nline
- Returns:
Voigt profile vector in R^Nwav
- exojax.spec.lpf.xsmatrix(numatrix, sigmaDM, gammaLM, SijM)ο
Custom JVP version of cross section matrix.
- Parameters:
numatrix β wavenumber matrix in R^(Nline x Nwav)
sigmaDM β doppler sigma matrix in R^(Nlayer x Nline)
gammaLM β gamma factor matrix in R^(Nlayer x Nline)
SijM β line strength matrix in R^(Nlayer x Nline)
- Returns:
cross section matrix in R^(Nlayer x Nwav)
- exojax.spec.lpf.xsvector(numatrix, sigmaD, gammaL, Sij)ο
Custom JVP version of cross section vector.
- Parameters:
numatrix β wavenumber matrix in R^(Nline x Nwav)
sigmaD β doppler sigma vector in R^Nline
gammaL β gamma factor vector in R^Nline
Sij β line strength vector in R^Nline
- Returns:
cross section vector in R^Nwav
exojax.spec.lpffilter moduleο
- exojax.spec.lpffilter.compute_filter_length(wavenumber_halfwidth, representative_wavenumber, spectral_resolution)ο
compute the length of the FIR line shape filter
- Parameters:
wavenumber_halfwidth (float) β half width at representative wavenumber (cm-1)
representative_wavenumber (float) β representative wavenumber (cm-1)
spectral_resolution (float) β spectral resolution R0
- Returns:
filter length
- Return type:
int
Examples
from exojax.utils.instfunc import resolution_eslog spectral_resolution = resolution_eslog(nu_grid) filter_length = compute_filter_length(50.0, 4000.0, spectral_resolution)
- exojax.spec.lpffilter.generate_closed_lpffilter(filter_length_oneside, nsigmaD, ngammaL)ο
Generates the closed form LPF filter
- Parameters:
filter_length (int) β length of the wavenumber grid of lpffilter
nsigmaD (float) β normalized gaussian standard deviation, resolution*betaT/nu betaT is the STD of Doppler broadening
ngammaL (float) β normalized Lorentzian half width
Notes
The filter structure is filter[1:M] = vkfilter[M+1:][::-1]m where M=N/2 filter[0] is the DC component, Nyquist component. filter[M] is the Nyquist component. The dimension of the closed lpf filter is even number.
- Returns:
closed lpf filter [2*filter_length_oneside]
- Return type:
array
- exojax.spec.lpffilter.generate_open_lpffilter(filter_length_oneside, nsigmaD, ngammaL)ο
Generates the open form LPF filter
Notes
The dimension of the open lpf filter is odd number to ensure asymmetry. This forces fft_length to be even number when the dimension of signal is even number.
- Parameters:
filter_length_oneside (int) β length of the wavenumber grid of lpffilter
nsigmaD (float) β normalized gaussian standard deviation, resolution*betaT/nu betaT is the STD of Doppler broadening
ngammaL (float) β normalized Lorentzian half width
- Returns:
open lpf filter [2*filter_length_oneside+1]
- Return type:
array
exojax.spec.lsd moduleο
functions for computation of line shape density (LSD)
there are both numpy and jnp versions. (np)*** is numpy version.
(np)add(x)D constructs the (x)Dimensional LSD array given the contribution and index.
- exojax.spec.lsd.add2D(a, w, cx, ix, cy, iy)ο
Add into an array when contirbutions and indices are given (2D).
- Parameters:
a β lineshape density (LSD) array (np.array)
w β weight (N)
cx β given contribution for x
ix β given index for x
cy β given contribution for y
iy β given index for y
- Returns:
a
- exojax.spec.lsd.add3D(a, w, cx, ix, cy, iy, cz, iz)ο
Add into an array when contirbutions and indices are given (3D).
- Parameters:
a β lineshape density (LSD) array (np.array)
w β weight (N)
cx β given contribution for x
ix β given index for x
cy β given contribution for y
iy β given index for y
cz β given contribution for z
iz β given index for z
- Returns:
a
- exojax.spec.lsd.inc2D_givenx(a, w, cx, ix, y, yv)ο
Compute integrated neighbouring contribution for 2D LSD (memory reduced sum) but using given contribution and index for x .
- Parameters:
a β lineshape density (LSD) array (jnp.array)
w β weight (N)
cx β given contribution for x
ix β given index for x
y β y values (N)
yv β y grid
- Returns:
lineshape distribution matrix (integrated neighbouring contribution for 2D)
Note
This function computes sum_n w_n fx_n otimes fy_n, where w_n is the weight, fx_n, fy_n, are the n-th NCFs for 1D. A direct sum uses huge RAM.
- exojax.spec.lsd.inc3D_givenx(a, w, cx, ix, y, z, xv, yv, zv)ο
Compute integrated neighbouring contribution for the 3D lineshape distribution (LSD) matrix (memory reduced sum) but using given contribution and index for x .
- Parameters:
a β lineshape density (LSD) array (jnp.array)
w β weight (N)
cx β given contribution for x
ix β given index for x
y β y values (N)
z β z values (N)
xv β x grid
yv β y grid
zv β z grid
- Returns:
lineshape distribution matrix (integrated neighbouring contribution for 3D)
Note
This function computes sum_n w_n fx_n otimes fy_n otimes fz_n, where w_n is the weight, fx_n, fy_n, and fz_n are the n-th NCFs for 1D. A direct sum uses huge RAM.
- exojax.spec.lsd.npadd3D_direct1D(a, w, cx, ix, direct_cy, direct_iy, cz, iz, sumx=1.0, sumz=1.0)ο
numpy version: Add into an array when contirbutions and indices are given (2D+direct).
- Parameters:
a β lineshape density (LSD) array (np.array)
w β weight (N)
cx β given contribution for x
ix β given index for x
direct_cy β direct contribution for y
direct_iy β direct index for y
cz β given contribution for z
iz β given index for z
sumx β a sum of contribution for x at point 1 and point 2, default=1.0
sumz β a sum of contribution for z at point 1 and point 2, default=1.0
- Returns:
lineshape density a(nx,ny,nz)
Note
sumx or sumz gives a sum of contribution at point 1 and point 2. For the zeroth coeeficient, it should be 1.0 while it should be 0.0 for the first coefficient.
- exojax.spec.lsd.npadd3D_multi_index(a, w, cx, ix, cz, iz, uidx, multi_cont_lines, neighbor_uidx, sumx=1.0, sumz=1.0)ο
numpy version: Add into an array using multi_index system in y :param a: lineshape density (LSD) array (np.array) :param w: weight (N) :param cx: given contribution for x :param ix: given index for x :param cz: given contribution for z :param iz: given index for z :param sumx: a sum of contribution for x at point 1 and point 2, default=1.0 :param sumz: a sum of contribution for z at point 1 and point 2, default=1.0
- Returns:
lineshape density a(nx,ny,nz)
Note
sumx or sumz gives a sum of contribution at point 1 and point 2. For the zeroth coeeficient, it should be 1.0 while it should be 0.0 for the first coefficient.
exojax.spec.make_numatrix moduleο
- exojax.spec.make_numatrix.add_nu(dd, fnu, fhatnu, Nz)ο
re-adding an interger part w/JIT.
- Parameters:
dd β difference matrix
fnu β integer part of wavenumber
fhatnu β residual wavenumber
Nz β boost factor
- Returns:
an integer part readded value
- exojax.spec.make_numatrix.divwavnum(nu, Nz=1)ο
separate an integer part from a residual.
- Parameters:
nu β wavenumber array
Nz β boost factor (default=1)
- Returns:
integer part of wavenumber, residual wavenumber, boost factor
- exojax.spec.make_numatrix.make_numatrix0(nu, hatnu, warning=True)ο
Generate numatrix0.
Note
Use float64 as inputs.
- Parameters:
nu β wavenumber matrix (Nnu,)
hatnu β line center wavenumber vector (Nline,), where Nm is the number of lines
warning β True=warning on for nu.dtype=float32
- Returns:
numatrix (Nline,Nnu)
- exojax.spec.make_numatrix.make_numatrix0_subtract(nu, hatnu, Nz=1, warning=True)ο
Generate numatrix0 using gpu.
Note
This function computes a wavenumber matrix using XLA. Because XLA does not support float64, a direct computation sometimes results in large uncertainity. For instace, letβs assume nu=2000.0396123 cm-1 and hatnu=2000.0396122 cm-1. If applying float32, we get np.float32(2000.0396123)-np.float32(2000.0396122) = 0.0. But, after subtracting 2000 from both nu and hatnu, we get np.float32(0.0396123)-np.float32(0.0396122)=1.0058284e-07. make_numatrix0 does such computation. Nz=1 means we subtract a integer part (i.e. 2000), Nz=10 means we subtract 2000.0, and Nz=10 means we subtract 2000.00.
- Parameters:
nu β wavenumber matrix (Nnu,)
hatnu β line center wavenumber vector (Nline,), where Nm is the number of lines
Nz β boost factor (default=1)
warning β True=warning on for nu.dtype=float32
- Returns:
wavenumber matrix w/ no shift
- Return type:
numatrix0
- exojax.spec.make_numatrix.subtract_nu(dnu, dhatnu)ο
compute nu - hatnu by subtracting an integer part w/JIT
- Parameters:
dnu β residual wavenumber array
dhatnu β residual line center array
- Returns:
difference matrix
exojax.spec.mie moduleο
Mie scattering calculation using PyMieScatt
- exojax.spec.mie.auto_rgrid(rg, sigmag, nrgrid=1500)ο
sets the automatic rgrid (particulate radius grid).
Note
This method optimizes the sampling grid of the particulate radius (rgrid). The basic strategy is as follows. 1. if the cube-weighted lognormal distribution q(x) is enough compact, the sampling points is given by the linear within the range of [mean - m sigma, mean + n sigma] where sigma is the STD of q(x). 2. else, i.e., the distribution starts from close to 0 (large sigmag), the range is [0 + dr, n*mean]. Currently sigmag = 1.0001 to 4 is within 1 % error for the defalut setting. See tests/unittests/spec/clouds/mie_test.py
- Parameters:
rg (float) β rg parameter in lognormal distribution in cgs
sigmag (float) β sigma_g parameter in lognormal distribution
nrgrid (int, optional) β the number of rgrid. Defaults to 1500.
- Returns:
rgrid (the particulate radius grid)
- Return type:
array
- exojax.spec.mie.compute_mie_coeff_lognormal_grid(refractive_indices, refractive_wavenm, sigmag_arr, rg_arr, N0=1.0)ο
computes miegrid for lognomal distribution parameters rg and sigmag
- Args:
refractive_indices (_type_): refractive indices (m = n + ik) refractive_wavenm (_type_): wavenlenth in nm for refractive indices sigmag_arr (1d array): sigmag ($sigma_g$) array rg_arr (1d array): rg ($r_g$) array N0 (_type_, optional): the normalization of the lognormal distribution ($N_0$). Defaults to 1.0.
- Note:
N0 ($N_0$) is defined as the normalization of the cloud distribution, $n(r) pr = N_0 p(r) pr where $r$ is the particulate radius and $p(r) =
rac{1}{sqrt{2 pi}} rac{1}{r log{sigma_g}} exp{- rac{(log{r} - log{r_g})^2}{2 log^2{sigma_g}}}$$
is the lognormal distribution. See also https://pymiescatt.readthedocs.io/en/latest/forward.html they use the diameter instead (but p(d) ) $p(d) pd =
rac{N_0}{sqrt{2 pi}} rac{1}{d log{sigma_g}} exp{- rac{(log{d} - log{d_g})^2}{2 log^2{sigma_g}}}$ pd
where and $d = 2 r$ and $d_g = 2 r_g$. In ExoJAX Ackerman and Marley cloud model, $N_0$ can be evaluated by atm.amclouds.normalization_lognormal.
- Returns:
_type_: miegrid (N_rg, N_sigmag, N_refractive_indices, 7), 7 is the number of the mie coefficients
- exojax.spec.mie.compute_mieparams_cgs_from_miegrid(rg, sigmag, miegrid, rg_arr, sigmag_arr, N0)ο
computes Mie parameters i.e. extinction coeff, sinigle scattering albedo, asymmetric factor using miegrid. This process also convert the unit to cgs
- Args:
rg_layer (1d array): layer wise rg parameters sigmag_layer (1d array): layer wise sigmag parameters miegrid (5d array): Mie grid (lognormal) rg_arr (1d array): rg array used for computing miegrid sigmag_arr (1d array): sigma_g array used for computing miegrid N0 (float, optional): the normalization of the lognormal distribution ($N_0$). Defaults to 1.0.
- Note:
N0 ($N_0$) is defined as the normalization of the cloud distribution, $n(r) pr = N_0 p(r) pr where $r$ is the particulate radius and $p(r) =
rac{1}{sqrt{2 pi}} rac{1}{r log{sigma_g}} exp{- rac{(log{r} - log{r_g})^2}{2 log^2{sigma_g}}}$$
is the lognormal distribution. See also https://pymiescatt.readthedocs.io/en/latest/forward.html they use the diameter instead (but p(d) ) $p(d) pd =
rac{N_0}{sqrt{2 pi}} rac{1}{d log{sigma_g}} exp{- rac{(log{d} - log{d_g})^2}{2 log^2{sigma_g}}}$ pd
where and $d = 2 r$ and $d_g = 2 r_g$. In ExoJAX Ackerman and Marley cloud model, $N_0$ can be evaluated by atm.amclouds.normalization_lognormal.
- Note:
Volume extinction coefficient (1/cm) for the number density N can be computed by beta_extinction = N*sigma0_extinction The original extinction coefficient (beta) from PyMieScat has the unit of 1/Mm (Mega meter) for diameter. Therefore, this method multiplies 1.e-8 to beta for conversion to 1/cm for radius.
- Returns:
sigma_extinction, extinction cross section (cm2) = volume extinction coefficient (1/cm) normalized by the reference numbver density N0. sigma_scattering, scattering cross section (cm2) = volume extinction coefficient (1/cm) normalized by the reference numbver density N0. g, asymmetric factor (mean g)
- exojax.spec.mie.cubeweighted_integral_checker(rgrid, rg, sigmag, accuracy=0.01)ο
checks if the trapezoid integral of the cube-weighted lognormal distribution agrees with 1 within prec given rgrid, rg, sigmag
- Parameters:
rgrid (array) β the particulate radius grid
rg (float) β rg parameter in lognormal distribution in cgs
sigmag (float) β sigma_g parameter in lognormal distribution
accuracy (float, optional) β _description_. Defaults to 1.e-2, i.e. 1% accuracy.
- Returns:
True or False
- Return type:
bool
- exojax.spec.mie.evaluate_miegrid(rg, sigmag, miegrid, rg_arr, sigmag_arr)ο
evaluates the value at rg and sigmag by interpolating miegrid
- Parameters:
rg (float) β rg parameter in lognormal distribution
sigmag (float) β sigma_g parameter in lognormal distribution
miegrid (5d array) β Mie grid (lognormal)
sigmag_arr (1d array) β sigma_g array
rg_arr (1d array) β rg array
Note
beta derived here is in the unit of 1/Mm (Mega meter) for diameter multiply 1.e-8 to convert to 1/cm for radius.
- Returns:
evaluated values of miegrid, output of MieQ_lognormal Bext (1/Mm), Bsca, Babs, G, Bpr, Bback, Bratio (wavenumber, number of mieparams)
- Return type:
_type_
- exojax.spec.mie.make_miegrid_lognormal(refraction_index, refraction_index_wavelength_nm, filename, sigmagmin=1.0001, sigmagmax=4.0, Nsigmag=10, log_rg_min=- 7.0, log_rg_max=- 3.0, Nrg=40, N0=1.0)ο
generates miegrid assuming lognormal size distribution
- Args:
refraction_index: complex refracion (refractive) index refraction_index_wavelength_nm: wavelength grid in nm filename (str): filename sigmagmin (float, optional): sigma_g minimum. Defaults to 1.0001. sigmagmax (float, optional): sigma_g maximum. Defaults to 4.0. Nsigmag (int, optional): the number of the sigmag grid. Defaults to 10. log_rg_min (float, optional): log r_g (cm) minimum . Defaults to -7.0. log_rg_max (float, optional): log r_g (cm) minimum. Defaults to -3.0. Nrg (int, optional): the number of the rg grid. Defaults to 40. N0 (float, optional): the normalization of the lognormal distribution ($N_0$). Defaults to 1.0.
- Note:
N0 ($N_0$) is defined as the normalization of the cloud distribution, $n(r) pr = N_0 p(r) pr where $r$ is the particulate radius and $p(r) =
rac{1}{sqrt{2 pi}} rac{1}{r log{sigma_g}} exp{- rac{(log{r} - log{r_g})^2}{2 log^2{sigma_g}}}$$
is the lognormal distribution. See also https://pymiescatt.readthedocs.io/en/latest/forward.html they use the diameter instead (but p(d) ) $p(d) pd =
rac{N_0}{sqrt{2 pi}} rac{1}{d log{sigma_g}} exp{- rac{(log{d} - log{d_g})^2}{2 log^2{sigma_g}}}$ pd
where and $d = 2 r$ and $d_g = 2 r_g$. In ExoJAX Ackerman and Marley cloud model, $N_0$ can be evaluated by atm.amclouds.normalization_lognormal.
- exojax.spec.mie.mie_lognormal_pymiescatt(m, wavelength, sigmag, rg, N0, rgrid, nMedium=1.0)ο
Mie parameters assuming a lognormal distribution
- Parameters:
m (_type_) β _description_
wavelength (_type_) β _description_
sigmag (float) β sigma_g parameter in lognormal distribution
rg (float) β rg parameter in lognormal distribution in cgs
N0 (_type_) β
rgrid β grid of the particulate radius
nMedium (float, optional) β _description_. Defaults to 1.0.
- Returns:
_description_
- Return type:
_type_
- exojax.spec.mie.read_miegrid(filename)ο
read miegrid file
- Parameters:
filename (str) β file name
- Returns:
miegrid jnp 1d array: array for rg jnp 1d array: array for sigmag
- Return type:
jnp Nd array
- exojax.spec.mie.save_miegrid(filename, miegrid, rg_arr, sigmag_arr)ο
save miegrid file
- Parameters:
filename (str) β file name
array (jnp 1d) β miegrid
array β array for rg
array β array for sigmag
exojax.spec.modit moduleο
Line profile computation using Discrete Integral Transform.
MODIT is Modified version of the Discrete Integral Transform for rapid spectral synthesis, originally proposed by D.C.M van den Bekerom and E.Pannier. See Section 2.1.2 in Paper I.
This module consists of selected functions in addit package.
The concept of βfoldingβ can be understood by reading the discussion by D.C.M van den Bekerom.
See also DIT for non evenly-spaced linear grid by D.C.M van den Bekerom, as a reference of this code.
- exojax.spec.modit.dgmatrix(x, dit_grid_resolution=0.1, adopt=True)ο
DIT GRID MATRIX (alias)
- Parameters:
x β simgaD or gammaL matrix (Nlayer x Nline)
dit_grid_resolution β grid resolution. dit_grid_resolution=0.1 (defaut) means a grid point per digit
adopt β if True, min, max grid points are used at min and max values of x. In this case, the grid width does not need to be dit_grid_resolution exactly.
- Returns:
grid for DIT (Nlayer x NDITgrid)
- exojax.spec.modit.ditgrid(x, dit_grid_resolution=0.1, adopt=True)ο
DIT GRID (deprecated).
- Parameters:
x β simgaD or gammaL array (Nline)
dit_grid_resolution β grid resolution. res=0.1 (defaut) means a grid point per digit
adopt β if True, min, max grid points are used at min and max values of x. In this case, the grid width does not need to be res exactly.
- Returns:
grid for DIT
- exojax.spec.modit.exomol(mdb, Tarr, Parr, R, molmass)ο
compute molecular line information required for MODIT using Exomol mdb.
- Parameters:
mdb β mdb instance
Tarr β Temperature array
Parr β Pressure array
R β spectral resolution
molmass β molecular mass
wavmask β mask for wavenumber #Issue 341
- Returns:
line intensity matrix, normalized gammaL matrix, normalized sigmaD matrix
- exojax.spec.modit.hitran(mdb, Tarr, Parr, Pself, R, molmass)ο
compute molecular line information required for MODIT using HITRAN/HITEMP mdb.
- Parameters:
mdb β mdb instance
Tarr β Temperature array
Parr β Pressure array
Pself β Partial pressure array
R β spectral resolution
molmass β molecular mass
- Returns:
line intensity matrix, normalized gammaL matrix, normalized sigmaD matrix
- exojax.spec.modit.minmax_dgmatrix(x, dit_grid_resolution=0.1, adopt=True)ο
compute MIN and MAX DIT GRID MATRIX.
- Parameters:
x β gammaL matrix (Nlayer x Nline)
dit_grid_resolution β grid resolution. dit_grid_resolution=0.1 (defaut) means a grid point per digit
adopt β if True, min, max grid points are used at min and max values of x. In this case, the grid width does not need to be dit_grid_resolution exactly.
- Returns:
minimum and maximum for DIT (dgm_minmax)
- exojax.spec.modit.precompute_dgmatrix(set_gm_minmax, dit_grid_resolution=0.1, adopt=True)ο
Precomputing MODIT GRID MATRIX for normalized GammaL.
- Parameters:
set_gm_minmax β set of gm_minmax for different parameters [Nsample, Nlayers, 2], 2=min,max
dit_grid_resolution β grid resolution. dit_grid_resolution=0.1 (defaut) means a grid point per digit
adopt β if True, min, max grid points are used at min and max values of x. In this case, the grid width does not need to be dit_grid_resolution exactly.
- Returns:
grid for DIT (Nlayer x NDITgrid)
- exojax.spec.modit.set_ditgrid_matrix_exomol(mdb, fT, Parr, R, molmass, dit_grid_resolution, *kargs)ο
Easy Setting of DIT Grid Matrix (dgm) using Exomol.
- Parameters:
mdb β mdb instance
fT β function of temperature array
Parr β pressure array
R β spectral resolution
molmass β molecular mass
dit_grid_resolution β
resolution of dgm
*kargs: arguments for fT
- Returns:
DIT Grid Matrix (dgm) of normalized gammaL
Example
>>> fT = lambda T0,alpha: T0[:,None]*(Parr[None,:]/Pref)**alpha[:,None] >>> T0_test=np.array([1100.0,1500.0,1100.0,1500.0]) >>> alpha_test=np.array([0.2,0.2,0.05,0.05]) >>> dit_grid_resolution=0.2 >>> dgm_ngammaL=setdgm_exomol(mdbCH4,fT,Parr,R,molmassCH4,dit_grid_resolution,T0_test,alpha_test)
- exojax.spec.modit.set_ditgrid_matrix_hitran(mdb, fT, Parr, Pself_ref, R, molmass, dit_grid_resolution, *kargs)ο
Easy Setting of DIT Grid Matrix (dgm) using HITRAN/HITEMP.
- Parameters:
mdb β mdb instance
fT β function of temperature array
Parr β pressure array
Pself_ref β reference partial pressure array
R β spectral resolution
molmass β molecular mass
dit_grid_resolution β
resolution of dgm
*kargs: arguments for fT
- Returns:
DIT Grid Matrix (dgm) of normalized gammaL
Example
>>> fT = lambda T0,alpha: T0[:,None]*(Parr[None,:]/Pref)**alpha[:,None] >>> T0_test=np.array([1100.0,1500.0,1100.0,1500.0]) >>> alpha_test=np.array([0.2,0.2,0.05,0.05]) >>> dit_grid_resolution=0.2 >>> dgm_ngammaL=setdgm_hitran(mdbCH4,fT,Parr,Pself,R,molmassCH4,dit_grid_resolution,T0_test,alpha_test)
- exojax.spec.modit.set_ditgrid_matrix_vald_all(asdb, PH, PHe, PHH, R, fT, dit_grid_resolution, *kargs)ο
Easy Setting of DIT Grid Matrix (dgm) using VALD.
- Parameters:
asdb β asdb instance made by the AdbSepVald class in moldb.py
PH β partial pressure array of neutral hydrogen (H) [N_layer]
PHe β partial pressure array of neutral helium (He) [N_layer]
PHH β partial pressure array of molecular hydrogen (H2) [N_layer]
R β spectral resolution
fT β function of temperature array
dit_grid_resolution β resolution of dgm
*kargs β arguments for fT
- Returns:
DIT Grid Matrix (dgm) of normalized gammaL [N_species x N_layer x N_DITgrid]
- Return type:
dgm_ngammaLS
Example
>>> fT = lambda T0,alpha: T0[:,None]*(Parr[None,:]/Pref)**alpha[:,None] >>> T0_test=np.array([3000.0,4000.0,3000.0,4000.0]) >>> alpha_test=np.array([0.2,0.2,0.05,0.05]) >>> dit_grid_resolution=0.2 >>> dgm_ngammaLS = setdgm_vald_all(asdb, PH, PHe, PHH, R, fT, dit_grid_resolution, T0_test, alpha_test)
- exojax.spec.modit.set_ditgrid_matrix_vald_each(ielem, iion, atomicmass, ionE, dev_nu_lines, logsij0, elower, eupper, gamRad, gamSta, vdWdamp, Tref, QTmask, T_gQT, gQT_284species, PH, PHe, PHH, R, fT, dit_grid_resolution, *kargs)ο
Easy Setting of DIT Grid Matrix (dgm) using VALD.
- Parameters:
ielem β atomic number (e.g., Fe=26)
iion β ionized level (e.g., neutral=1, singly ionized=2, etc.)
atomicmass β atomic mass (amu)
ionE β ionization potential (eV)
dev_nu_lines β line center (cm-1) in device
logsij0 β log line strength at T=Tref
elower β the lower state energy (cm-1)
eupper β the upper state energy (cm-1)
gamRad β log of gamma of radiation damping (s-1)
gamSta β log of gamma of Stark damping (s-1)
vdWdamp β log of (van der Waals damping constant / neutral hydrogen number) (s-1)
Tref β reference temperature
T_gQT β temperature in the grid obtained from the adb instance
gQT_284species β partition function in the grid from the adb instance
QTmask β array of index of Q(Tref) grid (gQT) for each line
PH β partial pressure array of neutral hydrogen (H) [N_layer]
PHe β partial pressure array of neutral helium (He) [N_layer]
PHH β partial pressure array of molecular hydrogen (H2) [N_layer]
R β spectral resolution
fT β function of temperature array
dit_grid_resolution β resolution of dgm
*kargs β arguments for fT
- Returns:
DIT Grid Matrix (dgm) of normalized gammaL [N_layer x N_DITgrid]
- Return type:
dgm_ngammaL
- exojax.spec.modit.setdgm_exomol(mdb, fT, Parr, R, molmass, dit_grid_resolution, *kargs)ο
- exojax.spec.modit.setdgm_hitran(mdb, fT, Parr, Pself_ref, R, molmass, dit_grid_resolution, *kargs)ο
- exojax.spec.modit.setdgm_vald_all(asdb, PH, PHe, PHH, R, fT, dit_grid_resolution, *kargs)ο
- exojax.spec.modit.setdgm_vald_each(ielem, iion, atomicmass, ionE, dev_nu_lines, logsij0, elower, eupper, gamRad, gamSta, vdWdamp, Tref, QTmask, T_gQT, gQT_284species, PH, PHe, PHH, R, fT, dit_grid_resolution, *kargs)ο
- exojax.spec.modit.vald_all(asdb, Tarr, PH, PHe, PHH, R)ο
Compute atomic line information required for MODIT for separated ALL species, using VALD separated atomic database (asdb).
- Parameters:
asdb β asdb instance made by the AdbSepVald class in moldb.py
Tarr β temperature array [N_layer]
PH β partial pressure array of neutral hydrogen (H) [N_layer]
PHe β partial pressure array of neutral helium (He) [N_layer]
PHH β partial pressure array of molecular hydrogen (H2) [N_layer]
R β spectral resolution [scalar]
- Returns:
line intensity matrix [N_species x N_layer x N_line] ngammaLMS: normalized gammaL matrix [N_species x N_layer x N_line] nsigmaDlS: normalized sigmaD matrix [N_species x N_layer x 1]
- Return type:
SijMS
- exojax.spec.modit.vald_each(Tarr, PH, PHe, PHH, R, qt_284_T, QTmask, QTref_284, ielem, iion, atomicmass, ionE, dev_nu_lines, logsij0, elower, eupper, gamRad, gamSta, vdWdamp, Tref)ο
Compute atomic line information required for MODIT for separated EACH species, using parameters attributed in VALD separated atomic database (asdb).
- Parameters:
Tarr β temperature array [N_layer]
PH β partial pressure array of neutral hydrogen (H) [N_layer]
PHe β partial pressure array of neutral helium (He) [N_layer]
PHH β partial pressure array of molecular hydrogen (H2) [N_layer]
R β spectral resolution [scalar]
qt_284_T β partition function at the temperature T Q(T), for 284 species
QTmask β array of index of Q(Tref) grid (gQT) for each line
QTref_284 β partition function at the reference temperature Q(Tref), for 284 species
ielem β atomic number (e.g., Fe=26)
iion β ionized level (e.g., neutral=1, singly ionized=2, etc.)
atomicmass β atomic mass (amu)
ionE β ionization potential (eV)
dev_nu_lines β line center (cm-1) in device
logsij0 β log line strength at T=Tref
elower β the lower state energy (cm-1)
eupper β the upper state energy (cm-1)
gamRad β log of gamma of radiation damping (s-1)
gamSta β log of gamma of Stark damping (s-1)
vdWdamp β log of (van der Waals damping constant / neutral hydrogen number) (s-1)
Tref β reference temperature
- Returns:
line intensity matrix [N_layer x N_line] ngammaLM: normalized gammaL matrix [N_layer x N_line] nsigmaDl: normalized sigmaD matrix [N_layer x 1]
- Return type:
SijM
- exojax.spec.modit.xsmatrix_open_zeroscan(cnu, indexnu, R, nsigmaDl, ngammaLM, SijM, nu_grid, dgm_ngammaL, nu_grid_extended, filter_length_oneside)ο
Cross section matrix for xsvector (MODIT/open/zeroscan)
Notes
The aliasing part is closed and thereby canβt be used in OLA. #277
- Parameters:
cnu β contribution by npgetix for wavenumber
indexnu β index by npgetix for wavenumber
R β spectral resolution
nu_lines β line center (Nlines)
nsigmaDl β normalized doppler sigma in layers in R^(Nlayer x 1)
ngammaLM β gamma factor matrix in R^(Nlayer x Nline)
SijM β line strength matrix in R^(Nlayer x Nline)
nu_grid β wavenumber grid (ESLOG)
dgm_ngammaL β DIT Grid Matrix for normalized gammaL R^(Nlayer, NDITgrid)
nu_grid_extended β extended wavenumber grid (ESLOG)
filter_length_oneside β filter length for the convolution
- Returns:
cross section matrix in R^(Nlayer x Nwav)
- exojax.spec.modit.xsmatrix_scanfft(cnu, indexnu, R, pmarray, nsigmaDl, ngammaLM, SijM, nu_grid, dgm_ngammaL)ο
Cross section matrix for xsvector (MODIT), scan+fft
Notes
This function is deprecated. Use xsmatrix_zeroscan instead. The aliasing part is closed and thereby canβt be used in OLA.
- Parameters:
cnu β contribution by npgetix for wavenumber
indexnu β index by npgetix for wavenumber
R β spectral resolution
pmarray β (+1,-1) array whose length of len(nu_grid)+1
nu_lines β line center (Nlines)
nsigmaDl β normalized doppler sigma in layers in R^(Nlayer x 1)
ngammaLM β gamma factor matrix in R^(Nlayer x Nline)
SijM β line strength matrix in R^(Nlayer x Nline)
nu_grid β linear wavenumber grid
dgm_ngammaL β DIT Grid Matrix for normalized gammaL R^(Nlayer, NDITgrid)
- Returns:
cross section matrix in R^(Nlayer x Nwav)
- exojax.spec.modit.xsmatrix_vald(cnuS, indexnuS, R, pmarray, nsigmaDlS, ngammaLMS, SijMS, nu_grid, dgm_ngammaLS)ο
Cross section matrix for xsvector (MODIT) for VALD lines (asdb)
- Parameters:
cnuS β contribution by npgetix for wavenumber [N_species x N_line]
indexnuS β index by npgetix for wavenumber [N_species x N_line]
R β spectral resolution
pmarray β (+1,-1) array whose length of len(nu_grid)+1
nsigmaDlS β normalized sigmaD matrix [N_species x N_layer x 1]
ngammaLMS β normalized gammaL matrix [N_species x N_layer x N_line]
SijMS β line intensity matrix [N_species x N_layer x N_line]
nu_grid β linear wavenumber grid
dgm_ngammaLS β DIT Grid Matrix (dgm) of normalized gammaL [N_species x N_layer x N_DITgrid]
- Returns:
cross section matrix [N_species x N_layer x N_wav]
- Return type:
xsmS
- exojax.spec.modit.xsmatrix_vald_scanfft(cnuS, indexnuS, R, pmarray, nsigmaDlS, ngammaLMS, SijMS, nu_grid, dgm_ngammaLS)ο
Cross section matrix for xsvector (MODIT) with scan+fft, for VALD lines (asdb)
- Parameters:
cnuS β contribution by npgetix for wavenumber [N_species x N_line]
indexnuS β index by npgetix for wavenumber [N_species x N_line]
R β spectral resolution
pmarray β (+1,-1) array whose length of len(nu_grid)+1
nsigmaDlS β normalized sigmaD matrix [N_species x N_layer x 1]
ngammaLMS β normalized gammaL matrix [N_species x N_layer x N_line]
SijMS β line intensity matrix [N_species x N_layer x N_line]
nu_grid β linear wavenumber grid
dgm_ngammaLS β DIT Grid Matrix (dgm) of normalized gammaL [N_species x N_layer x N_DITgrid]
- Returns:
cross section matrix [N_species x N_layer x N_wav]
- Return type:
xsmS
- exojax.spec.modit.xsmatrix_zeroscan(cnu, indexnu, R, pmarray, nsigmaDl, ngammaLM, SijM, nu_grid, dgm_ngammaL)ο
Cross section matrix for xsvector (MODIT), zeroscan
Notes
The aliasing part is closed and thereby canβt be used in OLA. #277
- Parameters:
cnu β contribution by npgetix for wavenumber
indexnu β index by npgetix for wavenumber
R β spectral resolution
pmarray β (+1,-1) array whose length of len(nu_grid)+1
nu_lines β line center (Nlines)
nsigmaDl β normalized doppler sigma in layers in R^(Nlayer x 1)
ngammaLM β gamma factor matrix in R^(Nlayer x Nline)
SijM β line strength matrix in R^(Nlayer x Nline)
nu_grid β wavenumber grid (ESLOG)
dgm_ngammaL β DIT Grid Matrix for normalized gammaL R^(Nlayer, NDITgrid)
- Returns:
cross section matrix in R^(Nlayer x Nwav)
- exojax.spec.modit.xsvector_open_zeroscan(cnu, indexnu, R, nsigmaD, ngammaL, S, nu_grid, ngammaL_grid, nu_grid_extended, filter_length_oneside)ο
Cross section vector (MODIT/open/zeroscan)
Notes
The aliasing part is closed and thereby canβt be used in OLA. #277
- Parameters:
cnu β contribution by npgetix for wavenumber
indexnu β index by npgetix for wavenumber
R β spectral resolution
nsigmaD β normaized Gaussian STD
gammaL β Lorentzian half width (Nlines)
S β line strength (Nlines)
nu_grid β wavenumber grid (ESLOG)
ngammaL_grid β normalized gammaL grid
nu_grid_extended β extended wavenumber grid (ESLOG)
filter_length_oneside β filter length for the convolution
- Returns:
Cross section in the log nu grid
- exojax.spec.modit.xsvector_scanfft(cnu, indexnu, R, pmarray, nsigmaD, ngammaL, S, nu_grid, ngammaL_grid)ο
Cross section vector (MODIT scanfft), deprecated
Notes
This function is deprecated. Use xsvector_zeroscan instead. The aliasing part is closed and thereby canβt be used in OLA.
- Parameters:
cnu β contribution by npgetix for wavenumber
indexnu β index by npgetix for wavenumber
R β spectral resolution
pmarray β (+1,-1) array whose length of len(nu_grid)+1
nsigmaD β normaized Gaussian STD
gammaL β Lorentzian half width (Nlines)
S β line strength (Nlines)
nu_grid β linear wavenumber grid
gammaL_grid β gammaL grid
- Returns:
Cross section in the log nu grid
- exojax.spec.modit.xsvector_zeroscan(cnu, indexnu, R, pmarray, nsigmaD, ngammaL, S, nu_grid, ngammaL_grid)ο
Cross section vector (MODIT/close/zeroscan)
Notes
The aliasing part is closed and thereby canβt be used in OLA. #277
- Parameters:
cnu β contribution by npgetix for wavenumber
indexnu β index by npgetix for wavenumber
R β spectral resolution
pmarray β (+1,-1) array whose length of len(nu_grid)+1
nsigmaD β normaized Gaussian STD
gammaL β Lorentzian half width (Nlines)
S β line strength (Nlines)
nu_grid β wavenumber grid (ESLOG)
gammaL_grid β gammaL grid
- Returns:
Cross section in the log nu grid
exojax.spec.moldb moduleο
Atomic database (MDB) class.
- class exojax.spec.moldb.AdbKurucz(path, nurange=[- inf, inf], margin=0.0, crit=0.0, Irwin=False, gpu_transfer=True, vmr_fraction=None)ο
Bases:
object
atomic database from Kurucz (http://kurucz.harvard.edu/linelists/)
AdbKurucz is a class for Kurucz line list.
- nurangeο
nu range [min,max] (cm-1)
- nu_linesο
line center (cm-1) (#NOT frequency in (s-1))
- Type:
nd array
- dev_nu_linesο
line center (cm-1) in device
- Type:
jnp array
- Sij0ο
line strength at T=Tref (cm)
- Type:
nd array
- logsij0ο
log line strength at T=Tref
- Type:
jnp array
- Aο
Einstein A coeeficient in (s-1)
- Type:
jnp array
- elowerο
the lower state energy (cm-1)
- Type:
jnp array
- eupperο
the upper state energy (cm-1)
- Type:
jnp array
- gupperο
(jnp array): upper statistical weight
- jlowerο
lower J (rotational quantum number, total angular momentum)
- Type:
jnp array
- jupperο
upper J
- Type:
jnp array
- QTmaskο
identifier of species for Q(T)
- Type:
jnp array
- ielemο
atomic number (e.g., Fe=26)
- Type:
jnp array
- iionο
ionized level (e.g., neutral=1, singly ionized=2, etc.)
- Type:
jnp array
- gamRadο
log of gamma of radiation damping (s-1) #(https://www.astro.uu.se/valdwiki/Vald3Format)
- Type:
jnp array
- gamStaο
log of gamma of Stark damping (s-1)
- Type:
jnp array
- vdWdampο
log of (van der Waals damping constant / neutral hydrogen number) (s-1)
- Type:
jnp array
- Atomic_gQT(atomspecies)ο
Select grid of partition function especially for the species of interest.
- Parameters:
atomspecies β species e.g., βFe 1β, βSr 2β, etc.
- Returns:
grid Q(T) for the species
- Return type:
gQT
- QT_interp(atomspecies, T)ο
interpolated partition function The partition functions of Barklem & Collet (2016) are adopted.
- Parameters:
atomspecies β species e.g., βFe 1β
T β temperature
- Returns:
interpolated in jnp.array for the Atomic Species
- Return type:
Q(T)
- QT_interp_284(T)ο
(DEPRECATED) interpolated partition function of all 284 species.
- Parameters:
T β temperature
- Returns:
interpolated in jnp.array for all 284 Atomic Species
- Return type:
Q(T)*284
- QT_interp_Irwin_Fe(T, atomspecies='Fe 1')ο
interpolated partition function This function is for the exceptional case where you want to adopt partition functions of Irwin (1981) for Fe I (Other species are not yet implemented).
- Parameters:
atomspecies β species e.g., βFe 1β
T β temperature
- Returns:
interpolated in jnp.array for the Atomic Species
- Return type:
Q(T)
- generate_jnp_arrays()ο
(re)generate jnp.arrays.
Note
We have nd arrays and jnp arrays. We usually apply the mask to nd arrays and then generate jnp array from the corresponding nd array. For instance, self._A is nd array and self.A is jnp array.
- make_QTmask(ielem, iion)ο
Convert the species identifier to the index for Q(Tref) grid (gQT) for each line.
- Parameters:
ielem β atomic number (e.g., Fe=26)
iion β ionized level (e.g., neutral=1, singly)
- Returns:
array of index of Q(Tref) grid (gQT) for each line
- Return type:
QTmask_sp
- masking(mask)ο
applying mask
- Parameters:
mask β mask to be applied. self.mask is updated.
- qr_interp(atomspecies, T)ο
interpolated partition function ratio The partition functions of Barklem & Collet (2016) are adopted.
- Parameters:
T β temperature
atomspecies β species e.g., βFe 1β
- Returns:
interpolated in jnp.array
- Return type:
qr(T)=Q(T)/Q(Tref)
- qr_interp_Irwin_Fe(T, atomspecies='Fe 1')ο
interpolated partition function ratio This function is for the exceptional case where you want to adopt partition functions of Irwin (1981) for Fe I (Other species are not yet implemented).
- Parameters:
T β temperature
atomspecies β species e.g., βFe 1β
- Returns:
interpolated in jnp.array
- Return type:
qr(T)=Q(T)/Q(Tref)
- class exojax.spec.moldb.AdbSepVald(adb)ο
Bases:
object
atomic database from VALD3 with an additional axis for separating each species (atom or ion)
AdbSepVald is a class for VALD3.
- nu_linesο
line center (cm-1) (#NOT frequency in (s-1))
- Type:
nd array
- dev_nu_linesο
line center (cm-1) in device
- Type:
jnp array
- logsij0ο
log line strength at T=Tref
- Type:
jnp array
- elowerο
the lower state energy (cm-1)
- Type:
jnp array
- eupperο
the upper state energy (cm-1)
- Type:
jnp array
- QTmaskο
identifier of species for Q(T)
- Type:
jnp array
- ielemο
atomic number (e.g., Fe=26)
- Type:
jnp array
- iionο
ionized level (e.g., neutral=1, singly ionized=2, etc.)
- Type:
jnp array
- atomicmassο
atomic mass (amu)
- Type:
jnp array
- ionEο
ionization potential (eV)
- Type:
jnp array
- gamRadο
log of gamma of radiation damping (s-1) #(https://www.astro.uu.se/valdwiki/Vald3Format)
- Type:
jnp array
- gamStaο
log of gamma of Stark damping (s-1)
- Type:
jnp array
- vdWdampο
log of (van der Waals damping constant / neutral hydrogen number) (s-1)
- Type:
jnp array
- uspeciesο
unique combinations of ielem and iion [N_species x 2(ielem and iion)]
- Type:
jnp array
- N_uspο
number of species (atoms and ions)
- Type:
int
- L_maxο
maximum number of spectral lines for a single species
- Type:
int
- gQT_284speciesο
partition function grid of 284 species
- Type:
jnp array
- T_gQTο
temperatures in the partition function grid
- Type:
jnp array
- QTref_284ο
partition function at the reference temperature Q(Tref), for 284 species
- Type:
jnp array
- class exojax.spec.moldb.AdbVald(path, nurange=[- inf, inf], margin=0.0, crit=0.0, Irwin=False, gpu_transfer=True, vmr_fraction=None, engine='vaex')ο
Bases:
object
atomic database from VALD3 (http://vald.astro.uu.se/)
AdbVald is a class for VALD3.
- nurangeο
nu range [min,max] (cm-1)
- nu_linesο
line center (cm-1) (#NOT frequency in (s-1))
- Type:
nd array
- dev_nu_linesο
line center (cm-1) in device
- Type:
jnp array
- Sij0ο
line strength at T=Tref (cm)
- Type:
nd array
- logsij0ο
log line strength at T=Tref
- Type:
jnp array
- Aο
Einstein A coeeficient in (s-1)
- Type:
jnp array
- elowerο
the lower state energy (cm-1)
- Type:
jnp array
- eupperο
the upper state energy (cm-1)
- Type:
jnp array
- gupperο
(jnp array): upper statistical weight
- jlowerο
lower J (rotational quantum number, total angular momentum)
- Type:
jnp array
- jupperο
upper J
- Type:
jnp array
- QTmaskο
identifier of species for Q(T)
- Type:
jnp array
- ielemο
atomic number (e.g., Fe=26)
- Type:
jnp array
- iionο
ionized level (e.g., neutral=1, singly ionized=2, etc.)
- Type:
jnp array
- solarAο
solar abundance (log10 of number density in the Sun)
- Type:
jnp array
- atomicmassο
atomic mass (amu)
- Type:
jnp array
- ionEο
ionization potential (eV)
- Type:
jnp array
- gamRadο
log of gamma of radiation damping (s-1) #(https://www.astro.uu.se/valdwiki/Vald3Format)
- Type:
jnp array
- gamStaο
log of gamma of Stark damping (s-1)
- Type:
jnp array
- vdWdampο
log of (van der Waals damping constant / neutral hydrogen number) (s-1)
- Type:
jnp array
- gQT_284speciesο
partition function grid of 284 species
- Type:
jnp array
- T_gQTο
temperatures in the partition function grid
- Type:
jnp array
- QTref_284ο
partition function at the reference temperature Q(Tref), for 284 species
- Type:
jnp array
- Noteο
For the first time to read the VALD line list, it is converted to HDF/vaex. After the second-time, we use the HDF5 format with vaex instead.
- Atomic_gQT(atomspecies)ο
Select grid of partition function especially for the species of interest.
- Parameters:
atomspecies β species e.g., βFe 1β, βSr 2β, etc.
- Returns:
grid Q(T) for the species
- Return type:
gQT
- QT_interp(atomspecies, T)ο
interpolated partition function The partition functions of Barklem & Collet (2016) are adopted.
- Parameters:
atomspecies β species e.g., βFe 1β
T β temperature
- Returns:
interpolated in jnp.array for the Atomic Species
- Return type:
Q(T)
- QT_interp_284(T)ο
(DEPRECATED) interpolated partition function of all 284 species.
- Parameters:
T β temperature
- Returns:
interpolated in jnp.array for all 284 Atomic Species
- Return type:
Q(T)*284
- QT_interp_Irwin_Fe(T, atomspecies='Fe 1')ο
interpolated partition function This function is for the exceptional case where you want to adopt partition functions of Irwin (1981) for Fe I (Other species are not yet implemented).
- Parameters:
atomspecies β species e.g., βFe 1β
T β temperature
- Returns:
interpolated in jnp.array for the Atomic Species
- Return type:
Q(T)
- generate_jnp_arrays()ο
(re)generate jnp.arrays.
Note
We have nd arrays and jnp arrays. We usually apply the mask to nd arrays and then generate jnp array from the corresponding nd array. For instance, self._A is nd array and self.A is jnp array.
- make_QTmask(ielem, iion)ο
Convert the species identifier to the index for Q(Tref) grid (gQT) for each line.
- Parameters:
ielem β atomic number (e.g., Fe=26)
iion β ionized level (e.g., neutral=1, singly ionized=2, etc.)
- Returns:
array of index of Q(Tref) grid (gQT) for each line
- Return type:
QTmask_sp
- masking(mask)ο
applying mask.
- Parameters:
mask β mask to be applied. self.mask is updated.
- qr_interp(atomspecies, T)ο
interpolated partition function ratio The partition functions of Barklem & Collet (2016) are adopted.
- Parameters:
T β temperature
atomspecies β species e.g., βFe 1β
- Returns:
interpolated in jnp.array
- Return type:
qr(T)=Q(T)/Q(Tref)
- qr_interp_Irwin_Fe(T, atomspecies='Fe 1')ο
interpolated partition function ratio This function is for the exceptional case where you want to adopt partition functions of Irwin (1981) for Fe I (Other species are not yet implemented).
- Parameters:
T β temperature
atomspecies β species e.g., βFe 1β
- Returns:
interpolated in jnp.array
- Return type:
qr(T)=Q(T)/Q(Tref)
exojax.spec.molinfo moduleο
- exojax.spec.molinfo.isotope_molmass(exact_molecule_name)ο
isotope molecular mass
- Parameters:
exact_molecule_name (str) β exact exomol, hitran, molecule name such as 12C-16O, (12C)(16O)
- Returns:
molecular mass g/mol
- Return type:
float or None
- exojax.spec.molinfo.mean_molmass_manual(simple_molecule_name)ο
molecular mass for major isotope given manually
- Parameters:
simple_molecule_name (_type_) β _description_
- Returns:
_description_
- Return type:
_type_
- exojax.spec.molinfo.molmass(simple_molecule_name, db_HIT=True)ο
provide molecular mass for the major isotope from the simple molecular name.
- Parameters:
molecule β molecular name e.g. CO2, He
db_HIT β if True, use the molecular mass considering the natural terrestrial abundance and mass of each isotopologue provided by HITRAN (https://hitran.org/docs/iso-meta/)
- Returns:
molecular mass
Example
>>> from exojax.spec.molinfo import molmass >>> print(molmass("H2")) >>> 2.01588 >>> print(molmass("CO2")) >>> 44.0095 >>> print(molmass("He")) >>> 4.002602 >>> print(molmass("air")) >>> 28.97
- exojax.spec.molinfo.molmass_isotope(simple_molecule_name, db_HIT=True)ο
provide molecular mass for the major isotope from the simple molecular name.
- Parameters:
molecule β molecular name e.g. CO2, He
db_HIT β if True, use the molecular mass considering the natural terrestrial abundance and mass of each isotopologue provided by HITRAN (https://hitran.org/docs/iso-meta/)
- Returns:
molecular mass
Example
>>> from exojax.spec.molinfo import molmass >>> print(molmass("H2")) >>> 2.01588 >>> print(molmass("CO2")) >>> 44.0095 >>> print(molmass("He")) >>> 4.002602 >>> print(molmass("air")) >>> 28.97
exojax.spec.multimol moduleο
- class exojax.spec.multimol.MultiMol(molmulti, dbmulti, database_root_path='.database')ο
Bases:
object
multiple molecular database and opacity calculator handler (multi Mdb/Opa Listing)
Notes
MultiMol provides an easy way to generate multiple mdb (multimdb) and multiple opa (multiopa) for multiple molecules/wavenumber segments/stitching.
- molmultiο
multiple simple molecule names [n_wavenumber_segments, n_molecules], such as [[βH2Oβ,βCOβ],[βH2Oβ],[βCOβ]]
- dbmultiο
multiple database names, such as [[βHITEMPβ,βEXOMOLβ],[βHITEMPβ,βHITRAN12β]]]
- masked_molmultiο
masked multiple simple molecule names [n_wavenumber_segments, n_molecules], such as [[βH2Oβ,βCOβ],[βH2Oβ],[False]] Note that βFalseβ is assigned when the code fails to get mdb because, for example, there are no transition lines for the specified condition.
- database_root_pathο
database root path
- db_dirsο
database directories
- mols_uniqueο
the list of the unique molecules,
- mols_numο
the same shape as self.masked_molmulti but gives indices of mols_unique
- multimdb()ο
return multiple mdb
- multiopa_premodit()ο
return multiple opa for premodit
- molmass()ο
return molecular mass list
- derive_unique_molecules()ο
derive unique molecules in masked_molmulti and set self.mols_unique and self.mols_num
Notes
self.mols_unique is the list of the unique molecules, and self.mols_num has the same shape as self.masked_molmulti but gives indices of self.mols_unique
- generate_database_directories()ο
generate database directory array
- molmass()ο
return molecular mass list and H and He
- Returns:
molecular mass list for self.mols_unique molmassH2: molecular mass for hydorogen molmassHe: molecular mass for helium
- Return type:
molmass_list
- multimdb(nu_grid_list, crit=0.0, Ttyp=1000.0)ο
select current multimols from wavenumber grid
Notes
multimdb() also generates self.masked_molmulti (masked molmulti), self.mols_unique (unique molecules), and self.mols_num (same shape as self.masked_molmulti but gives indices of self.mols_unique)
- Parameters:
nu_grid_list (list) β list of wavelength grids
crit (float, optional) β line strength criterion. Defaults to 0..
Ttyp (float, optional) β Typical temperature. Defaults to 1000..
- Returns:
multi mdb
- Return type:
lists of mdb
- multiopa_premodit(multimdb, nu_grid_list, auto_trange, nstitch_list=None, diffmode=0, dit_grid_resolution=0.2, allow_32bit=False)ο
multiple opa for PreMODIT
- Parameters:
() (nu_grid_list) β multimdb
() β wavenumber grid list
auto_trange (list) β temperature range [Tl, Tu], in which line strength is within 1 % prescision. Defaults to None.
nstitch_list (list) β The list of the number of nu-stitching segments for nu_grid_list (same structure). If None, no nu-stitching.
diffmode (int, optional) β _description_. Defaults to 0.
dit_grid_resolution (float, optional) β force to set broadening_parameter_resolution={mode:manual, value: dit_grid_resolution}), ignores broadening_parameter_resolution.
- Returns:
_description_
- Return type:
_type_
- store_single_opa(multimdb_each, nu_grid_list_seg, auto_trange, diffmode, dit_grid_resolution, allow_32bit, nstitch)ο
- exojax.spec.multimol.database_path_exomol(simple_molecule_name)ο
default ExoMol path
- Parameters:
simple_molecule_name (str) β simple molecule name βH2Oβ
- Returns:
Exomol default data path
- Return type:
str
- exojax.spec.multimol.database_path_hitemp(simple_molname)ο
default HITEMP path based on https://hitran.org/hitemp/
- Parameters:
simple_molecule_name (str) β simple molecule name βH2Oβ
- Returns:
HITEMP default data path, such as βH2O/01_HITEMP2010β for βH2Oβ
- Return type:
str
- exojax.spec.multimol.database_path_hitran12(simple_molecule_name)ο
HITRAN12 default data path
- Parameters:
simple_molecule_name (str) β simple molecule name βH2Oβ
- Returns:
HITRAN12 default data path, such as βH2O/01_hit12.parβ for βH2Oβ
- Return type:
str
- exojax.spec.multimol.database_path_sample(simple_molname)ο
default SAMPLE (emulated mdb)
- Parameters:
simple_molecule_name (str) β simple molecule name βCOβ or βH2Oβ
- Returns:
HITEMP default data path, such as βH2O/01_HITEMP2010β for βH2Oβ
- Return type:
str
exojax.spec.nonair moduleο
- exojax.spec.nonair.gamma_nonair(m, coeff)ο
non air gamma (Lorentian width at reference)
- Parameters:
m (int array) β m transition state
coeff (array) β nonair coefficient (a,b,aβ,bβ)
- Returns:
nonair Lorentian width at reference (cm-1)
- Return type:
float array
- exojax.spec.nonair.nonair_polynomial(m, a_coeff, b_coeff)ο
nonair polynomial
Notes
value = ((a0 + a1 * x + a2 * x**2 + a3 * x**3) / (1 + b1 * x + b2 * x**2 + b3 * x**3 + b4 * x**4)) where x = m
- Parameters:
m (int array) β m transition state
a_coeff (array) β nonair coefficient a
b_coeff (array) β nonair coefficient b
- Returns:
nonair value
- Return type:
float array
- exojax.spec.nonair.temperature_exponent_nonair(m, coeff)ο
non air temperature exponent
- Parameters:
m (int array) β m transition state
coeff (array) β nonair coefficient (a,b,aβ,bβ)
- Returns:
nonair tempearure exponent
- Return type:
float array
exojax.spec.opacalc moduleο
opacity calculator class
Notes
Opa does not assume any T-P structure, no fixed T, P, mmr grids.
- class exojax.spec.opacalc.OpaDirect(mdb, nu_grid, wavelength_order='descending')ο
Bases:
OpaCalc
- apply_params()ο
- xsmatrix(Tarr, Parr)ο
cross section matrix
Notes
Currently Pself is regarded to be zero for HITEMP/HITRAN
- Parameters:
() (Parr) β tempearture array in K
() β pressure array in bar
- Raises:
ValueError β _description_
- Returns:
cross section matrix (Nlayer, N_wavenumber)
- Return type:
jnp.array
- xsvector(T, P, Pself=0.0)ο
cross section vector
- Parameters:
T (float) β temperature
P (float) β pressure in bar
Pself (float, optional) β self pressure for HITEMP/HITRAN. Defaults to 0.0.
- Returns:
cross section in cm2
- Return type:
1D array
- class exojax.spec.opacalc.OpaModit(mdb, nu_grid, Tarr_list=None, Parr=None, Pself_ref=None, dit_grid_resolution=0.2, allow_32bit=False, alias='close', cutwing=1.0, wavelength_order='descending')ο
Bases:
OpaCalc
Opacity Calculator Class for MODIT
- opainfoο
information set used in MODIT: cont_nu, index_nu, R, pmarray
- apply_params()ο
- setdgm(Tarr_list, Parr, Pself_ref=None)ο
_summary_
- Parameters:
Tarr_list (1d or 2d array) β tempearture array to be tested such as [Tarr_1, Tarr_2, β¦, Tarr_n]
Parr (1d array) β pressure array in bar
Pself_ref (1d array, optional) β self pressure array in bar. Defaults to None. If None Pself = 0.0.
- Returns:
dgm (DIT grid matrix) for gammaL
- Return type:
_type_
- xsmatrix(Tarr, Parr)ο
cross section matrix
Notes
Currently Pself is regarded to be zero for HITEMP/HITRAN
- Parameters:
() (Parr) β tempearture array in K
() β pressure array in bar
- Raises:
ValueError β _description_
- Returns:
cross section matrix (Nlayer, N_wavenumber)
- Return type:
jnp.array
- xsvector(T, P, Pself=0.0)ο
cross section vector
- Parameters:
T (float) β temperature
P (float) β pressure in bar
Pself (float, optional) β self pressure for HITEMP/HITRAN. Defaults to 0.0.
- Returns:
cross section in cm2
- Return type:
1D array
- class exojax.spec.opacalc.OpaPremodit(mdb, nu_grid, diffmode=0, broadening_resolution={'mode': 'manual', 'value': 0.2}, auto_trange=None, manual_params=None, dit_grid_resolution=None, allow_32bit=False, nstitch=1, cutwing=1.0, wavelength_order='descending', version_auto_trange=2)ο
Bases:
OpaCalc
Opacity Calculator Class for PreMODIT
- opainfoο
information set used in PreMODIT
- apply_params()ο
apply the parameters to the class define self.lbd_coeff and self.opainfo
- auto_setting(Tl, Tu)ο
- broadening_parameters_setting()ο
- compute_gamma_ref_and_n_Texp()ο
convert gamma_ref to the regular formalization and noramlize it for Tref_braodening
Notes
gamma (T) = (gamma at Tref_original) * (Tref_original/Tref_broadening)**n * (T/Tref_broadening)**-n * (P/1bar)
- Parameters:
mdb (_type_) β mdb instance
- determine_broadening_parameter_resolution(broadening_parameter_resolution, dit_grid_resolution)ο
- manual_setting(dE, Tref, Twt, Tmax=None, Tmin=None)ο
setting PreMODIT parameters by manual
- Parameters:
dE (float) β E lower grid interval (cm-1)
Tref (float) β reference temperature (K)
Twt (float) β Temperature for weight (K)
Tmax (float/None) β max temperature (K) for braodening grid
Tmin (float/None) β min temperature (K) for braodening grid
- plot_broadening_parameters(figname='broadpar_grid.png', crit=300000)ο
plot broadening parameters and grids
- Parameters:
figname (str, optional) β output image file. Defaults to βbroadpar_grid.pngβ.
crit (int, optional) β sampling criterion. Defaults to 300000. when the number of lines is huge and if it exceeded ~ crit, we sample the lines to reduce the computation.
- reshape_lbd_coeff()ο
reshape lbd_coeff for stitching mode this method deletes self.lbd_coeff and creates self.lbd_coeff_reshaped self.lbd_coeff_reshaped has a dimension of (self.nstitch, diffmode+1, self.div_length, N_broadening, len(elower_grid))
- set_Tref_broadening_to_midpoint()ο
Set self.Tref_broadening using log midpoint of Tmax and Tmin
- set_nu_grid(x0, x1, unit, resolution=700000, Nx=None)ο
- xsmatrix(Tarr, Parr)ο
cross section matrix
- Parameters:
() (Parr) β tempearture array in K
() β pressure array in bar
- Raises:
ValueError β _description_
- Returns:
cross section matrix (Nlayer, N_wavenumber)
- Return type:
jnp.array
- xsvector(T, P)ο
exojax.spec.opachord moduleο
- exojax.spec.opachord.chord_geometric_matrix(height, radius_lower)ο
compute chord geometric matrix
- Parameters:
height (1D array) β (normalized) height of the layers from top atmosphere, Nlayer
radius_lower (1D array) β (normalized) radius at the lower boundary from top to bottom (R0), (Nlayer)
- Returns:
chord geometric matrix (Nlayer, Nlayer), lower triangle matrix
- Return type:
2D array
Notes
Our definitions of the radius_lower and height (and radius_top, internally defined) are as follows: n=0,1,β¦,N-1 radius_lower[N-1] = radius_btm (i.e. R0) radius_lower[n-1] = radius_lower[n] + height[n] radius_top = radius_lower[0] + height[0]
- exojax.spec.opachord.chord_geometric_matrix_lower(height, radius_lower)ο
compute chord geometric matrix
- Parameters:
height (1D array) β (normalized) height of the layers from top atmosphere, Nlayer
radius_lower (1D array) β (normalized) radius at the lower boundary from top to bottom (R0), (Nlayer)
- Returns:
chord geometric matrix (Nlayer, Nlayer), lower triangle matrix
- Return type:
2D array
Notes
Our definitions of the radius_lower and height (and radius_top, internally defined) are as follows: n=0,1,β¦,N-1 radius_lower[N-1] = radius_btm (i.e. R0) radius_lower[n-1] = radius_lower[n] + height[n]
- exojax.spec.opachord.chord_optical_depth(chord_geometric_matrix, dtau)ο
chord optical depth vector from a chord geometric matrix and dtau
- Parameters:
chord_geometric_matrix (jnp array) β chord geometric matrix (Nlayer, Nlayer), lower triangle matrix
dtau (jnp array) β layer optical depth matrix, dtau (Nlayer, N_wavenumber)
Returns: chord optical depth (tauchord) matrix (Nlayer, N_wavenumber)
exojax.spec.opacitytools moduleο
Extract tau=1 height pressure at different wavelengths
- exojax.spec.opacitytools.pressure_at_given_opacity(dtau, Parr, tauextracted=1.0)ο
Extract pressure of tau=1(or a given value) at different wavelengths
- Parameters:
dtau β delta tau for each layer [N_layer x N_nu]
Parr β pressure at each layer [N_layer]
tauextracted β the tau value at which pressure is extracted
- Returns:
[N_nu]
- Return type:
P_tauone
Note
Return 0 if tau is too optically thin and does not reach tauextracted.
exojax.spec.opacont moduleο
opacity continuum calculator class
Notes
Opa does not assume any T-P structure, no fixed T, P, mmr grids.
- class exojax.spec.opacont.OpaCIA(cdb, nu_grid)ο
Bases:
OpaCont
Opacity Continuum Calculator Class for CIA
- logacia_matrix(temperatures)ο
computes absorption coefficient matrix of CIA
- Parameters:
temperatures (array) β temperature array (K) [Nlayer]
- Returns:
logarithm of absorption coefficient [Nlayer, Nnus] in the unit of cm5
- Return type:
2D array
- logacia_vector(T)ο
computes absorption coefficient vector of CIA
- Parameters:
T (float) β temperature (K)
- Returns:
logarithm of absorption coefficient [Nnus] at T in the unit of cm5
- Return type:
1D array
- opainfoο
- class exojax.spec.opacont.OpaHminus(nu_grid)ο
Bases:
OpaCont
Opacity Continuum Calculator Class for H-
- logahminus_matrix(temperatures, number_density_e, number_density_h)ο
absorption coefficient (cm-1) matrix of H- continuum
- Parameters:
temperatures (_type_) β temperature array
number_density_e (_type_) β number density of electron in cgs
number_density_h (_type_) β number density of H in cgs
- Returns:
log10(absorption coefficient in cm-1 ) [Nlayer,Nnu]
- opainfoο
- class exojax.spec.opacont.OpaMie(pdb, nu_grid)ο
Bases:
OpaCont
- mieparams_matrix(rg_layer, sigmag_layer)ο
interpolate the Mie parameters matrix (Nlayer x Nnu) from Miegrid :param rg_layer: layer rg parameters in the lognormal distribution of condensate size, defined by (9) in AM01 :type rg_layer: 1d array :param sigmag_layer: layer sigmag parameters in the lognormal distribution of condensate size, defined by (9) in AM01 :type sigmag_layer: 1d array
Notes
AM01 = Ackerman and Marley 2001 Volume extinction coefficient (1/cm) for the number density N can be computed by beta_extinction = N*beta0_extinction/N0
- Returns:
sigma_extinction matrix, extinction cross section (cm2) = volume extinction coefficient (1/cm) normalized by the reference number density N0 omega0 matrix, single scattering albedo g matrix, asymmetric factor (mean g)
- mieparams_matrix_direct_from_pymiescatt(rg_layer, sigmag_layer)ο
compute the Mie parameters matrix (Nlayer x Nnu) from pymiescatt direclty (slow), i.e. no need of Miegrid :param rg_layer: layer rg parameters in the lognormal distribution of condensate size, defined by (9) in AM01 :type rg_layer: 1d array :param sigmag_layer: layer sigmag parameters in the lognormal distribution of condensate size, defined by (9) in AM01 :type sigmag_layer: 1d array
Notes
AM01 = Ackerman and Marley 2001 Volume extinction coefficient (1/cm) for the number density N can be computed by beta_extinction = N*beta0_extinction/N0
- Returns:
sigma_extinction matrix, extinction cross section (cm2) = volume extinction coefficient (1/cm) normalized by the reference number density N0 omega0 matrix, single scattering albedo g matrix, asymmetric factor (mean g)
- mieparams_vector(rg, sigmag)ο
interpolate the Mie parameters vector (Nnu: wavenumber direction) from Miegrid
- Parameters:
rg (float) β rg parameter in the lognormal distribution of condensate size, defined by (9) in AM01
sigmag (float) β sigmag parameter in the lognormal distribution of condensate size, defined by (9) in AM01
Notes
AM01 = Ackerman and Marley 2001 Volume extinction coefficient (1/cm) for the number density N can be computed by beta_extinction = N*beta0_extinction/N0
- Returns:
sigma_extinction, extinction cross section (cm2) = volume extinction coefficient (1/cm) normalized by the reference numbver density N0. sigma_scattering, scattering cross section (cm2) = volume extinction coefficient (1/cm) normalized by the reference numbver density N0. asymmetric factor, (mean g)
- mieparams_vector_direct_from_pymiescatt(rg, sigmag)ο
compute the Mie parameters vector (Nnu: wavenumber direction) from pymiescatt direclty (slow), i.e. no need of Miegrid, the unit is in cgs
- Parameters:
rg (float) β rg parameter in the lognormal distribution of condensate size, defined by (9) in AM01
sigmag (float) β sigmag parameter in the lognormal distribution of condensate size, defined by (9) in AM01
Notes
AM01 = Ackerman and Marley 2001 Volume extinction coefficient (1/cm) for the number density N can be computed by beta_extinction = N*beta0_extinction/N0
- Returns:
sigma_extinction, extinction cross section (cm2) = volume extinction coefficient (1/cm) normalized by the reference numbver density N0. sigma_scattering, scattering cross section (cm2) = volume extinction coefficient (1/cm) normalized by the reference numbver density N0. asymmetric factor, (mean g)
- opainfoο
- class exojax.spec.opacont.OpaRayleigh(nu_grid, molname)ο
Bases:
OpaCont
- check_ready()ο
- opainfoο
- set_auto_king_factor()ο
- set_auto_polarizability()ο
- xsvector()ο
computes cross section vector of the Rayleigh scattering
- Returns:
Rayleigh scattring cross section vector [Nnus] in cm2
- Return type:
float, array
exojax.spec.opart moduleο
- class exojax.spec.opart.OpartEmisPure(opalayer, pressure_top=1e-08, pressure_btm=100.0, nlayer=100, nstream=8)ο
Bases:
ArtCommon
- run(opalayer, layer_params, flbl)ο
- update_layer(carry_tauflux, params)ο
updates the layer opacity and flux
- Parameters:
carry_tauflux (list) β carry for the tau and flux
params (list) β layer parameters for this layer, params[0] should be temperature
- Returns:
updated carry_tauflux
- Return type:
list
- update_layerflux(temperature, tauup, taulow, flux)ο
updates the flux of the layer
- Parameters:
temperature (float) β temperature of the layer, usually params[0] is used
tauup (array) β optical depth at the upper layer [Nnus]
taulow (array) β optical depth at the lower layer [Nnus]
flux (array) β flux array to be updated
- Returns:
updated flux [Nnus]
- Return type:
array
- update_layeropacity(tauup, params)ο
updates the optical depth of the layer
Notes
up = n, low = n+1 in (44) of Paper II
- Parameters:
tauup (array) β optical depth at the upper layer [Nnus]
params β layer parameters for this layer, params[0] should be temperature
- Returns:
taulow (optical depth at the lower layer, [Nnus])
- Return type:
array
- class exojax.spec.opart.OpartEmisScat(opalayer, pressure_top=1e-08, pressure_btm=100.0, nlayer=100)ο
Bases:
ArtCommon
Opart verision of ArtEmisScat.
This class computes the outgoing emission flux of the atmosphere with scattering in the atmospheric layers. Radiative transfer scheme: flux-based two-stream method, using flux-adding treatment, Toon-type hemispheric mean approximation
- run(opalayer, layer_params, flbl)ο
- update_layer(carry_rs, params)ο
updates the layer opacity and effective reflectivity (Rphat) and source (Sphat)
- Parameters:
carry_rs (list) β carry for the Rphat and Sphat
params (list) β layer parameters for this layer
- Returns:
updated carry_rs
- Return type:
list
- class exojax.spec.opart.OpartReflectEmis(opalayer, pressure_top=1e-08, pressure_btm=100.0, nlayer=100)ο
Bases:
ArtCommon
Opart verision of ArtReflectEmis.
This class computes the outgoing flux of the atmosphere with reflection, with emission from atmospheric layers. Radiative transfer scheme: flux-based two-stream method, using flux-adding treatment, Toon-type hemispheric mean approximation
- run(opalayer, layer_params, flbl)ο
- update_layer(carry_rs, params)ο
updates the layer opacity and effective reflectivity (Rphat) and source (Sphat)
- Parameters:
carry_rs (list) β carry for the Rphat and Sphat
params (list) β layer parameters for this layer
- Returns:
updated carry_rs
- Return type:
list
- class exojax.spec.opart.OpartReflectPure(opalayer, pressure_top=1e-08, pressure_btm=100.0, nlayer=100)ο
Bases:
ArtCommon
Opart verision of ArtReflectPure.
This class computes the outgoing flux of the atmosphere with reflection, no emission from atmospheric layers nor surface. Radiative transfer scheme: flux-based two-stream method, using flux-adding treatment, Toon-type hemispheric mean approximation
- run(opalayer, layer_params, flbl)ο
- update_layer(carry_rs, params)ο
updates the layer opacity and effective reflectivity (Rphat) and source (Sphat)
- Parameters:
carry_rs (list) β carry for the Rphat and Sphat
params (list) β layer parameters for this layer
- Returns:
updated carry_rs
- Return type:
list
exojax.spec.optgrid moduleο
- exojax.spec.optgrid.optelower(mdb, nu_grid, Tmax, Pmin, accuracy=0.01, dE=100.0, isotope=1, display=False)ο
look for the value of the optimal maximum Elower
Note
The memory use of PreModit depends on the maximum Elower of mdb. This function determine the optimal maximum Elower that does not change the cross section within the accuracy.
- Parameters:
mdb (mdb) β molecular db
nu_grid (array) β wavenumber array cm-1
Tmax (float) β maximum temperature in your use (K)
Pmin (float) β minimum temperature in your use (bar)
accuracy (float, optional) β accuracy allowed. Defaults to 0.01.
dE (float, optional) β E grid to search for the optimal Elower. Defaults to 100.0.
isotope β isotope number for HITRAN/HITEMP default to 1
display (bool, optional) β if you want to compare the cross section using Eopt w/ ground truth, set True. Defaults to False.
- Returns:
optimal maximum Elower (Eopt) in cm-1
- Return type:
float
exojax.spec.pardb moduleο
Particulates Database
Cloud
Haze (in future)
- class exojax.spec.pardb.PdbCloud(condensate, nurange=None, margin=10.0, path='./.database/particulates/virga', download=True, refrind_path=None)ο
Bases:
object
- download_and_unzip()ο
Downloading virga refractive index data
Note
The download URL is written in exojax.utils.url.
- generate_miegrid(sigmagmin=1.0001, sigmagmax=4.0, Nsigmag=10, log_rg_min=- 7.0, log_rg_max=- 3.0, Nrg=40)ο
generates miegrid assuming lognormal size distribution
- Parameters:
sigmagmin (float, optional) β sigma_g minimum. Defaults to 1.0001.
sigmagmax (float, optional) β sigma_g maximum. Defaults to 4.0.
Nsigmag (int, optional) β the number of the sigmag grid. Defaults to 10.
log_rg_min (float, optional) β log r_g (cm) minimum . Defaults to -7.0.
log_rg_max (float, optional) β log r_g (cm) minimum. Defaults to -3.0.
Nrg (int, optional) β the number of the rg grid. Defaults to 40.
Note
it will take a bit long time. See src/exojax/tests/generate_pdb.py as a sample code.
- load_miegrid()ο
loads Miegrid
- Raises:
ValueError β _description_
- load_virga()ο
loads VIRGA refraction index
Notes
self.refraction_index_wavenumber is in ascending and self.refraction_index_wavelength_nm is in descending. Each component of both corresponds to that of self.refraction_index. (no need to put [::-1])
- miegrid_interpolated_values(rg, sigmag)ο
evaluates the value at rg and sigmag by interpolating miegrid
- Parameters:
rg (float) β rg parameter in lognormal distribution
sigmag (float) β sigma_g parameter in lognormal distribution
Note
beta derived here is in the unit of 1/Mm (Mega meter) for diameter multiply 1.e-8 to convert to 1/cm for radius.
- Returns:
evaluated values of miegrid, output of MieQ_lognormal Bext (1/Mm), Bsca, Babs, G, Bpr, Bback, Bratio (wavenumber, number of mieparams)
- Return type:
_type_
- mieparams_cgs_at_refraction_index_wavenumber_from_miegrid(rg, sigmag)ο
computes Mie parameters in the original refraction index wavenumber, i.e. extinction coeff, sinigle scattering albedo, asymmetric factor from miegrid
- Parameters:
rg (float) β rg parameter in lognormal distribution
sigmag (float) β sigma_g parameter in lognormal distribution
Note
Volume extinction coefficient (1/cm) for the number density N can be computed by beta_extinction = N*beta0_extinction The output returns are computed at self.refraction_index_wavenumber
- Returns:
sigma_extinction, extinction cross section (cm2) = volume extinction coefficient (1/cm) normalized by the reference numbver density N0. sigma_scattering, scattering cross section (cm2) = volume extinction coefficient (1/cm) normalized by the reference numbver density N0. g, asymmetric factor (mean g)
- reset_miegrid_for_nurange()ο
Resets wavenumber indices of miegrid, refraction_index_wavenumber, refraction_index_wavelength_nm, refraction_index :raises ValueError: _description_
- saturation_pressure(temperatures)ο
- set_condensate_substance_density()ο
sets condensate density
Note
βcondensate substance densityβ means the mass substance density of the condensate matter itself. For instance, in the room temperature, for liquid water clouds, condensate_substance_density ~ 1 g/cm3 Notice that the mass density of the condensates in the atmosphere is the different quantity.
- set_miegrid_filename(miegrid_filename=None)ο
- set_miegrid_path(miegrid_path=None)ο
- set_saturation_pressure_list()ο
exojax.spec.planck moduleο
planck functions.
The units are nu [1/cm], f [1/s], wav [cm]. In this module, the input variable is always wavenumber [cm].
nu = f/c = 1/lambda.
Recall nu B_nu = lambda B_lambda = f B_f.
B_f (erg/s/cm2/Hz) = B_nu/c (erg/s/cm2/cm-1)
- exojax.spec.planck.piB(T, nu_grid)ο
pi B_nu (Planck Function)
- Parameters:
T (float) β temperature in the unit of K
nu_grid (array) β wavenumber grid in the unit of cm-1 [Nnu]
- Returns:
pi B_nu (erg/s/cm2/cm-1) [Nnu]
Note
hcperk = hc/k in cgs, fac = 2*h*c*c*pi in cgs
- exojax.spec.planck.piBarr(Tarr, nu_grid)ο
pi B_nu (Planck Function)
- Parameters:
Tarr (array) β temperature in the unit of K [Nlayer]
nu_grid (array) β wavenumber grid in the unit of cm-1 [Nnu]
- Returns:
pi B_nu (erg/s/cm2/cm-1) [Nlayer, Nnu]
Note
hcperk = hc/k in cgs, fac = 2*h*c*c*pi in cgs
exojax.spec.premodit moduleο
Line profile computation using PremoDIT = Precomputation of LSD version of MODIT
Notes
calc_xsection_from_lsd_scanfft has been replace to calc_xsection_from_lsd_zeroscan since 2.0 #577
- exojax.spec.premodit.broadpar_getix(ngamma_ref, ngamma_ref_grid, n_Texp, n_Texp_grid)ο
get indices and contribution of broadpar
- Parameters:
ngamma_ref β normalized half-width at reference
ngamma_ref_grid β grid of normalized half-width at reference
n_Texp β temperature exponent (n_Texp, n_air, etc)
n_Texp_grid β grid of temperature exponent (n_Texp, n_air, etc)
- Returns:
multi_index_lines multi_cont_lines uidx_lines neighbor_uidx multi_index_uniqgrid number of broadpar grid
Examples
>>> multi_index_lines, multi_cont_lines, uidx_lines, neighbor_uidx, multi_index_uniqgrid, Ng = broadpar_getix( >>> ngamma_ref, ngamma_ref_grid, n_Texp, n_Texp_grid) >>> iline_interest = 1 # we wanna investiget this line >>> print(multi_index_lines[iline_interest]) # multi index from a line >>> print(multi_cont_lines[iline_interest]) # multi contribution from a line >>> print(uidx_lines[iline_interest]) # uniq index of a line >>> print(multi_index_uniqgrid[uniq_index]) # multi index from uniq_index >>> ui,uj,uk=neighbor_uidx[uniq_index, :] # neighbour uniq index
- exojax.spec.premodit.check_multi_index_uniqgrid_shape(ngamma_ref_grid, n_Texp_grid, multi_index_uniqgrid)ο
checks the shape of multi_index_uniqgrid. See #586
- Parameters:
ngamma_ref_grid (array) β normalized half-width at reference grid
n_Texp_grid (array) β temperature exponent grid
multi_index_uniqgrid (array) β multi index of unique broadening parameter grid [nbroad,2]
- Returns:
0=pass, 1=ngamma_ref_grid error, 2=n_Texp_grid error
- Return type:
status (int)
- exojax.spec.premodit.compute_dElower(T, interval_contrast=0.1)ο
compute a grid interval of Elower given the grid interval of line strength
- Parameters:
T β temperature in Kelvin
interval_contrast β putting c = grid_interval_line_strength, then, the contrast of line strength between the upper and lower of the grid becomes c-order of magnitude.
- Returns:
Required dElower
- exojax.spec.premodit.convert_to_jnplog(lbd_nth)ο
compute log and convert to jnp
Notes
This function is used to avoid an overflow when using FP32 in JAX
- Parameters:
lbd_nth (ndarray) β n-th coefficient (non-log) LBD
- Returns:
log form of n-th coefficient LBD
- Return type:
jnp.array
- exojax.spec.premodit.error_diagnositcs(status, multi_index_uniqgrid, val, val_grid)ο
- exojax.spec.premodit.g_bias(nu_in, T, Tref)ο
- Parameters:
nu_in β wavenumber in cm-1
T β temperature for unbiasing in Kelvin
Tref β reference temperature in Kelvin
- Returns:
bias g function
- exojax.spec.premodit.generate_lbd(line_strength_ref, nu_lines, nu_grid, ngamma_ref, ngamma_ref_grid, n_Texp, n_Texp_grid, elower, elower_grid, Twt, Tref=296.0, diffmode=0)ο
generate log-biased line shape density (LBD)
- Parameters:
line_strength_ref β line strength at reference temperature 296K, Sij0
nu_lines (_type_) β _description_
nu_grid (_type_) β _description_
ngamma_ref (_type_) β _description_
ngamma_ref_grid (_type_) β normalized gamma at reference grid
n_Texp (_type_) β
n_Texp_grid (_type_) β normalized temperature exponent grid
elower (_type_) β _description_
elower_grid (_type_) β _description_
Twt β temperature used for the weight coefficient computation
Tref β reference temperature in Kelvin, default is 296.0 K
diffmode (int) β i-th Taylor expansion is used for the weight, default is 1.
Notes
When len(ngamma_ref_grid) = 1 and len(n_Texp_grid) = 1, the single broadening parameter mode is applied.
- Returns:
the list of the n-th coeffs of line shape density (LBD) jnp.array: multi_index_uniqgrid (number of unique broadpar, 2)
- Return type:
[jnp array]
Examples
>>> lbd_coeff, multi_index_uniqgrid = generate_lbd(mdb.Sij0, mdb.nu_lines, nu_grid, ngamma_ref, >>> ngamma_ref_grid, mdb.n_Texp, n_Texp_grid, mdb.elower, >>> elower_grid, Twp) >>> ngamma_ref = ngamma_ref_grid[multi_index_uniqgrid[:,0]] # ngamma ref for the unique broad par >>> n_Texp = n_Texp_grid[multi_index_uniqgrid[:,0]] # temperature exponent for the unique broad par
- exojax.spec.premodit.logf_bias(elower_in, T, Tref)ο
logarithm f bias function
- Parameters:
elower_in β Elower in cm-1
T β temperature for unbiasing in Kelvin
Tref β reference temperature in Kelvin
- Returns:
logarithm of bias f function
- exojax.spec.premodit.make_broadpar_grid(ngamma_ref, n_Texp, Tmax, Tmin, Tref_broadening, dit_grid_resolution=0.2, twod_factor=1.3333333333333333, adopt=True)ο
make grids of normalized half-width at reference and temperature exoponent
- Parameters:
ngamma_ref (nd array) β n_Texp: temperature exponent (n_Texp, n_air, etc)
n_Texp (nd array) β temperature exponent (n_Texp, n_air, etc)
Tmax β maximum temperature in Kelvin (NOT weight temperature)
Tmin β minimum temperature in Kelvin (NOT weight temperature)
Tref_broadening β reference temperature for broadening in Kelvin
dit_grid_resolution (float, optional) β DIT grid resolution. Defaults to 0.2.
twod_factor β conversion factor of the grid resolution from 1D to 2D. default 3.0/4.0. See Issue #366.
adopt (bool, optional) β if True, min, max grid points are used at min and max values of x. In this case, the grid width does not need to be dit_grid_resolution exactly. Defaults to True.
- Returns:
ngamma_ref_grid, grid of normalized half-width at reference nd array: n_Texp_grid, grid of temperature exponent (n_Texp, n_air, etc)
- Return type:
nd array
- exojax.spec.premodit.make_elower_grid(elower, dE)ο
compute E_lower grid given dE or interval_contrast of line strength
- Parameters:
elower β E_lower
dE β elower interval in cm-1
- Returns:
grid of E_lower given interval_contrast
- exojax.spec.premodit.parallel_merge_grids(grid1, grid2)ο
Merge two different grids into one grid in parallel, in a C-contiguous RAM mapping.
- Parameters:
grid1 β grid 1
grid2 β grid 2
- Returns:
merged grid (len(grid1),2)
- exojax.spec.premodit.reference_temperature_broadening_at_midpoint(Tmin, Tmax)ο
compute Tref_broadening at the logarithmic midpoint of Tmin and Tmax
- Parameters:
Tmin (float) β minimum temperature
Tmax (float) β maximum temperature
- Returns:
Tref_broadening at the logarithmic midpoint of Tmin and Tmax
- Return type:
float
- exojax.spec.premodit.unbiased_lsd_first(lbd_coeff, T, Tref, Twt, nu_grid, elower_grid, qt)ο
unbias the biased LSD, first order
- Parameters:
lbd_coeff β the zeroth/first coeff of log-biased line shape density (LBD)
T β temperature for unbiasing in Kelvin
Tref β reference temperature in Kelvin
Twt β Temperature at the weight point
nu_grid β wavenumber grid in cm-1
elower_grid β Elower grid in cm-1
qt β partition function ratio Q(T)/Q(Tref)
- Returns:
LSD, shape = (number_of_wavenumber_bin, number_of_broadening_parameters)
- exojax.spec.premodit.unbiased_lsd_second(lbd_coeff, T, Tref, Twt, nu_grid, elower_grid, qt)ο
unbias the biased LSD, second order
- Parameters:
lbd_coeff β the zeroth/first/second coeff of log-biased line shape density (LBD)
T β temperature for unbiasing in Kelvin
Tref β reference temperature in Kelvin
Twt β Temperature at the weight point
nu_grid β wavenumber grid in cm-1
elower_grid β Elower grid in cm-1
qt β partition function ratio Q(T)/Q(Tref)
- Returns:
LSD, shape = (number_of_wavenumber_bin, number_of_broadening_parameters)
- exojax.spec.premodit.unbiased_lsd_zeroth(lbd_zeroth, T, Tref, nu_grid, elower_grid, qt)ο
unbias the biased LSD
- Parameters:
lbd_zeroth β the zeroth coeff of log-biased line shape density (LBD)
T β temperature for unbiasing in Kelvin
Tref β reference temperature in Kelvin
nu_grid β wavenumber grid in cm-1
elower_grid β Elower grid in cm-1
qt β partition function ratio Q(T)/Q(Tref)
- Returns:
LSD (0th), shape = (number_of_wavenumber_bin, number_of_broadening_parameters)
- exojax.spec.premodit.unbiased_ngamma_grid(T, P, ngamma_ref_grid, n_Texp_grid, multi_index_uniqgrid, Tref_broadening)ο
compute unbiased ngamma grid
- Parameters:
T β temperature in Kelvin
P β pressure in bar
ngamma_ref_grid β pressure broadening half width at Tref_broadening
n_Texp_grid β temperature exponent at reference
multi_index_uniqgrid β multi index of unique broadening parameter
Tref_broadening β reference temperature in Kelvin for broadening
- Returns:
pressure broadening half width at temperature T and pressure P
Notes
It should be noted that the gamma is not affected by changing Tref.
- exojax.spec.premodit.xsmatrix_first(Tarr, Parr, Tref, R, pmarray, lbd_coeff, nu_grid, ngamma_ref_grid, n_Texp_grid, multi_index_uniqgrid, elower_grid, Mmol, qtarr, Tref_broadening, Twt)ο
compute cross section matrix given atmospheric layers, for diffmode=1, with scan+fft
- Parameters:
Tarr (_type_) β temperature layers
Parr (_type_) β pressure layers
Tref β reference temperature in K
R (float) β spectral resolution
pmarray (_type_) β pmarray
lbd_coeff (_type_) β LBD coefficient
nu_grid (_type_) β wavenumber grid
ngamma_ref_grid (_type_) β normalized half-width grid
n_Texp_grid (_type_) β temperature exponent grid
multi_index_uniqgrid (_type_) β multi index for uniq broadpar grid
elower_grid (_type_) β Elower grid
Mmol (_type_) β molecular mass
qtarr (_type_) β partition function ratio layers
Tref_broadening β reference temperature for broadening in Kelvin
Twt β weight temperature in K
- Returns:
cross section matrix (Nlayer, N_wavenumber)
- Return type:
jnp.array
- exojax.spec.premodit.xsmatrix_nu_open_first(Tarr, Parr, Tref, R, lbd_coeff, nu_grid, ngamma_ref_grid, n_Texp_grid, multi_index_uniqgrid, elower_grid, Mmol, qtarr, Tref_broadening, filter_length_oneside, Twt)ο
compute nu sigma (wavenumber x cross section) matrix, with scan+fft, using the first Taylor expansion
- Parameters:
Tarr (array) β temperature layers
Parr (array) β pressure layers
Tref β reference temperature in K
R (float) β spectral resolution
lbd_coeff (arrau) β
nu_grid (array) β wavenumber grid
ngamma_ref_grid (array) β normalized half-width grid
n_Texp_grid (array) β temperature exponent grid
multi_index_uniqgrid (array) β multi index for uniq broadpar grid
elower_grid (array) β Elower grid
Mmol (float) β molecular mass
qtarr (array) β partition function ratio layers
Tref_broadening β reference temperature for broadening in Kelvin
nu_grid_extended β extended wavenumber grid to aliasing parts
filter_length_oneside β one side length of the wavenumber grid of lpffilter
Twt β temperature used in the weight point
- Returns:
nu sigma (nu_grid_extended x cross section) in cgs matrix
- Return type:
jnp.array
- exojax.spec.premodit.xsmatrix_nu_open_second(Tarr, Parr, Tref, R, lbd_coeff, nu_grid, ngamma_ref_grid, n_Texp_grid, multi_index_uniqgrid, elower_grid, Mmol, qtarr, Tref_broadening, filter_length_oneside, Twt)ο
compute nu sigma (wavenumber x cross section) matrix, with scan+fft, using the second Taylor expansion
- Parameters:
Tarr (array) β temperature layers
Parr (array) β pressure layers
Tref β reference temperature in K
R (float) β spectral resolution
lbd_coeff (arrau) β
nu_grid (array) β wavenumber grid
ngamma_ref_grid (array) β normalized half-width grid
n_Texp_grid (array) β temperature exponent grid
multi_index_uniqgrid (array) β multi index for uniq broadpar grid
elower_grid (array) β Elower grid
Mmol (float) β molecular mass
qtarr (array) β partition function ratio layers
Tref_broadening β reference temperature for broadening in Kelvin
nu_grid_extended β extended wavenumber grid to aliasing parts
filter_length_oneside β one side length of the wavenumber grid of lpffilter
Twt β temperature used in the weight point
- Returns:
nu sigma (nu_grid_extended x cross section) in cgs matrix
- Return type:
jnp.array
- exojax.spec.premodit.xsmatrix_nu_open_zeroth(Tarr, Parr, Tref, R, lbd_coeff, nu_grid, ngamma_ref_grid, n_Texp_grid, multi_index_uniqgrid, elower_grid, Mmol, qtarr, Tref_broadening, filter_length_oneside, Twt=None)ο
compute nu sigma (wavenumber x cross section) matrix, with scan+fft, using the zero-th Taylor expansion
- Parameters:
Tarr (array) β temperature layers
Parr (array) β pressure layers
Tref β reference temperature in K
R (float) β spectral resolution
lbd_coeff (arrau) β
nu_grid (array) β wavenumber grid
ngamma_ref_grid (array) β normalized half-width grid
n_Texp_grid (array) β temperature exponent grid
multi_index_uniqgrid (array) β multi index for uniq broadpar grid
elower_grid (array) β Elower grid
Mmol (float) β molecular mass
qtarr (array) β partition function ratio layers
Tref_broadening β reference temperature for broadening in Kelvin
nu_grid_extended β extended wavenumber grid to aliasing parts
filter_length_oneside β one side length of the wavenumber grid of lpffilter
Twt β not used
- Returns:
nu sigma (nu_grid_extended x cross section) in cgs matrix
- Return type:
jnp.array
- exojax.spec.premodit.xsmatrix_open_first(Tarr, Parr, Tref, R, lbd_coeff, nu_grid, ngamma_ref_grid, n_Texp_grid, multi_index_uniqgrid, elower_grid, Mmol, qtarr, Tref_broadening, nu_grid_extended, filter_length_oneside, Twt)ο
compute open cross section matrix given atmospheric layers, for diffmode=1, with scan+fft
- Parameters:
Tarr (_type_) β temperature layers
Parr (_type_) β pressure layers
Tref β reference temperature in K
R (float) β spectral resolution
lbd_coeff (_type_) β LBD coefficient
nu_grid (_type_) β wavenumber grid
ngamma_ref_grid (_type_) β normalized half-width grid
n_Texp_grid (_type_) β temperature exponent grid
multi_index_uniqgrid (_type_) β multi index for uniq broadpar grid
elower_grid (_type_) β Elower grid
Mmol (_type_) β molecular mass
qtarr (_type_) β partition function ratio layers
Tref_broadening β reference temperature for broadening in Kelvin
nu_grid_extended β extended wavenumber grid to aliasing parts
filter_length_oneside β one side length of the wavenumber grid of lpffilter
Twt β weight temperature in K
- Returns:
cross section matrix (Nlayer, N_wavenumber)
- Return type:
jnp.array
- exojax.spec.premodit.xsmatrix_open_second(Tarr, Parr, Tref, R, lbd_coeff, nu_grid, ngamma_ref_grid, n_Texp_grid, multi_index_uniqgrid, elower_grid, Mmol, qtarr, Tref_broadening, nu_grid_extended, filter_length_oneside, Twt)ο
compute open cross section matrix given atmospheric layers, for diffmode=1, with scan+fft
- Parameters:
Tarr (_type_) β temperature layers
Parr (_type_) β pressure layers
Tref β reference temperature in K
R (float) β spectral resolution
pmarray (_type_) β pmarray
lbd_coeff (_type_) β LBD coefficient
nu_grid (_type_) β wavenumber grid
ngamma_ref_grid (_type_) β normalized half-width grid
n_Texp_grid (_type_) β temperature exponent grid
multi_index_uniqgrid (_type_) β multi index for uniq broadpar grid
elower_grid (_type_) β Elower grid
Mmol (_type_) β molecular mass
qtarr (_type_) β partition function ratio layers
Tref_broadening β reference temperature for broadening in Kelvin
nu_grid_extended β extended wavenumber grid to aliasing parts
filter_length_oneside β one side length of the wavenumber grid of lpffilter
Twt β weight temperature in K
- Returns:
cross section matrix (Nlayer, N_wavenumber)
- Return type:
jnp.array
- exojax.spec.premodit.xsmatrix_open_zeroth(Tarr, Parr, Tref, R, lbd_coeff, nu_grid, ngamma_ref_grid, n_Texp_grid, multi_index_uniqgrid, elower_grid, Mmol, qtarr, Tref_broadening, nu_grid_extended, filter_length_oneside, Twt=None)ο
compute open cross section matrix given atmospheric layers, for diffmode=0, with scan+fft
- Parameters:
Tarr (array) β temperature layers
Parr (array) β pressure layers
Tref β reference temperature in K
R (float) β spectral resolution
lbd_coeff (arrau) β
nu_grid (array) β wavenumber grid
ngamma_ref_grid (array) β normalized half-width grid
n_Texp_grid (array) β temperature exponent grid
multi_index_uniqgrid (array) β multi index for uniq broadpar grid
elower_grid (array) β Elower grid
Mmol (float) β molecular mass
qtarr (array) β partition function ratio layers
Tref_broadening β reference temperature for broadening in Kelvin
nu_grid_extended β extended wavenumber grid to aliasing parts
filter_length_oneside β one side length of the wavenumber grid of lpffilter
Twt β not used
- Returns:
cross section matrix (Nlayer, N_wavenumber)
- Return type:
jnp.array
- exojax.spec.premodit.xsmatrix_second(Tarr, Parr, Tref, R, pmarray, lbd_coeff, nu_grid, ngamma_ref_grid, n_Texp_grid, multi_index_uniqgrid, elower_grid, Mmol, qtarr, Tref_broadening, Twt)ο
compute cross section matrix given atmospheric layers, for diffmode=1, with scan+fft
- Parameters:
Tarr (_type_) β temperature layers
Parr (_type_) β pressure layers
Tref β reference temperature in K
R (float) β spectral resolution
pmarray (_type_) β pmarray
lbd_coeff (_type_) β LBD coefficient
nu_grid (_type_) β wavenumber grid
ngamma_ref_grid (_type_) β normalized half-width grid
n_Texp_grid (_type_) β temperature exponent grid
multi_index_uniqgrid (_type_) β multi index for uniq broadpar grid
elower_grid (_type_) β Elower grid
Mmol (_type_) β molecular mass
qtarr (_type_) β partition function ratio layers
Tref_broadening β reference temperature for broadening in Kelvin
Twt β weight temperature in K
- Returns:
cross section matrix (Nlayer, N_wavenumber)
- Return type:
jnp.array
- exojax.spec.premodit.xsmatrix_zeroth(Tarr, Parr, Tref, R, pmarray, lbd_coeff, nu_grid, ngamma_ref_grid, n_Texp_grid, multi_index_uniqgrid, elower_grid, Mmol, qtarr, Tref_broadening, Twt=None)ο
compute cross section matrix given atmospheric layers, for diffmode=0, with scan+fft
- Parameters:
Tarr (_type_) β temperature layers
Parr (_type_) β pressure layers
Tref β reference temperature in K
R (float) β spectral resolution
pmarray (_type_) β pmarray
lbd_coeff (_type_) β
nu_grid (_type_) β wavenumber grid
ngamma_ref_grid (_type_) β normalized half-width grid
n_Texp_grid (_type_) β temperature exponent grid
multi_index_uniqgrid (_type_) β multi index for uniq broadpar grid
elower_grid (_type_) β Elower grid
Mmol (_type_) β molecular mass
qtarr (_type_) β partition function ratio layers
Tref_broadening β reference temperature for broadening in Kelvin
Twt β not used
- Returns:
cross section matrix (Nlayer, N_wavenumber)
- Return type:
jnp.array
- exojax.spec.premodit.xsvector_first(T, P, nsigmaD, lbd_coeff, Tref, R, pmarray, nu_grid, elower_grid, multi_index_uniqgrid, ngamma_ref_grid, n_Texp_grid, qt, Tref_broadening, Twt)ο
compute cross section vector, with scan+fft, using the first Taylor expansion
- Parameters:
T (_type_) β temperature in Kelvin
P (_type_) β pressure in bar
nsigmaD β normalized doplar STD
lbd_zeroth (_type_) β log biased line shape density (LBD), zeroth coefficient
lbd_first (_type_) β log biased line shape density (LBD), first coefficient
Tref β reference temperature used to compute lbd_zeroth and lbd_first in Kelvin
R (_type_) β spectral resolution
pmarray (_type_) β (+1,-1) array whose length of len(nu_grid)+1
nu_grid (_type_) β wavenumber grid
elower_grid (_type_) β E lower grid
multi_index_uniqgrid (_type_) β multi index of unique broadening parameter grid
ngamma_ref_grid (_type_) β normalized pressure broadening half-width
n_Texp_grid (_type_) β temperature exponent grid
qt (_type_) β partirion function ratio
Tref_broadening β reference temperature for broadening in Kelvin
Twt β temperature used in the weight point
- Returns:
cross section in cgs vector
- Return type:
jnp.array
- exojax.spec.premodit.xsvector_nu_open_first(T, P, nsigmaD, lbd_coeff, Tref, R, nu_grid, elower_grid, multi_index_uniqgrid, ngamma_ref_grid, n_Texp_grid, qt, Tref_broadening, filter_length_oneside, Twt)ο
compute nu sigma (wavenumber x cross section) vector, with scan+fft, using the first Taylor expansion
- Parameters:
T (_type_) β temperature in Kelvin
P (_type_) β pressure in bar
nsigmaD β normalized doplar STD
lbd_coeff (_type_) β log biased line shape density (LBD) coefficient
Tref β reference temperature used to compute lbd_zeroth in Kelvin
R (_type_) β spectral resolution
nu_grid (_type_) β wavenumber grid
elower_grid (_type_) β E lower grid
multi_index_uniqgrid (_type_) β multi index of unique broadening parameter grid
ngamma_ref_grid (_type_) β normalized pressure broadening half-width
n_Texp_grid (_type_) β temperature exponent grid
qt (_type_) β partirion function ratio
Tref_broadening β reference temperature for broadening in Kelvin
filter_length_oneside β one side length of the wavenumber grid of lpffilter
Twt β temperature used in the weight point
- Returns:
nu sigma (nu_grid_extended x cross section) in cgs vector
- Return type:
jnp.array
- exojax.spec.premodit.xsvector_nu_open_second(T, P, nsigmaD, lbd_coeff, Tref, R, nu_grid, elower_grid, multi_index_uniqgrid, ngamma_ref_grid, n_Texp_grid, qt, Tref_broadening, filter_length_oneside, Twt)ο
compute nu sigma (wavenumber x cross section) vector, with scan+fft, using the second Taylor expansion
- Parameters:
T (_type_) β temperature in Kelvin
P (_type_) β pressure in bar
nsigmaD β normalized doplar STD
lbd_coeff (_type_) β log biased line shape density (LBD) coefficient
Tref β reference temperature used to compute lbd_zeroth in Kelvin
R (_type_) β spectral resolution
nu_grid (_type_) β wavenumber grid
elower_grid (_type_) β E lower grid
multi_index_uniqgrid (_type_) β multi index of unique broadening parameter grid
ngamma_ref_grid (_type_) β normalized pressure broadening half-width
n_Texp_grid (_type_) β temperature exponent grid
qt (_type_) β partirion function ratio
Tref_broadening β reference temperature for broadening in Kelvin
filter_length_oneside β one side length of the wavenumber grid of lpffilter
Twt β temperature used in the weight point
- Returns:
nu sigma (nu_grid_extended x cross section) in cgs vector
- Return type:
jnp.array
- exojax.spec.premodit.xsvector_nu_open_zeroth(T, P, nsigmaD, lbd_coeff, Tref, R, nu_grid, elower_grid, multi_index_uniqgrid, ngamma_ref_grid, n_Texp_grid, qt, Tref_broadening, filter_length_oneside, Twt=None)ο
compute nu sigma (wavenumber x cross section) vector, with scan+fft, using the zero-th Taylor expansion
- Parameters:
T (_type_) β temperature in Kelvin
P (_type_) β pressure in bar
nsigmaD β normalized doplar STD
lbd_coeff (_type_) β log biased line shape density (LBD) coefficient
Tref β reference temperature used to compute lbd_zeroth in Kelvin
R (_type_) β spectral resolution
nu_grid (_type_) β wavenumber grid
elower_grid (_type_) β E lower grid
multi_index_uniqgrid (_type_) β multi index of unique broadening parameter grid
ngamma_ref_grid (_type_) β normalized pressure broadening half-width
n_Texp_grid (_type_) β temperature exponent grid
qt (_type_) β partirion function ratio
Tref_broadening β reference temperature for broadening in Kelvin
filter_length_oneside β one side length of the wavenumber grid of lpffilter
Twt β not used
- Returns:
nu sigma (nu_grid_extended x cross section) in cgs vector
- Return type:
jnp.array
- exojax.spec.premodit.xsvector_open_first(T, P, nsigmaD, lbd_coeff, Tref, R, nu_grid, elower_grid, multi_index_uniqgrid, ngamma_ref_grid, n_Texp_grid, qt, Tref_broadening, nu_grid_extended, filter_length_oneside, Twt)ο
compute cross section vector, with scan+fft, using the first Taylor expansion
- Parameters:
T (_type_) β temperature in Kelvin
P (_type_) β pressure in bar
nsigmaD β normalized doplar STD
lbd_zeroth (_type_) β log biased line shape density (LBD), zeroth coefficient
lbd_first (_type_) β log biased line shape density (LBD), first coefficient
Tref β reference temperature used to compute lbd_zeroth and lbd_first in Kelvin
R (_type_) β spectral resolution
nu_grid (_type_) β wavenumber grid
elower_grid (_type_) β E lower grid
multi_index_uniqgrid (_type_) β multi index of unique broadening parameter grid
ngamma_ref_grid (_type_) β normalized pressure broadening half-width
n_Texp_grid (_type_) β temperature exponent grid
qt (_type_) β partirion function ratio
Tref_broadening β reference temperature for broadening in Kelvin
nu_grid_extended β extended wavenumber grid to aliasing parts
filter_length_oneside β one side length of the wavenumber grid of lpffilter
Twt β temperature used in the weight point
- Returns:
cross section in cgs vector
- Return type:
jnp.array
- exojax.spec.premodit.xsvector_open_second(T, P, nsigmaD, lbd_coeff, Tref, R, nu_grid, elower_grid, multi_index_uniqgrid, ngamma_ref_grid, n_Texp_grid, qt, Tref_broadening, nu_grid_extended, filter_length_oneside, Twt)ο
compute open cross section vector, with scan+fft, using the second Taylor expansion
- Parameters:
T (_type_) β temperature in Kelvin
P (_type_) β pressure in bar
nsigmaD β normalized doplar STD
lbd_coeff (_type_) β log biased line shape density (LBD), coefficient
Tref β reference temperature used to compute lbd_zeroth and lbd_first in Kelvin
R (_type_) β spectral resolution
nu_grid (_type_) β wavenumber grid
elower_grid (_type_) β E lower grid
multi_index_uniqgrid (_type_) β multi index of unique broadening parameter grid
ngamma_ref_grid (_type_) β normalized pressure broadening half-width
n_Texp_grid (_type_) β temperature exponent grid
qt (_type_) β partirion function ratio
Tref_broadening β reference temperature for broadening in Kelvin
nu_grid_extended β extended wavenumber grid to aliasing parts
filter_length_oneside β one side length of the wavenumber grid of lpffilter
Twt β temperature used in the weight point
- Returns:
cross section in cgs vector
- Return type:
jnp.array
- exojax.spec.premodit.xsvector_open_zeroth(T, P, nsigmaD, lbd_coeff, Tref, R, nu_grid, elower_grid, multi_index_uniqgrid, ngamma_ref_grid, n_Texp_grid, qt, Tref_broadening, nu_grid_extended, filter_length_oneside, Twt=None)ο
compute cross section vector, with scan+fft, using the zero-th Taylor expansion
- Parameters:
T (_type_) β temperature in Kelvin
P (_type_) β pressure in bar
nsigmaD β normalized doplar STD
lbd_coeff (_type_) β log biased line shape density (LBD) coefficient
Tref β reference temperature used to compute lbd_zeroth in Kelvin
R (_type_) β spectral resolution
nu_grid (_type_) β wavenumber grid
elower_grid (_type_) β E lower grid
multi_index_uniqgrid (_type_) β multi index of unique broadening parameter grid
ngamma_ref_grid (_type_) β normalized pressure broadening half-width
n_Texp_grid (_type_) β temperature exponent grid
qt (_type_) β partirion function ratio
Tref_broadening β reference temperature for broadening in Kelvin
nu_grid_extended β extended wavenumber grid to aliasing parts
filter_length_oneside β one side length of the wavenumber grid of lpffilter
Twt β not used
- Returns:
cross section in cgs vector
- Return type:
jnp.array
- exojax.spec.premodit.xsvector_second(T, P, nsigmaD, lbd_coeff, Tref, R, pmarray, nu_grid, elower_grid, multi_index_uniqgrid, ngamma_ref_grid, n_Texp_grid, qt, Tref_broadening, Twt)ο
compute cross section vector, with scan+fft, using the second Taylor expansion
- Parameters:
T (_type_) β temperature in Kelvin
P (_type_) β pressure in bar
nsigmaD β normalized doplar STD
lbd_coeff (_type_) β log biased line shape density (LBD), coefficient
Tref β reference temperature used to compute lbd_zeroth and lbd_first in Kelvin
R (_type_) β spectral resolution
pmarray (_type_) β (+1,-1) array whose length of len(nu_grid)+1
nu_grid (_type_) β wavenumber grid
elower_grid (_type_) β E lower grid
multi_index_uniqgrid (_type_) β multi index of unique broadening parameter grid
ngamma_ref_grid (_type_) β normalized pressure broadening half-width
n_Texp_grid (_type_) β temperature exponent grid
qt (_type_) β partirion function ratio
Tref_broadening β reference temperature for broadening in Kelvin
Twt β temperature used in the weight point
- Returns:
cross section in cgs vector
- Return type:
jnp.array
- exojax.spec.premodit.xsvector_zeroth(T, P, nsigmaD, lbd_coeff, Tref, R, pmarray, nu_grid, elower_grid, multi_index_uniqgrid, ngamma_ref_grid, n_Texp_grid, qt, Tref_broadening, Twt=None)ο
compute cross section vector, with scan+fft, using the zero-th Taylor expansion
- Parameters:
T (_type_) β temperature in Kelvin
P (_type_) β pressure in bar
nsigmaD β normalized doplar STD
lbd_coeff (_type_) β log biased line shape density (LBD) coefficient
Tref β reference temperature used to compute lbd_zeroth in Kelvin
R (_type_) β spectral resolution
pmarray β (+1,-1) array whose length of len(nu_grid)+1
nu_grid (_type_) β wavenumber grid
elower_grid (_type_) β E lower grid
multi_index_uniqgrid (_type_) β multi index of unique broadening parameter grid
ngamma_ref_grid (_type_) β normalized pressure broadening half-width
n_Texp_grid (_type_) β temperature exponent grid
qt (_type_) β partirion function ratio
Tref_broadening β reference temperature for broadening in Kelvin
Twt β not used
- Returns:
cross section in cgs vector
- Return type:
jnp.array
exojax.spec.profconv moduleο
line profile convolution with LSD
calc_open_xsection_from_lsd_zeroscan: compute open cross section from LSD in MODIT algorithm using scan+fft to avoid 4GB memory limit in fft and zero padding in scan
calc_xsection_from_lsd_zeroscan: compute cross section from LSD in MODIT algorithm using scan+fft to avoid 4GB memory limit in fft and zero padding in scan
calc_xsection_from_lsd_scanfft: compute cross section from LSD in MODIT algorithm using scan+fft to avoid 4GB memory limit in fft (see #277), deprecated
- exojax.spec.profconv.calc_open_nu_xsection_from_lsd_zeroscan(Slsd, R, nsigmaD, log_ngammaL_grid, filter_length_oneside)ο
Compute (wavenumber x open cross section9 from LSD in MODIT algorithm using scan+fft to avoid 4GB memory limit in fft and zero padding in scan
Notes
The aliasing part is closed and thereby canβt be used in OLA. #277 Why the output is not cross section, but (nu_grid_extended x Cross section)? This is related to the scan in OpaPremoditStitch. I (@HajimeKawahara) did not want to use wavenumber_grid_extended in the scan in OpaPremoditStitch.xsvector/xsmatrix 2/28 2025
- Parameters:
Slsd (array) β line shape density [Nnus, Ngamma]
R (float) β spectral resolution
nsigmaD (float) β normaized Gaussian STD
log_gammaL_grid (array) β logarithm of gammaL grid [Ngamma]
filter_length_oneside (int) β one side length of the wavenumber grid of lpffilter, Nfilter = 2*filter_length_oneside + 1
- Returns:
Open (nu_grid_extended x Cross section) in the log nu grid [Nnus]
- exojax.spec.profconv.calc_xsection_from_lsd_scanfft(Slsd, R, pmarray, nsigmaD, nu_grid, log_ngammaL_grid)ο
Compute cross section from LSD in MODIT algorithm using scan+fft to avoid 4GB memory limit in fft (see #277), deprecated
Notes
This function is deprecated. Use calc_xsection_from_lsd_zeroscan instead. The aliasing part is closed and thereby canβt be used in OLA.
- Parameters:
Slsd (array) β line shape density [Nnus, Ngamma]
R (float) β spectral resolution
pmarray β (+1,-1) array whose length of len(nu_grid)+1
nsigmaD (float) β normaized Gaussian STD
nu_grid (array) β wavenumber grid [Nnus]
log_gammaL_grid (array) β logarithm of gammaL grid [Ngamma]
- Returns:
Closed Cross section in the log nu grid [Mnus]
- exojax.spec.profconv.calc_xsection_from_lsd_zeroscan(Slsd, R, pmarray, nsigmaD, nu_grid, log_ngammaL_grid)ο
Compute cross section from LSD in MODIT algorithm using scan+fft to avoid 4GB memory limit in fft and zero padding in scan
Notes
The aliasing part is closed and thereby canβt be used in OLA. #277
- Parameters:
Slsd (array) β line shape density [Nnus, Ngamma]
R (float) β spectral resolution
pmarray β (+1,-1) array whose length of len(nu_grid)+1
nsigmaD (float) β normaized Gaussian STD
nu_grid (array) β wavenumber grid [Nnus]
log_gammaL_grid (array) β logarithm of gammaL grid [Ngamma]
- Returns:
Closed Cross section in the log nu grid [Nnus]
exojax.spec.qstate moduleο
Quantum States Module
- exojax.spec.qstate.branch_to_number(branch_str, fillvalue=None)ο
convert branch: object to number (float) :param branch_str: Branch type (R, P, Q) :type branch_str: np.ndarray
- Returns:
jupper - jlower
- Return type:
np.ndarray
- exojax.spec.qstate.m_transition_state(jlower, branch)ο
compute m-value of the transition from rotational state
- Parameters:
jlower (int) β lower rotational quantum state
branch (int) β jupper - jlower
- Returns:
m
- Return type:
int
Notes
m = Jlower + 1 for R-branch (branch=1) m = Jlower for P- and Q- branch (branch=-1 and 0)
exojax.spec.rayleigh moduleο
- exojax.spec.rayleigh.xsvector_rayleigh_gas(wavenumber, polarizability, king_factor=1.0)ο
Computes Rayleigh scattering cross-section of gas from polarizability
- Parameters:
wavenumber β wavenumber (cm-1)
polarizability β alpha (cm3)
king_factor β King correction factor which accounts for the depolarization effect (default=1.0)
- Returns:
cross section (cm2) for Rayleigh scattering
- exojax.spec.rayleigh.xsvector_rayleigh_gas_from_refractive_index(wavenumber, refractive_index, number_density, king_factor=1.0)ο
Computes Rayleigh scattering cross-section of gas from real refractive index
- Parameters:
wavenumber β wavenumber (cm-1)
refractive_index β real refractive index (use atm.lorentz_lorenz to compute this)
number_density β gas number density (cm-2)
king_factor β King correction factor which accounts for the depolarization effect (default=1.0)
- Returns:
cross section (cm2) for Rayleigh scattering
Notes
This function uses the exact form of the gas Rayleigh scattering, which depends on the number density of the gas
exojax.spec.response moduleο
Response
input nus/wav should be spaced evenly on a log scale (ESLOG).
response is a response operation for the wavenumber grid spaced evenly on a log scale.
- exojax.spec.response.ipgauss(spectrum, varr_kernel, beta)ο
Apply the Gaussian IP response to a spectrum F.
- Parameters:
spectrum β original spectrum (F0)
varr_kernel β velocity array for the rotational kernel
beta β STD of a Gaussian broadening (IP+microturbulence)
- Returns:
response-applied spectrum (F)
- exojax.spec.response.ipgauss_ola(folded_spectrum, varr_kernel, beta)ο
Apply the Gaussian IP response to a spectrum F using OLA.
- Parameters:
folded_spectrum β original spectrum (F0) folded to (ndiv, div_length) form
varr_kernel β velocity array for the rotational kernel
beta β STD of a Gaussian broadening (IP+microturbulence)
- Returns:
response-applied spectrum (F)
- exojax.spec.response.ipgauss_ola_sampling(nusd, nus, folded_spectrum, beta, RV, varr_kernel)ο
Apply the Gaussian IP response using OLA + sampling to a spectrum F.
- Parameters:
nusd β sampling wavenumber
nus β input wavenumber, evenly log-spaced
folded_spectrum β original spectrum (F0) folded to (ndiv, div_length) form
beta β STD of a Gaussian broadening (IP+microturbulence)
RV β radial velocity (km/s)
varr_kernel β velocity array for the rotational kernel
- Returns:
response-applied spectrum (F)
- exojax.spec.response.ipgauss_sampling(nusd, nus, spectrum, beta, RV, varr_kernel)ο
Apply the Gaussian IP response + sampling to a spectrum F.
- Parameters:
nusd β sampling wavenumber
nus β input wavenumber, evenly log-spaced
spectrum β original spectrum (F0)
beta β STD of a Gaussian broadening (IP+microturbulence)
RV β radial velocity (km/s)
varr_kernel β velocity array for the rotational kernel
- Returns:
response-applied spectrum (F)
- exojax.spec.response.ipgauss_variable_sampling(nusd, nus, spectrum, beta_variable, RV)ο
Apply the variable Gaussian IP response + sampling to a spectrum F.
Notes
STD is a function of nusd
- Parameters:
nusd β sampling wavenumber
nus β input wavenumber, evenly log-spaced
spectrum β original spectrum (F0)
beta_variable (1D array) β STD of a Gaussian broadening, shape=(len(nusd),)
RV β radial velocity (km/s)
- Returns:
response-applied spectrum (F)
- exojax.spec.response.sampling(nusd, nus, F, RV)ο
Sampling w/ RV.
- Parameters:
nusd β sampling wavenumber
nus β input wavenumber
F β input spectrum
RV β radial velocity (km/s)
- Returns:
sampled spectrum
exojax.spec.rtlayer moduleο
layer by layer radiative transfer module
- exojax.spec.rtlayer.fluxsum_scan(tauup, taulow, mus, weights)ο
flux sum using jax.lax.scan (but unrolling)
- Parameters:
tauup (array) β optical depth at the top of the layer [N_wavenumber]
taulow (array) β optical depth at the bottom of the layer [N_wavenumber]
mus (array) β array of cosine of zenith angles [N_stream]
weights (array) β array of weights for each zenith angle [N_stream]
- Returns:
flux sum for each wavenumber [N_wavenumber]
- Return type:
array
- exojax.spec.rtlayer.fluxsum_vector(tauup, taulow, mus, weights)ο
flux sum for vectorized calculation
- Parameters:
tauup (array) β optical depth at the top of the layer [N_wavenumber]
taulow (array) β optical depth at the bottom of the layer [N_wavenumber]
mus (array) β array of cosine of zenith angles [N_stream]
weights (array) β array of weights for each zenith angle [N_stream]
- Returns:
flux sum for each wavenumber [N_wavenumber]
- Return type:
array
exojax.spec.rtransfer moduleο
Runs radiative transfer
The classification of rtrun(s):
flux-based emission
β pure absoprtion β 2stream: rtrun_emis_pureabs_flux2st, rtrun_emis_pureabs_flux2st_surface β scattering β 2stream β- LART: rtrun_emis_scat_lart_toonhm β- flux-adding: rtrun_emis_scat_fluxadding_toonhm β relfection β 2stream β- flux-adding: rtrun_reflect_fluxadding_toonhm
intensity-based emission
β pure absorption β isothermal: rtrun_emis_pureabs_ibased β linear source approximation: rtrun_emis_pureabs_ibased_linsap
transmision:
β trapezoid integration: rtrun_trans_pureabs_trapezoid β simpson integration: rtrun_trans_pureabs_simpson
- exojax.spec.rtransfer.coeffs_linsap(dtau_per_mu, trans)ο
coefficients of the linsap
- Parameters:
dtau_per_mu (_type_) β opacity difference divided by mu (cos theta)
trans β transmission of the layers
- Returns:
beta coefficient, gamma coefficient
- Return type:
_type_
- exojax.spec.rtransfer.initialize_gaussian_quadrature(nstream)ο
Initialization of Gaussian Quadrature
- Parameters:
nstream (int) β the number of the stream
- Raises:
ValueError β odd nstream error
- Returns:
cosine angle array (mu), weight array
- Return type:
array, array
- exojax.spec.rtransfer.rtrun_emis_pureabs_fbased2st(dtau, source_matrix)ο
Radiative Transfer for emission spectrum using flux-based two-stream pure absorption with no surface :param dtau: optical depth matrix, dtau (N_layer, N_nus) :type dtau: 2D array :param source_matrix: source matrix (N_layer, N_nus) :type source_matrix: 2D array
- Returns:
flux in the unit of [erg/cm2/s/cm-1] if using piBarr as a source function.
- exojax.spec.rtransfer.rtrun_emis_pureabs_fbased2st_surface(dtau, source_matrix, source_surface)ο
Radiative Transfer for emission spectrum using flux-based two-stream pure absorption with a planetary surface.
- Parameters:
dtau (2D array) β optical depth matrix, dtau (N_layer, N_nus)
source_matrix (2D array) β source matrix (N_layer, N_nus)
source_surface β source from the surface [N_nus]
- Returns:
flux in the unit of [erg/cm2/s/cm-1] if using piBarr as a source function.
- exojax.spec.rtransfer.rtrun_emis_pureabs_ibased(dtau, source_matrix, mus, weights)ο
Radiative Transfer for emission spectrum using intensity-based n-stream pure absorption with no surface (NEMESIS, pRT-like) :param dtau: optical depth matrix, dtau (N_layer, N_nus) :type dtau: 2D array :param source_matrix: source matrix (N_layer, N_nus) :type source_matrix: 2D array :param mus: mu (cos theta) list for integration :type mus: list :param weights: weight list for mu :type weights: list
- Returns:
flux in the unit of [erg/cm2/s/cm-1] if using piBarr as a source function.
- exojax.spec.rtransfer.rtrun_emis_pureabs_ibased_linsap(dtau, source_matrix_boundary, mus, weights)ο
Radiative Transfer for emission spectrum using intensity-based n-stream pure absorption with no surface w/ linear source approximation = linsap (HELIOS-R2 like)
- Parameters:
dtau (2D array) β optical depth matrix, dtau (N_layer, N_nus)
source_matrix_booundary (2D array) β source matrix at the layer upper boundary (N_layer + 1, N_nus)
mus (list) β mu (cos theta) list for integration
weights (list) β weight list for mu
- Returns:
flux in the unit of [erg/cm2/s/cm-1] if using piBarr as a source function.
Notes
See Olson and Kunasz as well as HELIOS-R2 paper (Kitzmann+) for the derivation.
- exojax.spec.rtransfer.rtrun_emis_scat_fluxadding_toonhm(dtau, single_scattering_albedo, asymmetric_parameter, source_matrix)ο
Radiative Transfer for emission spectrum (w/ scattering) using flux-based two-stream scattering the flux adding solver w/ Toon Hemispheric Mean with surface.
- Parameters:
dtau (2D array) β Optical depth matrix, dtau (N_layer, N_nus)
single_scattering_albedo (2D array) β Single scattering albedo (N_layer, N_nus)
asymmetric_parameter (2D array) β Asymmetric parameter (N_layer, N_nus)
source_matrix (2D array) β Source matrix (N_layer, N_nus)
- Returns:
Emission spectrum in the unit of [erg/cm2/s/cm-1] if using piBarr as a source function.
- Return type:
1D array
- exojax.spec.rtransfer.rtrun_emis_scat_lart_toonhm(dtau, single_scattering_albedo, asymmetric_parameter, source_matrix)ο
Radiative Transfer for emission spectrum using flux-based two-stream scattering LART solver w/ Toon Hemispheric Mean with no surface.
- Parameters:
dtau (2D array) β Optical depth matrix, dtau (N_layer, N_nus)
single_scattering_albedo (2D array) β Single scattering albedo (N_layer, N_nus)
asymmetric_parameter (2D array) β Asymmetric parameter (N_layer, N_nus)
source_matrix (2D array) β Source matrix (N_layer, N_nus)
- Returns:
- A tuple containing:
spectrum (1D array): Emission spectrum in the unit of [erg/cm2/s/cm-1] if using piBarr as a source function.
cumTtilde (2D array): Cumulative transmission function.
Qtilde (2D array): Scattering source function.
trans_coeff (2D array): Transmission coefficients.
scat_coeff (2D array): Scattering coefficients.
reduced_piB (2D array): Reduced source function.
- Return type:
tuple
- exojax.spec.rtransfer.rtrun_emis_scat_lart_toonhm_surface(dtau, single_scattering_albedo, asymmetric_parameter, source_matrix, source_surface)ο
Radiative Transfer for emission spectrum using flux-based two-stream scattering LART solver w/ Toon Hemispheric Mean with surface.
- Parameters:
dtau (2D array) β Optical depth matrix, dtau (N_layer, N_nus)
single_scattering_albedo (2D array) β Single scattering albedo (N_layer, N_nus)
asymmetric_parameter (2D array) β Asymmetric parameter (N_layer, N_nus)
source_matrix (2D array) β Source matrix (N_layer, N_nus)
source_surface (1D array) β Source from the surface (N_nus)
- Returns:
- A tuple containing:
spectrum (1D array): Emission spectrum in the unit of [erg/cm2/s/cm-1] if using piBarr as a source function.
cumTtilde (2D array): Cumulative transmission function.
Qtilde (2D array): Scattering source function.
trans_coeff (2D array): Transmission coefficients.
scat_coeff (2D array): Scattering coefficients.
piB (2D array): Reduced source function.
- Return type:
tuple
- exojax.spec.rtransfer.rtrun_reflect_fluxadding_toonhm(dtau, single_scattering_albedo, asymmetric_parameter, source_matrix, source_surface, reflectivity_surface, incoming_flux)ο
Radiative Transfer for reflected spectrum using the flux adding solver w/ Toon Hemispheric Mean with surface.
- Parameters:
dtau (2D array) β Layer optical depth (N_layer, N_nus)
single_scattering_albedo (2D array) β Single scattering albedo (N_layer, N_nus)
asymmetric_parameter (2D array) β Asymmetric parameter (N_layer, N_nus)
source_matrix (2D array) β Source term (N_layer, N_nus)
source_surface (1D array) β Source from the surface (N_nus)
reflectivity_surface (1D array) β Reflectivity from the surface (N_nus)
incoming_flux (1D array) β Incoming flux F_0^- (N_nus)
- Returns:
Reflected spectrum in the unit of [erg/cm2/s/cm-1] if using piBarr as a source function.
- Return type:
1D array
- exojax.spec.rtransfer.rtrun_trans_pureabs_simpson(dtau_chord_modpoint, dtau_chord_lower, radius_lower, height)ο
Radiative transfer for transmission spectrum assuming pure absorption with the Simpson integration (signals.integration.simpson)
- Parameters:
dtau_chord_midpoint (2D array) β chord opatical depth at the midpoint (Nlayer, N_wavenumber)
dtau_chord_lower (2D array) β chord opatical depth at the lower boundary (Nlayer, N_wavenumber)
radius_lower (1D array) β (normalized) radius at the lower boundary, underline(r) (Nlayer). R0 = radius_lower[-1] corresponds to the most bottom of the layers.
height (1D array) β (normalized) height of the layers
- Returns:
transit squared radius normalized by radius_lower[-1], i.e. it returns (radius/radius_lower[-1])**2
- Return type:
1D array
Notes
This function gives the sqaure of the transit radius. If you would like to obtain the transit radius, take sqaure root of the output. If you would like to compute the transit depth, devide the output by the square of stellar radius
Notes
We need the edge correction because the trapezoid integration with radius_lower lacks the edge point integration. i.e. the integration of the 0-th layer from radius_lower[0] to radius_top. We assume tau = 0 at the radius_top. then, the edge correction should be (1-T_0)*(delta r_0), but usually negligible though.
- exojax.spec.rtransfer.rtrun_trans_pureabs_trapezoid(dtau_chord, radius_lower, radius_top)ο
Radiative transfer for transmission spectrum assuming pure absorption with the trapezoid integration (jax.scipy.integrate.trapezoid)
- Parameters:
dtau_chord (2D array) β chord optical depth (Nlayer, N_wavenumber)
radius_lower (1D array) β (normalized) radius at the lower boundary, underline(r) (Nlayer). R0 = radius_lower[-1] corresponds to the most bottom of the layers.
radius_top (float) β (normalized) radius at the ToA, i.e. the radius at the most top of the layers
- Returns:
transit squared radius normalized by radius_lower[-1], i.e. it returns (radius/radius_lower[-1])**2
- Return type:
1D array
Notes
This function gives the sqaure of the transit radius. If you would like to obtain the transit radius, take sqaure root of the output. If you would like to compute the transit depth, devide the output by the square of stellar radius
Notes
We need the edge correction because the trapezoid integration with radius_lower lacks the edge point integration. i.e. the integration of the 0-th layer from radius_lower[0] to radius_top. We assume tau = 0 at the radius_top. then, the edge correction should be (1-T_0)*(delta r_0), but usually negligible though.
- exojax.spec.rtransfer.setrt_toonhm(dtau, single_scattering_albedo, asymmetric_parameter, source_matrix)ο
Sets some coefficients for radiative transfer assuming Toon Hemispheric Mean.
- Parameters:
dtau (2D array) β Optical depth matrix, dtau (N_layer, N_nus)
single_scattering_albedo (2D array) β Single scattering albedo (N_layer, N_nus)
asymmetric_parameter (2D array) β Asymmetric parameter (N_layer, N_nus)
source_matrix (2D array) β Source matrix (N_layer, N_nus)
- Returns:
Transmission coefficients. scat_coeff (2D array): Scattering coefficients. reduced_piB (2D array): Reduced source function. zeta_plus (2D array): Zeta plus coefficients. zeta_minus (2D array): Zeta minus coefficients. lambdan (2D array): Lambda coefficients.
- Return type:
trans_coeff (2D array)
- exojax.spec.rtransfer.settridiag_toohm(dtau, zeta_plus, zeta_minus, lambdan, trans_coeff, scat_coeff, reduced_piB)ο
- exojax.spec.rtransfer.trans2E3(x)ο
transmission function 2E3 (two-stream approximation with no scattering) expressed by 2 E3(x)
Note
The exponetial integral of the third order E3(x) is computed using Abramowitz Stegun (1970) approximation of E1 (exojax.special.E1).
- Parameters:
x β input variable
- Returns:
Transmission function T=2 E3(x)
exojax.spec.set_ditgrid moduleο
set DIT
This module provides functions to generate the grid used in DIT/MODIT/PreMODIT.
- exojax.spec.set_ditgrid.ditgrid_linear_interval(input_variable, dit_grid_resolution=0.1, weight=None, adopt=True)ο
generate DIT GRID with constant interval in linear scale
- Parameters:
input_variable β input array, e.g. n_Texp (temperature exponent) array (Nline)
dit_grid_resolution β grid resolution. dit_grid_resolution=0.1 (defaut) means a grid point per digit
weight β weight, e.g. np.abs(ln(T)-ln(Tref))
adopt β if True, min, max grid points are used at min and max values of x.
case (In this) β
exactly. (the grid width does not need to be dit_grid_resolution) β
- Returns:
grid for DIT
- exojax.spec.set_ditgrid.ditgrid_log_interval(input_variable, dit_grid_resolution=0.1, adopt=True)ο
generate DIT GRID with constant interval in logarithm scale
- Parameters:
input_variable β simgaD or gammaL array (Nline)
dit_grid_resolution β grid resolution. dit_grid_resolution=0.1 (defaut) means a grid point per digit
adopt β if True, min, max grid points are used at min and max values of x.
case (In this) β
exactly. (the grid width does not need to be dit_grid_resolution) β
- Returns:
grid for DIT
- exojax.spec.set_ditgrid.ditgrid_matrix(x, res=0.1, adopt=True)ο
DIT GRID MATRIX.
- Parameters:
x β simgaD or gammaL matrix (Nlayer x Nline)
res β grid resolution. res=0.1 (defaut) means a grid point per digit
adopt β if True, min, max grid points are used at min and max values of x. In this case, the grid width does not need to be res exactly.
- Returns:
grid for DIT (Nlayer x NDITgrid)
- exojax.spec.set_ditgrid.minmax_ditgrid_matrix(x, dit_grid_resolution=0.1, adopt=True)ο
compute MIN and MAX DIT GRID MATRIX.
- Parameters:
x β gammaL matrix (Nlayer x Nline)
dit_grid_resolution β grid resolution. dit_grid_resolution=0.1 (defaut) means a grid point per digit
adopt β if True, min, max grid points are used at min and max values of x. In this case, the grid width does not need to be dit_grid_resolution exactly.
- Returns:
minimum and maximum for DIT (dgm_minmax)
- exojax.spec.set_ditgrid.precompute_modit_ditgrid_matrix(set_gm_minmax, dit_grid_resolution=0.1, adopt=True)ο
Precomputing MODIT GRID MATRIX for normalized GammaL.
- Parameters:
set_gm_minmax β set of minmax of ditgrid matrix for different parameters [Nsample, Nlayers, 2], 2=min,max
dit_grid_resolution β grid resolution. dit_grid_resolution=0.1 (defaut) means a grid point per digit
adopt β if True, min, max grid points are used at min and max values of x. In this case, the grid width does not need to be dit_grid_resolution exactly.
- Returns:
grid for DIT (Nlayer x NDITgrid)
exojax.spec.specop moduleο
Spectral Operators (Sop)
The role of SOP is to apply various operators (essentially convolution) to a single spectrum, such as spin rotation, gaussian IP, RV shift etc. There are several convolution methods: - βexojax.signal.convolveβ: regular FFT-based convolution - βexojax.signal.olaβ: Overlap-and-Add based convolution
- class exojax.spec.specop.SopCommonConv(nu_grid, vrmax, convolution_method)ο
Bases:
object
Common Spectral Operator for convloution type operators
- check_ola_reducible(spectrum)ο
- generate_vrarray()ο
- class exojax.spec.specop.SopInstProfile(nu_grid, vrmax=100.0, convolution_method='exojax.signal.convolve')ο
Bases:
SopCommonConv
Spectral operator on Instrumental profile and sampling
- ipgauss(spectrum, standard_deviation)ο
Gaussian Instrumental Profile
- Parameters:
spectrum (nd array) β 1D spectrum
standard_deviation (float) β standard deviation of Gaussian in km/s
- Raises:
ValueError β _description_
- Returns:
IP applied spectrum
- Return type:
array
- sampling(spectrum, radial_velocity, nu_grid_sampling)ο
sampling to instrumental wavenumber grid (not necessary ESLOG nor ESLIN)
- Parameters:
spectrum (nd array) β 1D spectrum
radial_velocity (float) β radial velocity in km/s
nu_grid_sampling (array) β instrumental wavenumber grid
- Returns:
inst sampled spectrum
- Return type:
array
- class exojax.spec.specop.SopPhoto(filter_id, filter_bank='svo', path='.database/filter', download=True, up_resolution_factor=32.0, factor=1e+20)ο
Bases:
object
Spectral Operator for photometry
- apparent_magnitude(flux)ο
computes apparent magnitude
- Parameters:
flux (array) β flux in the unit of erg/s/cm2/cm-1, the same dimension as self.transmission_filter
- Returns:
apparent magnitude
- Return type:
float
- computes_interpolated_transmission_filter(xsmode='premodit')ο
computes
- Parameters:
xsmode (str, optional) β xsmode for wavenumber_grid. Defaults to βpremoditβ.
- download_filter()ο
downloads the filter
- Raises:
ValueError β No filter bank
- download_filter_svo()ο
downloads the filter from SVO
- load_filter()ο
loads the filter from the saved dataset
- Raises:
ValueError β datasets not found
- save_filter()ο
save the filter dataset
- class exojax.spec.specop.SopRotation(nu_grid, vsini_max=100.0, convolution_method='exojax.signal.convolve')ο
Bases:
SopCommonConv
Spectral operator on rotation
- rigid_rotation(spectrum, vsini, u1, u2)ο
apply a rigid rotation
- Parameters:
spectrum (nd array) β 1D spectrum
vsini (float) β V sini in km/s
u1 (float) β Limb darkening parameter u1
u2 (float) β Limb darkening parameter u2
- Raises:
ValueError β _description_
- Returns:
rotationally broaden spectrum
- Return type:
nd array
exojax.spec.spin_rotation moduleο
- exojax.spec.spin_rotation.convolve_rigid_rotation(F0, vr_array, vsini, u1=0.0, u2=0.0)ο
Apply the Rotation response to a spectrum F (No OLA and No cuDNN).
- Parameters:
F0 β original spectrum (F0)
vr_array β fix-sized vr array for kernel, see utils.dvgrid_rigid_rotation
vsini β V sini for rotation (km/s)
RV β radial velocity
u1 β Limb-darkening coefficient 1
u2 β Limb-darkening coefficient 2
- Returns:
response-applied spectrum (F)
- exojax.spec.spin_rotation.convolve_rigid_rotation_ola(folded_F0, vr_array, vsini, u1=0.0, u2=0.0)ο
Apply the Rotation response to a spectrum F (No OLA and No cuDNN).
- Parameters:
folded_F0 β original spectrum (F0) folded to (ndiv, div_length) form
vr_array β fix-sized vr array for kernel, see utils.dvgrid_rigid_rotation
vsini β V sini for rotation (km/s)
RV β radial velocity
u1 β Limb-darkening coefficient 1
u2 β Limb-darkening coefficient 2
- Returns:
response-applied spectrum (F)
- exojax.spec.spin_rotation.rotkernel_jvp(primals, tangents)ο
exojax.spec.toon moduleο
Methods for Toon et al. 1989
gamma_1, gamma_2, (gamma_3,) and mu1 are the fundamental parameters of Toon+89 (Table 1), called toon_params.
gamma_1, gamma_2 can be converted to the fundamental parameters of the twostream solver, zeta and lambda.
one can choose Eddington, Quadrature, Hemispheric_Mean to compute toon_params from single_scattering_albedo and asymmetric_parameter (and mu0 for the former two cases)
- exojax.spec.toon.params_eddington(single_scattering_albedo, asymmetric_parameter, mu0)ο
computes Toon+89 parameters for Eddington approximation
- Parameters:
single_scattering_albedo (_type_) β single scattering albedo
asymmetric_parameter (_type_) β asymmetric parameter
mu0 (_type_) β cosine of the incident angle
- Returns:
gamma_1, gamma_2, gamma_3, mu1
- Return type:
_type_
- exojax.spec.toon.params_hemispheric_mean(single_scattering_albedo, asymmetric_parameter)ο
computes Toon+89 parameters for Hemispheric Mean approximation
- Parameters:
single_scattering_albedo (_type_) β single scattering albedo
asymmetric_parameter (_type_) β asymmetric parameter
- Returns:
gamma_1, gamma_2, mu1
- Return type:
_type_
- exojax.spec.toon.params_quadrature(single_scattering_albedo, asymmetric_parameter, mu0)ο
computes Toon+89 parameters for Quadrature approximation
- Parameters:
single_scattering_albedo (_type_) β single scattering albedo
asymmetric_parameter (_type_) β asymmetric parameter
mu0 (_type_) β cosine of the incident angle
- Returns:
gamma_1, gamma_2, gamma_3, mu1
- Return type:
_type_
- exojax.spec.toon.reduced_source_function(single_scattering_albedo, gamma_1, gamma_2, source_function, source_function_derivative, sign=1.0)ο
computes reduced source functions (pi mathcal{B}^+ or -)
- Parameters:
single_scattering_albedo (_type_) β single scattering albedo
gamma_1 (_type_) β Toon+89 gamma_1 coefficient
gamma_2 (_type_) β Toon+89 gamma_2 coefficient
source_function (_type_) β pi B(tau)
source_function_derivative (_type_) β pi dB(tau)/dtau
sign (float) β 1.0 gives pi mathcal{B}^+ or -1.0 gives pi mathcal{B}^-, defaults to 1.0
- Returns:
reduced_source_function
- Return type:
_type_
- exojax.spec.toon.reduced_source_function_isothermal_layer(single_scattering_albedo, gamma_1, gamma_2, source_function)ο
computes reduced source functions (pi mathcal{B}) for the isothermal layer
- Parameters:
single_scattering_albedo (_type_) β single scattering albedo
gamma_1 (_type_) β Toon+89 gamma_1 coefficient
gamma_2 (_type_) β Toon+89 gamma_2 coefficient
source_function (_type_) β pi B(tau)
- Returns:
reduced source function for the isothermal layer
- Return type:
_type_
- exojax.spec.toon.zetalambda_coeffs(gamma_1, gamma_2)ο
computes coupling coefficients zeta and lambda coefficients for Toon-type two stream approximation
- Parameters:
gamma_1 (_type_) β Toon+89 gamma_1 coefficient
gamma_2 (_type_) β Toon+89 gamma_2 coefficient
- Returns:
coupling zeta (+), coupling zeta (-), lambda coefficients
- Return type:
_type_
exojax.spec.twostream moduleο
Two-stream solvers and related methods
Note
ExoJAX has two types of the flux-based two-stream solvers for scattering/reflection. - fluxadding - LART
- exojax.spec.twostream.compute_tridiag_diagonals_and_vector(scat_coeff, trans_coeff, piB, upper_diagonal_top, diagonal_top, vector_top)ο
computes the diagonals and right-handside vector from scattering and transmission coefficients for the tridiagonal system
- Parameters:
scat_coeff (_type_) β scattering coefficient of the n-th layer, S_n
trans_coeff (_type_) β transmission coefficient of the n-th layer, T_n
() (piB) β Planck source function, piB
upper_diagonal_top (_type_) β a[0] upper diagonal top boundary
diagonal_top (_type_) β b[0] diagonal top boundary
vector_top (_type_) β vector top boundary
Notes
In ExoJAX 2 paper, we assume the tridiagonal form as -an F_{n+1}^+ + b_n F_n^+ - cn F_{n-1}^+ = dn
- Returns:
diagonal (bn) [Nlayer], lower dianoals (cn) [Nlayer], upper diagonal (an) [Nlayer], vector (dn) [Nlayer],
- Return type:
jnp arrays
- exojax.spec.twostream.contribution_function_lart(cumT, Q)ο
computes the contribution function from LART cumlative transmission and generalized source
- Parameters:
cumT (_type_) β cumlative transmission
Q (_type_) β generalized source
- Returns:
contribution fnction in a vector form
- Return type:
_type_
- exojax.spec.twostream.set_scat_trans_coeffs(zeta_plus, zeta_minus, lambdan, dtau)ο
sets scattering and transmission coefficients from zeta and lambda coefficient and dtau
- Parameters:
zeta_plus (_type_) β coupling zeta (+) coefficient (e.g. Heng 2017)
zeta_minus (_type_) β coupling zeta (-) coefficient (e.g. Heng 2017)
lambdan (_type_) β lambda coefficient
dtau (_type_) β optical depth interval of the layers
- Returns:
transmission coefficient, scattering coeffcient
- Return type:
_type_
- exojax.spec.twostream.solve_fluxadding_twostream(trans_coeff, scat_coeff, reduced_source_function, reflectivity_bottom, source_bottom)ο
Two-stream RT solver using flux adding
- Parameters:
trans_coeff (_type_) β Transmission coefficient
scat_coeff (_type_) β Scattering coefficient
reduced_source_function β pi mathcal{B} (Nlayer, Nnus)
reflectivity_bottom (_type_) β R^+_N (Nnus)
source_bottom (_type_) β S^+_N (Nnus)
- Returns:
Effective reflectivity (hat(R^plus)), Effective source (hat(S^plus))
- exojax.spec.twostream.solve_lart_twostream(diagonal, lower_diagonal, upper_diagonal, vector, flux_bottom)ο
Two-stream RT solver given tridiagonal system components (LART form)
- Parameters:
diagonal (_type_) β diagonal component of the tridiagonal system (bn)
lower_diagonal (_type_) β lower diagonal component of the tridiagonal system (cn)
upper_diagonal (_type_) β upper diagonal component of the tridiagonal system (an)
vector (_type_) β right-hand side vector (dn)
flux_bottom β bottom flux FB
Note
Our definition of the tridiagonal components is an F+_(n+1) + bn F+_n + c_(n-1) F+_(n-1) = dn Notice that c_(n-1) is not cn
- Returns:
cumlative hat{T}, hat{Q}, spectrum
- Return type:
_type_
- exojax.spec.twostream.solve_twostream_pure_absorption_numpy(trans_coeff, scat_coeff, piB)ο
solves pure absorption limit for two stream
- Parameters:
trans_coeff (_type_) β transmission coefficient
scat_coeff (_type_) β scattering coefficient
piB (_type_) β pi x Planck function
- Returns:
cumlative transmission, generalized source, spectrum
- Return type:
_type_
exojax.spec.unitconvert moduleο
unit conversion for spectrum.
- exojax.spec.unitconvert.nu2wav(nus, wavelength_order='descending', unit='AA', values=None)ο
wavenumber to wavelength (AA)
- Parameters:
nus β wavenumber (cm-1)
order (wavlength) β wavelength order: βascendingβ or βdescendingβ, default to βdescendingβ
unit β the unit of the output wavelength, βAAβ, βnmβ, or βumβ
values β corresponding values, e.g. f(nus) for nus
- Returns:
wavelength (unit) values (optional): corresponding values in the same order as wavelength, if values is not None.
- exojax.spec.unitconvert.wav2nu(wav, unit, values=None)ο
wavelength to wavenumber.
- Parameters:
wav β wavelength array in ascending/descending order
unit β the unit of the output wavelength, βAAβ, βnmβ, or βumβ
values β corresponding values, e.g. f(wav) for wav
- Returns:
wavenumber (cm-1) in ascending order values (optional): corresponding values in the same order as wavenumber, if values is not None.