Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if lvlformat in ['cdsd-pc', 'cdsd-pcN', 'cdsd-hamil']:
# ensures that vib_lvl_name functions wont crash
if dbformat not in ['cdsd-hitemp', 'cdsd-4000', 'hitran']:
raise NotImplementedError('lvlformat {0} not supported with dbformat {1}'.format(
lvlformat, dbformat))
# Use vibrational nomenclature of CDSD (p,c,j,n) or HITRAN (v1v2l2v3J)
# depending on the Level Database.
# In both cases, store the other one.
# ... note: vib level in a CDSD (p,c,j,n) database is ambiguous.
# ... a vibrational energy Evib can have been defined for every (p, c) group:
if lvlformat in ['cdsd-pc']:
viblvl_l_cdsd = vib_lvl_name_cdsd_pc(df.polyl, df.wangl)
viblvl_u_cdsd = vib_lvl_name_cdsd_pc(df.polyu, df.wangu)
# ... or for every (p, c, N) group:
elif lvlformat in ['cdsd-pcN']:
viblvl_l_cdsd = vib_lvl_name_cdsd_pcN(
df.polyl, df.wangl, df.rankl)
viblvl_u_cdsd = vib_lvl_name_cdsd_pcN(
df.polyu, df.wangu, df.ranku)
# ... or for every level (p, c, J ,N) (that's the case if coupling terms
# are used taken into account... it also takes a much longer time
# to look up vibrational energies in the LineDatabase, warning!):
elif lvlformat in ['cdsd-hamil']:
viblvl_l_cdsd = vib_lvl_name_cdsd_pcJN(
df.polyl, df.wangl, df.jl, df.rankl)
viblvl_u_cdsd = vib_lvl_name_cdsd_pcJN(
df.polyu, df.wangu, df.ju, df.ranku)
else:
def _add_levels(self, df):
viblvl_label = self.viblvl_label
if viblvl_label == 'p':
df['viblvl'] = vib_lvl_name_cdsd_p(df.p, )
elif viblvl_label == 'pc':
df['viblvl'] = vib_lvl_name_cdsd_pc(df.p, df.c)
elif viblvl_label == 'pcN':
df['viblvl'] = vib_lvl_name_cdsd_pcN(df.p, df.c, df.N)
elif viblvl_label == 'pcJN':
df['viblvl'] = vib_lvl_name_cdsd_pcJN(df.p, df.c, df.j, df.N)
elif viblvl_label is None:
# dont label the levels. Wont be able to use the EnergyDatabase to fetch
# vibrational energies for lines, however it can still be used to
# calculate Partition functions independently from a Spectrum calculation
pass
else:
raise ValueError(
'Unexpected viblvl_label value: {0}'.format(viblvl_label))
return df
if lvlformat in ['cdsd-pc', 'cdsd-pcN', 'cdsd-hamil']:
# ensures that vib_lvl_name functions wont crash
if dbformat not in ['cdsd-hitemp', 'cdsd-4000', 'hitran']:
raise NotImplementedError('lvlformat {0} not supported with dbformat {1}'.format(
lvlformat, dbformat))
# Use vibrational nomenclature of CDSD (p,c,j,n) or HITRAN (v1v2l2v3J)
# depending on the Level Database.
# In both cases, store the other one.
# ... note: vib level in a CDSD (p,c,j,n) database is ambiguous.
# ... a vibrational energy Evib can have been defined for every (p, c) group:
if lvlformat in ['cdsd-pc']:
viblvl_l_cdsd = vib_lvl_name_cdsd_pc(df.polyl, df.wangl)
viblvl_u_cdsd = vib_lvl_name_cdsd_pc(df.polyu, df.wangu)
# ... or for every (p, c, N) group:
elif lvlformat in ['cdsd-pcN']:
viblvl_l_cdsd = vib_lvl_name_cdsd_pcN(
df.polyl, df.wangl, df.rankl)
viblvl_u_cdsd = vib_lvl_name_cdsd_pcN(
df.polyu, df.wangu, df.ranku)
# ... or for every level (p, c, J ,N) (that's the case if coupling terms
# are used taken into account... it also takes a much longer time
# to look up vibrational energies in the LineDatabase, warning!):
elif lvlformat in ['cdsd-hamil']:
viblvl_l_cdsd = vib_lvl_name_cdsd_pcJN(
df.polyl, df.wangl, df.jl, df.rankl)
viblvl_u_cdsd = vib_lvl_name_cdsd_pcJN(
df.polyu, df.wangu, df.ju, df.ranku)
else:
raise ValueError(
def vib_lvl_name_cdsd(p, c, N):
return vib_lvl_name_cdsd_pc(p, c)