Note
Go to the end to download the full example code.
Creating an Ion
#
This example shows how to create a Ion
object and
access various pieces of metadata.
import astropy.units as u
import numpy as np
from fiasco import Ion
The CHIANTI database is organized around individual ions, with
multiple types of datafiles attached to each ion. In keeping with
the organization of the database, the primary unit of the fiasco
library is the Ion
object which can be created in the
following way,
temperature = np.logspace(5, 7, 100) * u.K
ion = Ion('Fe 15', temperature)
print(ion)
CHIANTI Database Ion
---------------------
Name: Fe 15
Element: iron (26)
Charge: +14
Number of Levels: 283
Number of Transitions: 0
Temperature range: [0.100 MK, 10.000 MK]
HDF5 Database: /home/docs/.fiasco/chianti_dbase.h5
Using Datasets:
ioneq: chianti
abundance: sun_coronal_1992_feldman_ext
ip: chianti
This creates a Ion
object for the Fe XV ion. Note also
the same object can also be created in the following ways,
ion = Ion('iron 15', temperature)
ion = Ion('iron 14+', temperature)
ion = Ion('Fe XV', temperature)
The Ion
object holds several basic pieces of metadata
related to the particular ion,
print(ion.element_name)
print(ion.atomic_symbol)
print(ion.atomic_number)
print(ion.ion_name)
print(ion.charge_state)
print(ion.ionization_stage)
print(ion.abundance)
iron
Fe
26
Fe 15
14
15
0.0001258925411794166
The Ion
object can also be indexed like an array in
order to get information about the energy levels.
print(ion[0])
Level: 1
Configuration: 3s2
Orbital Angular Momentum: S
Energy: 0.0 eV
Each level also holds various bits of metadata
Level 1 3s2, 0.0 erg
Level 2 3s.3p, 4.6451447212741975e-11 erg
Level 3 3s.3p, 4.760716141243122e-11 erg
Level 4 3s.3p, 5.04199687461541e-11 erg
Level 5 3s.3p, 6.990521480351365e-11 erg
Total running time of the script: (0 minutes 0.188 seconds)