diff --git a/fiasco/io/sources/ion_sources.py b/fiasco/io/sources/ion_sources.py index 32d4814c..c3838aab 100644 --- a/fiasco/io/sources/ion_sources.py +++ b/fiasco/io/sources/ion_sources.py @@ -416,3 +416,26 @@ def preprocessor(self, table, line, index): ionization_potential = tmp[0] cs_spline = np.array(tmp[1:], dtype=float)*1e-14 table[-1] = [ionization_potential] + table[-1] + [cs_spline] + [0.0] + + +class AutoParser(GenericIonParser): + """ + Autoionization rates for each level in an ion + """ + filetype = 'auto' + dtypes = [int, int, float, str, str] + units = [None, None, 1/u.s, None, None] + headings = ['lower_level', 'upper_level', 'autoionization_rate', 'lower_label', 'upper_label'] + descriptions = [ + 'lower level index', + 'upper level index', + 'autoionization rate', + 'lower level label', + 'upper level label' + ] + fformat = fortranformat.FortranRecordReader('(2I7,E12.2,A30,A30)') + + 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() \ No newline at end of file diff --git a/fiasco/io/sources/tests/test_sources.py b/fiasco/io/sources/tests/test_sources.py index 3f8a3c12..f2f1f71c 100644 --- a/fiasco/io/sources/tests/test_sources.py +++ b/fiasco/io/sources/tests/test_sources.py @@ -22,6 +22,7 @@ 'fe_2.trparams', 'fe_12.drparams', 'al_3.diparams', + 'fe_23.auto', ]) def test_ion_sources(ascii_dbase_root, filename,): parser = fiasco.io.Parser(filename, ascii_dbase_root=ascii_dbase_root)