diff --git a/docs/references.bib b/docs/references.bib index c17579be..72ffdca8 100644 --- a/docs/references.bib +++ b/docs/references.bib @@ -414,3 +414,12 @@ @techreport{dere_chianti_2017 urldate = {2022-08-21}, langid = {english} } + +@techreport{young_chianti_2019, + title = {{{CHIANTI Technical Report No}}. 24: {{The CHIANTI}} Level-Resolved Recombination Files (Rrlvl)}, + author = {Young, Peter R.}, + year = {2019}, + month = feb, + number = {24}, + urldate = {2024-01-09} +} diff --git a/fiasco/io/sources/ion_sources.py b/fiasco/io/sources/ion_sources.py index aba5fb99..f4141505 100644 --- a/fiasco/io/sources/ion_sources.py +++ b/fiasco/io/sources/ion_sources.py @@ -22,6 +22,7 @@ 'DrparamsParser', 'DiparamsParser', 'AutoParser', + 'RrlvlParser', ] @@ -461,3 +462,49 @@ def preprocessor(self, table, line, index): super().preprocessor(table, line, index) # remove the dash in the second-to-last entry table[-1][-2] = table[-1][-2].split('-')[0].strip() + + +class RrlvlParser(GenericIonParser): + """ + Level-resolved recombination rates as a function of temperature. + + 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. + A given ion should have either a ``.rrlvl`` file or a ``.reclvl`` file, + but not both. For a full description of these files, see :cite:t:`young_chianti_2019`. + """ + filetype = 'rrlvl' + dtypes = [int, int, int, int, float, float] + units = [None, None, None, None, u.K, (u.cm**3)/u.s] + headings = [ + 'Z', + 'ion', + 'initial_level', + 'final_level', + 'temperature', + 'rate', + ] + descriptions = [ + 'atomic number', + 'ionization state', + 'level index of the recombining ion', + 'index of the final level of the transition in the recombined ion', + 'temperatures at which rates are tabulated', + 'direct radiative recombination rate coefficients', + ] + + def preprocessor(self, table, line, index): + # NOTE: Every pair of lines has the same first four entries. On the even + # lines, the remaining entries contain the temperatures and on the odd + # lines, the remaining entries are the rate coefficients. Thus, every + # other line needs to be added to the one above it. + line = line.strip().split() + if index % 2 == 0: + row = line[:4] + temperature = np.array(line[4:], dtype=float) + row += [temperature] + table.append(row) + else: + rate_coefficient = np.array(line[4:], dtype=float) + table[-1].append(rate_coefficient) diff --git a/fiasco/io/sources/tests/test_sources.py b/fiasco/io/sources/tests/test_sources.py index 059a9f81..02d039b2 100644 --- a/fiasco/io/sources/tests/test_sources.py +++ b/fiasco/io/sources/tests/test_sources.py @@ -23,6 +23,7 @@ 'fe_12.drparams', 'al_3.diparams', pytest.param('fe_23.auto', marks=pytest.mark.requires_dbase_version('>=9')), + pytest.param('fe_23.rrlvl', marks=pytest.mark.requires_dbase_version('>=9')), ]) def test_ion_sources(ascii_dbase_root, filename,): parser = fiasco.io.Parser(filename, ascii_dbase_root=ascii_dbase_root)