Thanks to visit codestin.com
Credit goes to github.com

Skip to content

todo: add quick-fix for unlabelled HITEMP lines #509

@erwanp

Description

@erwanp

💭 Description

HITEMP-CO2 has some unlabelled lines; therefore the following non-eq calculations won't work :

from radis import calc_spectrum
calc_spectrum(2000, 3000,
              molecule='CO2',
              Trot=3000,
              isotope=1,
              Tvib=(3000, 3000, 1000),
              databank='hitemp')

RADIS already suggests the user a fix, which requires to use SpectrumFactory :

using HITEMP2010 for CO2, some lines are unlabelled and therefore cannot be used at equilibrium. This is a known issue of the HITEMP database and will soon be fixed in the edition. In the meantime you can use:
 'sf.df0.drop(sf.df0.index[sf.df0['v1u']==-1], inplace=True)' where 'sf' is SpectrumFactory object

See #508 for an example of where it's used

It works but requires to change the user script. Would be better if an option was added in calc_spectrum() to automatically fix this.

Implementation

  • let's not declare a new parameter in calc_spectrum ; it would add more info for too few use-cases; instead let's make it a "secret" parameter: look-up if there is a key in kwargs
drop_unlabelled_CO2_hitemp_lines=kwargs.pop("drop_unlabelled_CO2_hitemp_lines", False) #  False is the default value 

Then add this in calc_spectrum code :

if drop_unlabelled_CO2_hitemp_lines: 
    sf.df0.drop(sf.df0.index[sf.df0['v1u']==-1], inplace=True)

and also update the suggested tip in the error message (wherever it is) :

using HITEMP2010 for CO2, some lines are unlabelled and therefore cannot be used at equilibrium. This is a known issue of the HITEMP database and will soon be fixed in the edition. In the meantime you can use:
 'sf.df0.drop(sf.df0.index[sf.df0['v1u']==-1], inplace=True)' where 'sf' is SpectrumFactory object ;   or use `calc_spectrum(..., drop_unlabelled_CO2_hitemp_lines=True)` 

Metadata

Metadata

Assignees

No one assigned

    Labels

    todoin the short-term roadmap

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions