Scale Linestrengths of carbon-monoxideΒΆ
This example scales the linestrengths of CO to Tgas=300 from Tref = 296 and then plots
the linestrengths against the wavenumbers. We are using fetch_hitemp()
function to retrieve the dataframe from the HITEMP-CO databank.
ReferencesΒΆ
\[S(T) = S_0 \frac{Q_{ref}}{Q_{gas}} \operatorname{exp}\left(-E_l \left(\frac{1}{T_{gas}}-\frac{1}{T_{ref}}\right)\right) \frac{1-\operatorname{exp}\left(\frac{-\omega_0}{Tgas}\right)}{1-\operatorname{exp}\left(\frac{-\omega_0}{T_{ref}}\right)}\]
See Eq.(A11) in [Rothman-1998]
Similar functions are used directly at the hearth of RADISβs SpectrumFactory in the
calc_linestrength_eq() and calc_linestrength_noneq() methods

Login successful.
Your HITRAN credentials will be saved securely in /home/docs/radis.json. You can delete the credentials section if you wish but you will have to prompt your credentials at next download.
Downloading: 0%| | 0.00/14.1M [00:00<?, ?B/s]
Downloading: 1%|β | 208k/14.1M [00:00<00:09, 1.51MB/s]
Downloading: 6%|β | 872k/14.1M [00:00<00:03, 3.86MB/s]
Downloading: 9%|β | 1.33M/14.1M [00:00<00:03, 4.12MB/s]
Downloading: 12%|ββ | 1.77M/14.1M [00:00<00:03, 4.08MB/s]
Downloading: 16%|ββ | 2.21M/14.1M [00:00<00:03, 4.09MB/s]
Downloading: 19%|ββ | 2.66M/14.1M [00:00<00:02, 4.10MB/s]
Downloading: 22%|βββ | 3.12M/14.1M [00:00<00:02, 4.17MB/s]
Downloading: 25%|βββ | 3.59M/14.1M [00:00<00:02, 4.22MB/s]
Downloading: 29%|βββ | 4.09M/14.1M [00:01<00:02, 4.32MB/s]
Downloading: 32%|ββββ | 4.59M/14.1M [00:01<00:02, 4.41MB/s]
Downloading: 36%|ββββ | 5.10M/14.1M [00:01<00:02, 4.51MB/s]
Downloading: 40%|ββββ | 5.62M/14.1M [00:01<00:01, 4.58MB/s]
Downloading: 44%|βββββ | 6.16M/14.1M [00:01<00:01, 4.70MB/s]
Downloading: 47%|βββββ | 6.70M/14.1M [00:01<00:01, 4.80MB/s]
Downloading: 51%|ββββββ | 7.26M/14.1M [00:01<00:01, 4.89MB/s]
Downloading: 55%|ββββββ | 7.82M/14.1M [00:01<00:01, 4.99MB/s]
Downloading: 59%|ββββββ | 8.41M/14.1M [00:01<00:01, 5.12MB/s]
Downloading: 64%|βββββββ | 9.00M/14.1M [00:02<00:01, 5.22MB/s]
Downloading: 68%|βββββββ | 9.60M/14.1M [00:02<00:00, 5.32MB/s]
Downloading: 72%|ββββββββ | 10.2M/14.1M [00:02<00:00, 5.41MB/s]
Downloading: 77%|ββββββββ | 10.8M/14.1M [00:02<00:00, 5.54MB/s]
Downloading: 81%|ββββββββ | 11.5M/14.1M [00:02<00:00, 5.63MB/s]
Downloading: 86%|βββββββββ | 12.1M/14.1M [00:02<00:00, 5.75MB/s]
Downloading: 90%|βββββββββ | 12.8M/14.1M [00:02<00:00, 5.86MB/s]
Downloading: 95%|ββββββββββ| 13.5M/14.1M [00:02<00:00, 5.96MB/s]
Downloading: 100%|ββββββββββ| 14.1M/14.1M [00:02<00:00, 5.01MB/s]
- Downloading 05_HITEMP2019.par.bz2 (1/1)
Login successful.
Downloading: 0%| | 0.00/14.1M [00:00<?, ?B/s]
Downloading: 3%|β | 392k/14.1M [00:00<00:04, 3.55MB/s]
Downloading: 19%|ββ | 2.66M/14.1M [00:00<00:00, 14.5MB/s]
Downloading: 66%|βββββββ | 9.29M/14.1M [00:00<00:00, 38.5MB/s]
Downloading: 100%|ββββββββββ| 14.1M/14.1M [00:00<00:00, 36.5MB/s]
Download complete. Parsing CO database to /home/docs/.radisdb/hitemp/CO-05_HITEMP2019.h5
The parsing/conversion is usually very fast (e.g., HITEMP OH takes only a few seconds) but can be slightly longer in some cases (e.g., a single HITEMP 2010 COβ file takes about 1 minute).
Added HITEMP-CO database in /home/docs/radis.json
Scaling equilibrium linestrength
from matplotlib import pyplot as plt
from numpy import exp
from radis.db.classes import get_molecule, get_molecule_identifier
from radis.io.hitemp import fetch_hitemp
from radis.levels.partfunc import PartFuncTIPS
from radis.phys.constants import hc_k
def get_Qgas(molecule, iso, T):
M = get_molecule_identifier(molecule)
Q = PartFuncTIPS(M, iso)
return Q.at(T=T)
def scale_linestrength_eq(df, Tref, Tgas):
print("Scaling equilibrium linestrength")
# %% Load partition function values
def _calc_Q(molecule, iso, T_ref, T_gas):
Qref = get_Qgas(molecule, iso, T_ref)
Qgas = get_Qgas(molecule, iso, T_gas)
return Qref, Qgas
id_set = df.id.unique()
id = list(id_set)[0]
molecule = get_molecule(id) # retrieve the molecule
iso_set = set(df.iso) # df1.iso.unique()
Qref_Qgas_ratio = {}
for iso in iso_set:
Qref, Qgas = _calc_Q(molecule, iso, Tref, Tgas)
Qref_Qgas_ratio[iso] = Qref / Qgas
# Scaling linestrength with the equations from Rothman's paper
line_strength = df.int * df["iso"].map(Qref_Qgas_ratio)
line_strength *= exp(-hc_k * df.El * (1 / Tgas - 1 / Tref))
line_strength *= (1 - exp(-hc_k * df.wav / Tgas)) / (1 - exp(-hc_k * df.wav / Tref))
# Add a fresh columns with the scaled linestrength
df["S"] = line_strength # [cm-1/(molecules/cm-2)]
# Just to make sure linestrength is indeed added
assert "S" in df
return df
if __name__ == "__main__":
Tref = 296
df = fetch_hitemp(
molecule="CO",
isotope="1, 2, 3",
load_wavenum_min=2000,
load_wavenum_max=2250,
)
Tgas = 450
df = scale_linestrength_eq(df, Tref, Tgas)
plt.bar(df["wav"], df["S"])
plt.xlabel("Wavenumbers in cm-1")
plt.ylabel("Linestrengths in cm-1/(molecules/cm-2)")
plt.show()
Total running time of the script: (0 minutes 16.822 seconds)