.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated/gallery/user_guide/parse_raw_data.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_generated_gallery_user_guide_parse_raw_data.py: Parsing Raw CHIANTI Data ========================= This example shows how to directly parse the raw CHIANTI database files. .. GENERATED FROM PYTHON SOURCE LINES 8-10 .. code-block:: Python from fiasco.io import Parser .. GENERATED FROM PYTHON SOURCE LINES 11-21 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 `~astropy.table.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) .. GENERATED FROM PYTHON SOURCE LINES 21-25 .. code-block:: Python p = Parser('fe_5.elvlc') table = p.parse() print(table) .. rst-class:: sphx-glr-script-out .. code-block:: none 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 ... ... ... ... ... ... ... ... 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 .. GENERATED FROM PYTHON SOURCE LINES 26-27 The individual columns can easily be accessed as well. .. GENERATED FROM PYTHON SOURCE LINES 27-30 .. code-block:: Python print(table.colnames) print(table['E_obs']) .. rst-class:: sphx-glr-script-out .. code-block:: none ['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 .. GENERATED FROM PYTHON SOURCE LINES 31-35 Each above column is an `~astropy.units.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, .. GENERATED FROM PYTHON SOURCE LINES 35-37 .. code-block:: Python print(table.meta.keys()) print(table.meta['footer']) .. rst-class:: sphx-glr-script-out .. code-block:: none 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 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.007 seconds) .. _sphx_glr_download_generated_gallery_user_guide_parse_raw_data.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: parse_raw_data.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: parse_raw_data.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_