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
Isoelectronic Sequence: Mg
Number of Levels: 0
Number of Transitions: 0
Temperature range: [0.100 MK, 10.000 MK]
HDF5 Database: /home/docs/.fiasco/chianti_dbase.h5
Using Datasets:
ionization_fraction: 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
Spin: 0.0
Total Angular Momentum: 0.0
Orbital Angular Momentum: S
Energy: 0.0 eV
Each level also holds various bits of metadata
Level 1 3s2, 0.0 eV
Level 2 3s 3p, 28.99271293001642 eV
Level 3 3s 3p, 29.71405299650078 eV
Level 4 3s 3p, 31.469669246314893 eV
Level 5 3s 3p, 43.63140325482594 eV
Total running time of the script: (0 minutes 0.169 seconds)