Parsing Raw CHIANTI Data

Parsing Raw CHIANTI Data#

This example shows how to directly parse the raw CHIANTI database files.

from fiasco.io import Parser

While the main advantages of fiasco lie in its high-level interface to the CHIANTI data, some users may wish to just parse the raw data directly. fiasco provides a convenient interface to parsing any of the raw CHIANTI datafiles and provides detailed metadata about each datafile. Specifically, fiasco returns a QTable object with appropriate units and descriptive names attached to each column.

For example, say we want to parse the energy level file for Fe V (i.e. iron with four electrons missing)

p = Parser('fe_5.elvlc')
table = p.parse()
print(table)
level  config label multiplicity L_label  J   E_obs      E_th
                                              1 / cm    1 / cm
----- ------- ----- ------------ ------- --- -------- ----------
    1     3d4                  5       D 0.0      0.0        0.0
    2     3d4                  5       D 1.0    142.1    153.632
    3     3d4                  5       D 2.0    417.3    449.923
    4     3d4                  5       D 3.0    803.1    873.509
    5     3d4                  5       D 4.0   1282.8    1407.93
    6 3d4 (2)                  3       P 0.0  24055.4  24398.996
    7     3d4                  3       H 4.0  24932.5  28643.637
    8 3d4 (2)                  3       P 1.0  24972.9  25314.205
    9     3d4                  3       H 5.0  25225.9  29013.449
   10     3d4                  3       H 6.0  25528.5  29396.432
  ...     ...   ...          ...     ... ...      ...        ...
   25     3d4                  1       F 3.0  52732.7  59302.051
   26 3d4 (1)                  3       P 2.0  61854.4  67320.555
   27 3d4 (1)                  3       F 4.0  62238.1  67484.062
   28 3d4 (1)                  3       F 2.0  62321.1  67574.047
   29 3d4 (1)                  3       F 3.0  62364.4  67616.844
   30 3d4 (1)                  3       P 1.0  62914.2  68356.477
   31 3d4 (1)                  3       P 0.0  63420.0  68879.922
   32 3d4 (1)                  1       G 4.0  71280.3  77939.836
   33 3d4 (1)                  1       D 2.0  93832.3 103239.773
   34 3d4 (1)                  1       S 0.0 121130.2 128805.281
Length = 34 rows

The individual columns can easily be accessed as well.

print(table.colnames)
print(table['E_obs'])
['level', 'config', 'label', 'multiplicity', 'L_label', 'J', 'E_obs', 'E_th']
[     0.     142.1    417.3    803.1   1282.8  24055.4  24932.5  24972.9
  25225.9  25528.5  26468.3  26760.7  26842.3  26974.   29817.1  30147.
  30430.1  36586.3  36630.1  36758.5  36925.4  37511.7  39633.4  46291.2
  52732.7  61854.4  62238.1  62321.1  62364.4  62914.2  63420.   71280.3
  93832.3 121130.2] 1 / cm

Each above column is an Quantity object with units attached to it if appropriate. Metadata, including the original footer from the raw CHIANTI data and detailed descriptions of each of the columns, is included with each table,

print(table.meta.keys())
print(table.meta['footer'])
odict_keys(['footer', 'chianti_version', 'filename', 'descriptions', 'element', 'ion', 'dielectronic'])
filename:  fe_5.elvlc
Observed energies: Ralchenko, Yu., Kramida, A.E., Reader, J., and NIST ASD Team (2008).
NIST Atomic Spectra Database (version 3.1.5), [Online]. Available: http://physics.nist.gov/asd3
[2009, September 1]. National Institute of Standards and Technology, Gaithersburg, MD.
Theoretical energies: Ballance, C.P., Griffin, D.C., & McLaughlin, B.M. 2007, J.Phys.B, 40, F327
produced as part of the Arcetri/Cambridge/NRL 'CHIANTI' atomic data base collaboration
Peter Young, 3-Sep-2009

Total running time of the script: (0 minutes 0.011 seconds)

Gallery generated by Sphinx-Gallery