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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add file reader for rrlvl files #247

Merged
merged 3 commits into from
Jan 10, 2024
Merged

Add file reader for rrlvl files #247

merged 3 commits into from
Jan 10, 2024

Conversation

jwreep
Copy link
Collaborator

@jwreep jwreep commented Jan 9, 2024

Fixes #114

Tested with data from CHIANTI v10.

(base) C:\Users\reep\Documents\Forks\fiasco>python
Python 3.11.5 | packaged by conda-forge | (main, Aug 27 2023, 03:23:48) [MSC v.1936 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from astropy.table import QTable
>>> import fiasco.io
>>> parser = fiasco.io.Parser('fe_23.rrlvl')
>>> table = parser.parse()
>>> table
<QTable length=459>
lower_level upper_level      temperature        recombination_rate
                                  K                  cm3 / s
   int32       int32         float64[19]           float64[19]
----------- ----------- ---------------------- --------------------
          1           1 5290.0 .. 5290000000.0 9.54e-12 .. 6.54e-16
          1           2 5290.0 .. 5290000000.0 4.93e-12 .. 4.18e-17
          1           3 5290.0 .. 5290000000.0 1.47e-11 .. 1.25e-16
          1           4 5290.0 .. 5290000000.0 2.41e-11 .. 2.07e-16
          1           5 5290.0 .. 5290000000.0 1.37e-11 .. 1.22e-16
          1           6 5290.0 .. 5290000000.0  4.2e-14 .. 3.39e-18
          1           7 5290.0 .. 5290000000.0 2.77e-13 .. 2.43e-17
          1           8 5290.0 .. 5290000000.0 4.69e-12 .. 2.97e-16
          1           9 5290.0 .. 5290000000.0 1.51e-12 .. 9.87e-17
        ...         ...                    ...                  ...
          3         153 5290.0 .. 5290000000.0 1.05e-12 .. 8.85e-19
          3         155 5290.0 .. 5290000000.0 3.78e-13 .. 1.59e-19
          3         165 5290.0 .. 5290000000.0 5.29e-13 .. 2.23e-19
          3         158 5290.0 .. 5290000000.0  6.8e-13 .. 2.87e-19
          3         160 5290.0 .. 5290000000.0  8.32e-13 .. 3.5e-19
          3         162 5290.0 .. 5290000000.0 5.29e-13 .. 2.23e-19
          3         159 5290.0 .. 5290000000.0  6.8e-13 .. 2.87e-19
          3         161 5290.0 .. 5290000000.0  8.32e-13 .. 3.5e-19
          3         163 5290.0 .. 5290000000.0 9.83e-13 .. 4.14e-19
          3         166 5290.0 .. 5290000000.0  1.87e-13 .. 4.5e-20
>>> table.meta
OrderedDict([('footer', "filename:  fe_23.rrlvl\nRadiative recombination rates for recombination onto Fe XXIV to form Fe XXIII\nBadnell, N. R., 2006, ApJS, 167, 334\nRadiative Recombination Data for Modeling Dynamic Finite-Density Plasmas\nadsLink:  http://adsabs.harvard.edu/abs/2006ApJS..167..334B\nproduced as a part of the 'CHIANTI' atomic database for astrophysical spectroscopy\nK. Dere (GMU) - 2018 December 15\nChanged indexing for v.10.\nProduced as part of the 'CHIANTI' atomic data base collaboration by\nGiulio Del Zanna, May 2020"), ('chianti_version', '8.0.7'), ('filename', 'fe_23.rrlvl'), ('descriptions', {'lower_level': 'lower level index', 'upper_level': 'upper level index', 'temperature': 'temperature', 'recombination_rate': 'recombination rate coefficient'}), ('element', 'fe'), ('ion', 'fe_23'), ('dielectronic', False)])
>>>

@wtbarnes
Copy link
Owner

wtbarnes commented Jan 9, 2024

Ha we are working the same thing at the exact same time but you beat me to it!

@jwreep
Copy link
Collaborator Author

jwreep commented Jan 9, 2024

Sorry for the overlap! Seemed like it would be simple enough to implement. The file format is basically the same as a few other types except that the temperatures are not in log-space.

@wtbarnes
Copy link
Owner

No worries! Your solution was actually a bit more straightforward than mine. I'm actually pleasantly surprised that someone who is not me is able to read the parsing code and work out how to write a new file parser.

I'm going to add one more commit here and then I'll go ahead and merge. Thanks for tackling this.

@wtbarnes wtbarnes merged commit 8f6acc0 into wtbarnes:main Jan 10, 2024
16 checks passed
@jwreep
Copy link
Collaborator Author

jwreep commented Jan 10, 2024

Might need one quick update for the description:

These files contain the *Direct* radiative recombination rates from
    the recombining ion to the recombined ion. Note that these files contain
    the *effective* radiation recombination rate coefficients.

The .reclvl contain effective radiative recombination rates, not the .rrlvl files.

@wtbarnes
Copy link
Owner

Ah good point. I'll create an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support reading rrlvl files
2 participants