Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dgb = df.groupby(by=['id', 'iso'])
for (id, iso), idx in dgb.indices.items():
_gs = gs(id, iso)
if isinstance(_gs, tuple):
# Molecules that have alternating degeneracy.
if id not in [2]: # CO2
raise NotImplementedError
# normally we should find whether the rovibrational level is symmetric
# or asymmetric. Here we just assume it's symmetric, because
# CO2 asymmetric levels dont exist (gs=0) and they should not be
# in the line database.
_gs = _gs[0]
dg = df.loc[idx]
_gi = gi(id, iso)
df.loc[idx, 'grotu'] = dg.gju * _gs * _gi
df.loc[idx, 'grotl'] = dg.gjl * _gs * _gi
if radis.DEBUG_MODE:
assert (df.loc[idx, 'id'] == id).all()
assert (df.loc[idx, 'iso'] == iso).all()
# %%
if dbformat in ['hitran', 'cdsd-hitemp', 'cdsd-4000']:
# In HITRAN, AFAIK all molecules have a complete assignment of rovibrational
# levels hence gvib=1 for all vibrational levels.
#
# Complete rovibrational assignment would not be True, for instance, for
def gi(self):
from radis.db.degeneracies import gi
I = self.isotope
return gi(2, I)
def gi(self, ElecState):
''' Get state independant rotational degeneracy. Typically depends on the
isotope
See Also
--------
:func:`~radis.db.degeneracies.gi`
'''
from radis.db.degeneracies import gi
M, I = ElecState.id, ElecState.iso
return gi(M, I)