-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #400 from radis/develop
0.11.0
- Loading branch information
Showing
68 changed files
with
6,492 additions
and
1,809 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
======================== | ||
Get Molecular Parameters | ||
======================== | ||
Retrieve isotopologue abundances or molecular mass, based on HITRAN data, | ||
using :py:class:`~radis.db.molparam.MolParams` | ||
See also how to use custom (non-terrestrial) abundances in | ||
:ref:`the Custom Abundances example <example_custom_abundances>` | ||
""" | ||
|
||
#%% Access the parameters: | ||
from radis.db.molparam import MolParams | ||
|
||
molpar = MolParams() | ||
|
||
print("CO2 abundances for the first 2 isotopes :") | ||
print(molpar.get("CO2", 1, "abundance")) # 1 for isotopologue number | ||
print(molpar.get("CO2", 2, "abundance")) # 1 for isotopologue number | ||
|
||
|
||
print("H2O molar mass for the first 2 isotopes") | ||
print(molpar.get("H2O", 1, "mol_mass")) # 1 for isotopologue number | ||
print(molpar.get("CO2", 2, "mol_mass")) # 1 for isotopologue number | ||
|
||
|
||
print("Tabulated CO partition function at 296 K for the first 2 isotopes") | ||
print(molpar.get("CO", 1, "Q_296K")) # 1 for isotopologue number | ||
print(molpar.get("CO", 2, "Q_296K")) # 1 for isotopologue number | ||
|
||
|
||
#%% All parameters are stored in a DataFrame: | ||
print("All parameters: ", list(molpar.df.columns)) | ||
print(molpar.df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
============================================== | ||
Compare CO from the ExoMol and HITEMP database | ||
============================================== | ||
Auto-download and calculate CO spectrum from the HITEMP database, and the | ||
ExoMol database. ExoMol references multiple databases for CO. Here we do not | ||
use the ExoMol recommended database (see :py:func:`~radis.io.exomol.get_exomol_database_list`) | ||
but we use the HITEMP database hosted on ExoMol. | ||
Output should be similar, but no ! By default these two databases provide | ||
different broadening coefficients. However, the Einstein coefficients & linestrengths | ||
should be the same, therefore the integrals under the lines should be similar. | ||
We verifiy this below : | ||
For further exploratino, ExoMol and HITEMP lines can be downloaded and accessed separately using | ||
:py:func:`~radis.io.exomol.fetch_exomol` and :py:func:`~radis.io.hitemp.fetch_hitemp` | ||
""" | ||
import astropy.units as u | ||
|
||
from radis import calc_spectrum, plot_diff | ||
|
||
conditions = { | ||
"wmin": 2002 / u.cm, | ||
"wmax": 2300 / u.cm, | ||
"molecule": "CO", | ||
"isotope": "2", | ||
"pressure": 1.01325, # bar | ||
"Tgas": 1000, # K | ||
"mole_fraction": 0.1, | ||
"path_length": 1, # cm | ||
"broadening_method": "fft", # @ dev: Doesn't work with 'voigt' | ||
"verbose": True, | ||
} | ||
|
||
s_exomol = calc_spectrum( | ||
**conditions, databank="exomol", name="ExoMol's HITEMP (H2 broadened)" | ||
) | ||
s_hitemp = calc_spectrum( | ||
**conditions, | ||
databank="hitemp", | ||
name="HITEMP (Air broadened)", | ||
) | ||
plot_diff(s_exomol, s_hitemp, "abscoeff") | ||
|
||
#%% Broadening coefficients are different but areas under the lines should be the same : | ||
import numpy as np | ||
|
||
assert np.isclose( | ||
s_exomol.get_integral("abscoeff"), s_hitemp.get_integral("abscoeff"), rtol=0.001 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.