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']:
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(
'Unexpected level format: {0}'.format(lvlformat))
band_cdsd = viblvl_l_cdsd + '->' + viblvl_u_cdsd
df.loc[:, 'viblvl_l'] = viblvl_l_cdsd
df.loc[:, 'viblvl_u'] = viblvl_u_cdsd
df.loc[:, 'band'] = band_cdsd
# Calculate HITRAN format too (to store them))
if all_in(['v1l', 'v2l', 'l2l', 'v3l'], df):
viblvl_l_hitran = vib_lvl_name_hitran(
df.v1l, df.v2l, df.l2l, df.v3l)
viblvl_u_hitran = vib_lvl_name_hitran(
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
# ... 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(
'Unexpected level format: {0}'.format(lvlformat))
band_cdsd = viblvl_l_cdsd + '->' + viblvl_u_cdsd
df.loc[:, 'viblvl_l'] = viblvl_l_cdsd
df.loc[:, 'viblvl_u'] = viblvl_u_cdsd
df.loc[:, 'band'] = band_cdsd
# Calculate HITRAN format too (to store them))
if all_in(['v1l', 'v2l', 'l2l', 'v3l'], df):
viblvl_l_hitran = vib_lvl_name_hitran(