radis.io.exomolapi module¶
API for Exomol molecular database
Borrowed from the Exojax code (which you should also have a look at !), by @HajimeKawahara, under MIT License.
- check_bdat(bdat)[source]¶
cheking codes in .broad Args:
bdat: exomol .broad data given by exomolapi.read_broad
- Returns:
code level: None, a0, a1, other codes unavailable currently,
- make_j2b(bdat, alpha_ref_default=0.07, n_Texp_default=0.5, jlower_max=None)[source]¶
compute j2b (code a0, map from jlower to alpha_ref)
- Args:
bdat: exomol .broad data given by exomolapi.read_broad alpha_ref_default: default value n_Texp_default: default value jlower_max: maximum number of jlower
- Returns:
j2alpha_ref[jlower] provides alpha_ref for jlower j2n_Texp[jlower] provides nT_exp for jlower
- make_jj2b(bdat, j2alpha_ref_def, j2n_Texp_def, jupper_max=None)[source]¶
compute jj2b (code a1, map from (jlower, jupper) to alpha_ref and n_Texp)
- Args:
bdat: exomol .broad data given by exomolapi.read_broad j2alpha_ref_def: default value from a0 j2n_Texp_def: default value from a0 jupper_max: maximum number of jupper
- Returns:
jj2alpha_ref[jlower,jupper] provides alpha_ref for (jlower, jupper) jj2n_Texp[jlower,jupper] provides nT_exp for (jlower, jupper)
- Note:
The pair of (jlower, jupper) for which broadening parameters are not given, jj2XXX contains None.
- pickup_gE(states, trans, trans_file, dic_def, trans_lines=False, skip_optional_data=True)[source]¶
extract g_upper (gup), E_lower (elower), and J_lower and J_upper from states DataFrame and insert them into the transition DataFrame.
- Parameters
states (states DataFrame - the i, E, g, J are in the 4 first columns)
trans (transition numpy array)
trans_file (name of the transition file)
trans_lines (By default (False) we use nu_lines computed using the state file, i.e. E_upper - E_lower. If trans_nuline=True, we use the nu_lines in the transition file. Note that some trans files do not this info.)
dic_def (Informations about additional quantum labels)
add_quantum_labels (bool . If True fetch all quantum labels in dic_def[‘quantum_labels’] from states into transitions)
- Return type
A, nu_lines, elower, gup, jlower, jupper, mask, **quantum_labels
Notes
We first convert pandas DataFrame to ndarray. The state counting numbers in states DataFrame is used as indices of the new array for states (newstates). We remove the state count numbers as the column of newstate, i.e. newstates[:,k] k=0: E, 1: g, 2: J. Then, we can directly use the state counting numbers as mask.
States by default has columns
# i E g J v 0 1 0.0 1 0 0 1 2 1.448467 3 1 0 2 3 4.345384 5 2 0 3 4 8.690712 7 3 0
- read_broad(broadf)[source]¶
Reading braodening file (.broad) :Parameters: broadf (.broad file)
- Return type
broadening info in bdat form (pandas), defined by this instance.
Notes
See Table 16 in https://arxiv.org/pdf/1603.05890.pdf
- read_def(deff)[source]¶
Exomol IO for a definition file
- Parameters
deff (definition file)
- Returns
n_Texp (float) – temperature exponent
alpha_ref (float) – broadening parameter
molmass (float) – molecular mass
numinf (List[float]) – limit points (
[w(0), w(1), ..., w(n)]
, n+1 elements) defining the spectral ranges appearing in the name of *.trans.bz2 files (["w(0)-w(1)", "w(1)-w(2)", ..., w(n-1)-w(n)]
, n elements)numtag (List[str]) – tag for wavelength ranges.
Note – For some molecules, ExoMol provides multiple trans files. numinf and numtag are the ranges and identifiers for the multiple trans files.
- read_pf(pff)[source]¶
Exomol IO for partition file
- Note:
T=temperature QT=partition function
- Args:
pff: partition file
- Returns:
partition data in pandas DataFrame
- read_states(statesf, dic_def, engine='vaex', skip_optional_data=True)[source]¶
Exomol IO for a state file
Notes
States f format
i=state counting number E=state energy g=state degeneracy J=total angular momentum
See Table 11 in https://arxiv.org/pdf/1603.05890.pdf
- Parameters
statesf (str) – state file
dic_def (dict) – Info from def file to read extra quantum numbers
engine (str) – parsing engine to use (‘vaex’, ‘csv’)
skip_optional_data (bool) – If False, fetch all fields which are marked as available in the ExoMol definition file. If True, load only the first 4 columns of the states file (“i”, “E”, “g”, “J”). The structure of the columns above 5 depend on the the definitions file (*.def) and the Exomol version. If
skip_optional_data=False
, two errors may occur:a field is marked as present/absent in the *.def field but is absent/present in the *.states file (ie both files are inconsistent).
in the updated version of Exomol, new fields have been added in the states file of some species. But it has not been done for all species, so both structures exist. For instance, the states file of https://exomol.com/data/molecules/HCl/1H-35Cl/HITRAN-HCl/ follows the structure described in 1, unlike the states file of https://exomol.com/data/molecules/NO/14N-16O/XABC/ which follows the structure described in 2.
- Returns
states data in pandas DataFrame
If
'vaex'
, also writes a local hdf5 filestatesf.with_suffix('.hdf5')
References
- 1
Tennyson, J., Yurchenko, S. N., Al-Refaie, A. F., Barton, E. J., Chubb, K. L., Coles, P. A., … Zak, E. (2016). The ExoMol database: molecular line lists for exoplanet and other hot atmospheres. https://doi.org/10.1016/j.jms.2016.05.002
- 2
Tennyson, J., Yurchenko, S. N., Al-Refaie, A. F., Clark, V. H. J., Chubb, K. L., Conway, E. K., … Yurchenko, O. P. (2020). The 2020 release of the ExoMol database: Molecular line lists for exoplanet and other hot atmospheres. Journal of Quantitative Spectroscopy and Radiative Transfer, 255, 107228. https://doi.org/10.1016/j.jqsrt.2020.107228
- read_trans(transf, engine='vaex')[source]¶
Exomol IO for a transition file
Notes
Transf format
i_upper=Upper state counting number i_lower=Lower state counting number A=Einstein coefficient in s-1 nu_lines=transition wavenumber in cm-1
See Table 12 in https://arxiv.org/pdf/1603.05890.pdf [Exomol-2016]
- Parameters
transf (transition file)
engine (parsing engine to use (‘vaex’, ‘csv’))
- Return type
transition data in vaex/pandas DataFrame