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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kurucz spectrum #601
base: develop
Are you sure you want to change the base?
Kurucz spectrum #601
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments
examples/calc_spectrumkurucz.py
Outdated
ionization_state = '00' # adjust as needed | ||
|
||
# Create a spectrum factory | ||
sf = SpectrumFactory(wavenum_min, wavenum_max, atom=atom, ionization_state=ionization_state, wstep="auto") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a lineshape_optimization / optimization parameter in SpectrumFactory. It is designed for molecular spectra with millions of lines. I think it will slow your calculations with Kuruzc. Set it to None, compare calculation times.
In calc_spectrum you'll set the default based on the input parameters (I.e None for atomic spectra)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try with a None input and compare the runtime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It didn't change much, the runtime is sometimes even longer @erwanp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More comments.
I also cannot find the changes you must have made to the Partition functions to include the ones from Kuruzc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please clean this PR. Notably:
- remove all prints
- delete
pfdat.txt
that is unnecessary. You can usegit rm the_file_to_remove
thengit commit -am "removed duplicate pfdat"
- move
NIST_iE.txt
to radis/db. You can usegit mm old_loc new_loc
thengit commit -am "moved NIST_iE"
- git revert to the files that you should not have modified
- I proposed very minor commits so that it's easy to you to apply them ==> see printscreen below
radis/lbl/broadening.py
Outdated
@@ -989,6 +1041,8 @@ def _check_accuracy(self, wstep): | |||
|
|||
# TODO: thresholds depend whether we're computing Transmittance/optically thin emission, | |||
# for a homogeneous slab, or self-absorbed radiance combined with other slabs. | |||
min_width = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
min_width = None |
Delete file to only keep the example using SpectrumFactory
Was renamed kuruczpartfn.txt and put in db
Replaced by plot_kurucz.py in the examples
…cz partition functions
radis/api/kuruczapi.py
Outdated
@@ -98,7 +98,7 @@ def load_pf_Barklem2016(self): | |||
`Barklem & Collet (2016), Table 8 <https://doi.org/10.1051/0004-6361/201526961>`_ | |||
|
|||
""" | |||
file_path="radis/levels/pfTKurucz_values.txt" | |||
file_path=r"radis/levels/pfTKurucz_values.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it an absolute path. There are some functions in Radis/dB and Radis/test/utils to get proper maths independently of 1) the working directory 2) your OS
) | ||
+ "\n- under nonequilibrium: {0}".format( | ||
MOLECULES_LIST_NONEQUILIBRIUM | ||
if molecule is not None and species is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix molecule and/or species when reading the function parameters.
Then use one only through the whole code. Here you're still using both it makes the code hard to read.
You can rename the internal name to species to be very clear.
@menasrac I believe the issue with |
I tried your suggestion, the test passed indeed but other tests in calc.py and broadening.py failed after this modification @dcmvdbekerom |
A few issues remaining, sorted in order of priority
---- fetchdatabank() ---- from radis import SpectrumFactory
from astropy import units as u
sf = SpectrumFactory(wavelength_min=4165 * u.nm,
wavelength_max=4200 * u.nm,
species='Fe_I',
medium='air',
verbose=1, # more for more details
)
sf.fetch_databank() ---- plot_kurucz.py ----
|
Fetch databank is not implemented for atoms, however load_databank works with atoms as in the plot_kurucz examples. You have to mention sf.load_databank(path=hdf5_path, format='kurucz',parfuncfmt='kurucz') @minouHub |
I have also added a test for fetch_kurucz. Though it is not directly a test for load_databank, it still asserts that the df which will be used by calc_spectrum contains all the required columns |
@menasrac please add a runnable test code in the PR main text so we can test it |
Description
PR for the 2023 GSOC project : Common API for large molecular databases.
This PR includes the implementation of the Kurucz database to Radis with an example to plot spectrum using Spectrum Factory and all the related changes to the API or other sections of the code
Follows
PR #579 and adds broadening, a spectrum factory based example for Kurucz, also fixes minor requested changes.
Fixes #