Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
erwanp opened this issue Aug 17, 2022 · 0 comments
Open

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

erwanp opened this issue Aug 17, 2022 · 0 comments
Labels
todo in the short-term roadmap
Milestone

Comments

@erwanp
Copy link
Member

erwanp commented Aug 17, 2022

馃挱 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)` 
@erwanp erwanp added the todo in the short-term roadmap label Aug 17, 2022
@erwanp erwanp added this to the 0.13.1 milestone Aug 17, 2022
@erwanp erwanp modified the milestones: 0.13.1, 0.14 Aug 28, 2022
@anandxkumar anandxkumar modified the milestones: 0.14, 0.15 Oct 28, 2022
@minouHub minouHub modified the milestones: 0.15, 0.16 Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
todo in the short-term roadmap
Projects
None yet
Development

No branches or pull requests

3 participants