# ion¶

class ChiantiPy.core.ion(ionStr, temperature=None, eDensity=None, pDensity='default', radTemperature=None, rStar=None, abundance=None, setup=True, em=None, verbose=0)[source] [edit on github]

The top level class for performing spectral calculations for an ion in the CHIANTI database.

Parameters: ionStr : str CHIANTI notation for the given ion, e.g. ‘fe_12’ that corresponds to the Fe XII ion. temperature : float or ndarray, optional Temperature array (Kelvin) eDensity : float or ndarray, optional Electron density array ($$\mathrm{cm^{-3}}$$ ) pDensity : float or ndarray, optional Proton density ($$\mathrm{cm}^{-3}$$ ) radTemperature : float or ndarray, optional Radiation black-body temperature (in Kelvin) rStar : float or ndarray, optional Distance from the center of the star (in stellar radii) abundance : float or str, optional Elemental abundance relative to Hydrogen or name of CHIANTI abundance file to use, without the ‘.abund’ suffix, e.g. ‘sun_photospheric_1998_grevesse’. setup : bool or str, optional If True, run ion setup function. Otherwise, provide a limited number of attributes of the selected ion em : float or ndarray, optional Emission Measure, for the line-of-sight emission measure ($$\mathrm{\int \, n_e \, n_H \, dl}$$) ($$\mathrm{cm}^{-5}$$.), for the volumetric emission measure $$\mathrm{\int \, n_e \, n_H \, dV}$$ ($$\mathrm{cm^{-3}}$$).

Notes

The keyword arguments temperature, eDensity, radTemperature, rStar, em must all be either a float or have the same dimension as the rest if specified as lists, tuples or arrays.

The Defaults dict should have the following keys:

• abundfile, the elemental abundance file, unless specified in chiantirc this defaults to sun_photospheric_1998_grevesse.
• ioneqfile, the ionization equilibrium file name. Unless specified in ‘chiantirc’ this is defaults to chianti. Other choices are availble in $XUVTOP/ioneq • wavelength, the units of wavelength (Angstroms, nm, or kev), unless specified in the ‘chiantirc’ this is defaults to ‘angstrom’. • flux, specified whether the line intensities are give in energy or photon fluxes, unless specified in the ‘chiantirc’ this is defaults to energy. • gui, specifies whether to use gui selection widgets (True) or to make selections on the command line (False). Unless specified in the ‘chiantirc’ this is defaults to False. Attributes  IonStr (str) Name of element plus ion, e.g. fe_12 for Fe XII Z (int) the nuclear charge, 26 for fe_12. Ion (int) the ionization stage, 12 for fe_12. Dielectronic (bool) true if the ion is a ‘dielectronic’ ion where the levels are populated by dielectronic recombination. Spectroscopic (str) the spectroscopic notation for the ion, such as Fe XII for fe_12. Filename (str) the complete name of the file generic filename in the CHIANTI database, such as $XUVTOP/fe/fe_12/fe_12. Ip (float) the ionization potential of the ion FIP (float) the first ionization potential of the element Defaults (dict) these are specified by the software unless a chiantirc file is found in ‘\$HOME/.chianti’:

Methods Summary

 boundBoundLoss([wvlRange, allLines]) Calculate the summed radiative loss rate for all spectral lines of the specified ion. cireclvlDescale(lvlType) Interpolate and extrapolate cilvl and reclvl rates. diCross([energy, verbose]) Calculate the direct ionization cross section as a function of the diRate() Calculate the direct ionization rate coefficient as a function of temperature (K) drRate() Provide the dielectronic recombination rate coefficient as a function of temperature (K). drRateLvl([verbose]) to calculate the level resolved dielectronic rate from the higher ionization stage to eaCross([energy, verbose]) Provide the excitation-autoionization cross section. eaDescale() Calculates the effective collision strengths (upsilon) for excitation-autoionization as a function of temperature. eaRate() Calculate the excitation-autoionization rate coefficient. emiss([wvlRange, allLines]) Calculate the emissivities for lines of the specified ion. emissList([index, wvlRange, wvlRanges, top, …]) List the emissivities. emissPlot([index, wvlRange, top, linLog, …]) Plot the emissivities. emissRatio([wvlRange, wvlRanges, top]) Plot the ratio of 2 lines or sums of lines. gofnt([wvlRange, top, verbose, plot]) Calculate the ‘so-called’ G(T) function. intensity([wvlRange, allLines]) Calculate the intensities for lines of the specified ion. intensityRatioInterpolate(data[, scale, …]) to take a set of date and interpolate against the IntensityRatio ioneqOne() Provide the ionization equilibrium for the selected ion as a function of temperature. ionizCross([energy]) Provides the total ionization cross section. ionizRate() Provides the total ionization rate. p2eRatio() Calculates the proton density to electron density ratio using Eq. popPlot([top, plotFile, outFile, pub]) Plots populations vs temperature or eDensity. populate([popCorrect, verbose]) Calculate level populations for specified ion. recombRate() Provides the total recombination rate coefficient. rrRate() Provide the radiative recombination rate coefficient as a function of temperature (K). setup([alternate_dir, verbose]) Setup various CHIANTI files for the ion including .wgfa, .elvlc, .scups, .psplups, .reclvl, .cilvl, and others. setupIonrec([alternate_dir, verbose]) Setup method for ion recombination and ionization rates. spectrum(wavelength[, filter, label, allLines]) Calculates the line emission spectrum for the specified ion. twoPhoton(wvl[, verbose]) to calculate the two-photon continuum - only for hydrogen- and helium-like ions twoPhotonEmiss(wvl) To calculate the two-photon continuum rate coefficient - only for hydrogen- and helium-like ions twoPhotonLoss() to calculate the two-photon energy loss rate - only for hydrogen- and helium-like ions upsilonDescale([prot]) Provides the temperatures and effective collision strengths (upsilons) upsilonDescaleSplups([prot, diel]) Provides the temperatures and effective collision strengths (upsilons)

Methods Documentation

boundBoundLoss(wvlRange=None, allLines=1)[source] [edit on github]

Calculate the summed radiative loss rate for all spectral lines of the specified ion.

Parameters: wvlRange : a 2 element tuple, list or array determines a limited wavelength range allLines : bool If True, include losses from both observed and unobserved lines. If False, only include losses from observed lines. includes elemental abundance and ionization fraction. creates the attribute: BoundBoundLoss : dict with the keys below. wvlRange : identical to the input value. rate : the radiative loss rate ($$\mathrm{erg \, cm^{-3}} \, \mathrm{s}^{-1}$$) per unit emission measure. temperature : (K). eDensity : electron density ($$\mathrm{cm^{-3}}$$)
cireclvlDescale(lvlType)[source] [edit on github]

Interpolate and extrapolate cilvl and reclvl rates. lvltype must be either ‘reclvl’, ‘cilvl’ or ‘rrlvl’ Used in level population calculations.

diCross(energy=None, verbose=False)[source] [edit on github]

Calculate the direct ionization cross section as a function of the incident electron energy in eV, puts values into DiCross

diRate()[source] [edit on github]

Calculate the direct ionization rate coefficient as a function of temperature (K)

drRate()[source] [edit on github]

Provide the dielectronic recombination rate coefficient as a function of temperature (K).

drRateLvl(verbose=0)[source] [edit on github]

to calculate the level resolved dielectronic rate from the higher ionization stage to the ion of interest rates are determined from autoionizing A-values the dictionary self.DrRateLvl contains rate = the dielectronic rate into an autoionizing level effRate = the dielectronic rate into an autoionizing level mutilplied by the branching ratio for a stabilizing transition totalRate = the sum of all the effRates

eaCross(energy=None, verbose=False)[source] [edit on github]

Provide the excitation-autoionization cross section.

Energy is given in eV.

eaDescale()[source] [edit on github]

Calculates the effective collision strengths (upsilon) for excitation-autoionization as a function of temperature.

eaRate()[source] [edit on github]

Calculate the excitation-autoionization rate coefficient.

emiss(wvlRange=0, allLines=1)[source] [edit on github]

Calculate the emissivities for lines of the specified ion.

wvlRange can be set to limit the calculation to a particular wavelength range

units: ergs s^-1 str^-1

Does not include elemental abundance or ionization fraction

Wavelengths are sorted

set allLines = 1 to include unidentified lines

emissList(index=-1, wvlRange=None, wvlRanges=None, top=10, relative=0, outFile=0)[source] [edit on github]

List the emissivities.

wvlRange, a 2 element tuple, list or array determines the wavelength range

Top specifies to plot only the top strongest lines, default = 10

normalize = 1 specifies whether to normalize to strongest line, default = 0

emissPlot(index=-1, wvlRange=None, top=10, linLog='lin', relative=0, verbose=0, plotFile=0, saveFile=0)[source] [edit on github]

Plot the emissivities.

wvlRange, a 2 element tuple, list or array determines the wavelength range

Top specifies to plot only the top strongest lines, default = 10

linLog specifies a linear or log plot, want either lin or log, default = lin

normalize = 1 specifies whether to normalize to strongest line, default = 0

emissRatio(wvlRange=None, wvlRanges=None, top=10)[source] [edit on github]

Plot the ratio of 2 lines or sums of lines. Shown as a function of density and/or temperature. For a single wavelength range, set wvlRange = [wMin, wMax] For multiple wavelength ranges, set wvlRanges = [[wMin1,wMax1],[wMin2,wMax2], …] A plot of relative emissivities is shown and then a dialog appears for the user to choose a set of lines.

gofnt(wvlRange=0, top=10, verbose=0, plot=True)[source] [edit on github]

Calculate the ‘so-called’ G(T) function.

Given as a function of both temperature and eDensity.

Only the top( set by ‘top’) brightest lines are plotted. the G(T) function is returned in a dictionary self.Gofnt

intensity(wvlRange=None, allLines=1)[source] [edit on github]

Calculate the intensities for lines of the specified ion.

wvlRange, a 2 element tuple, list or array determines the wavelength range

units: ergs cm^-3 s^-1 str^-1

includes elemental abundance and ionization fraction.

the emission measure ‘em’ is included if specified

intensityRatioInterpolate(data, scale='lin', plot=0, verbose=0)[source] [edit on github]

to take a set of date and interpolate against the IntensityRatio the scale can be one of ‘lin’/’linear’ [default], ‘loglog’, ‘logx’, ‘logy’,

ioneqOne()[source] [edit on github]

Provide the ionization equilibrium for the selected ion as a function of temperature. returned in self.IoneqOne

ionizCross(energy=None)[source] [edit on github]

Provides the total ionization cross section.

Notes

ionizRate()[source] [edit on github]

Provides the total ionization rate.

Calls diRate and eaRate.

p2eRatio()[source] [edit on github]

Calculates the proton density to electron density ratio using Eq. 7 of [R42].

Notes

Uses the abundance and ionization equilibrium.

References

 [R42] (1, 2) Young, P. R. et al., 2003, ApJS, 144, 135
popPlot(top=10, plotFile=0, outFile=0, pub=0)[source] [edit on github]

Plots populations vs temperature or eDensity.

top specifies the number of the most highly populated levels to plot if pub is set, the want publication plots (bw, lw=2).

populate(popCorrect=1, verbose=0, **kwargs)[source] [edit on github]

Calculate level populations for specified ion. possible keyword arguments include temperature, eDensity, pDensity, radTemperature and rStar

recombRate()[source] [edit on github]

Provides the total recombination rate coefficient.

Calls drRate and rrRate

rrRate()[source] [edit on github]

Provide the radiative recombination rate coefficient as a function of temperature (K).

setup(alternate_dir=None, verbose=False)[source] [edit on github]

Setup various CHIANTI files for the ion including .wgfa, .elvlc, .scups, .psplups, .reclvl, .cilvl, and others.

Parameters: alternate_dir : str directory cotaining the necessary files for a ChiantiPy ion; use to setup an ion with files not in the current CHIANTI directory verbose : bool

Notes

If ion is initiated with setup=False, call this method to do the setup at a later point.

setupIonrec(alternate_dir=None, verbose=False)[source] [edit on github]

Setup method for ion recombination and ionization rates.

Notes

Allows a bare-bones ion object to be setup up with just the ionization and recombination rates. For ions without a complete set of files - one that is not in the MasterList.

spectrum(wavelength, filter=(<function gaussianR>, 1000.0), label=0, allLines=1)[source] [edit on github]

Calculates the line emission spectrum for the specified ion.

Convolves the results of intensity to make them look like an observed spectrum the default filter is the gaussianR filter with a resolving power of 1000. Other choices include chianti.filters.box and chianti.filters.gaussian. When using the box filter, the width should equal the wavelength interval to keep the units of the continuum and line spectrum the same.

includes ionization equilibrium and elemental abundances

can be called multiple times to use different filters and widths uses label to keep the separate applications of spectrum sorted by the label for example, do .spectrum( …. labe=’test1’) and do .spectrum( …. label = ‘test2’) then will get self.Spectrum.keys() = test1, test2 and self.Spectrum[‘test1’] = {‘intensity’:aspectrum, ‘wvl’:wavelength, ‘filter’:useFilter.__name__, ‘filterWidth’:useFactor}

Notes

scipy.ndimage.filters also includes a range of filters.

twoPhoton(wvl, verbose=False)[source] [edit on github]

to calculate the two-photon continuum - only for hydrogen- and helium-like ions includes the elemental abundance and the ionization equilibrium includes the emission measure if specified

twoPhotonEmiss(wvl)[source] [edit on github]

To calculate the two-photon continuum rate coefficient - only for hydrogen- and helium-like ions

twoPhotonLoss()[source] [edit on github]

to calculate the two-photon energy loss rate - only for hydrogen- and helium-like ions includes the elemental abundance and the ionization equilibrium does not include the emission measure

upsilonDescale(prot=0)[source] [edit on github]

Provides the temperatures and effective collision strengths (upsilons) set prot for proton rates otherwise, ce will be set for electron collision rates uses the new format “scups” files

upsilonDescaleSplups(prot=0, diel=0)[source] [edit on github]

Provides the temperatures and effective collision strengths (upsilons) set prot for proton rates otherwise, ce will be set for electron collision rates