# ChiantiPy.base package¶

## ChiantiPy.base._IonTrails module¶

Base classes used in the ChiantiPy.core.ion and ChiantiPy.core.spectrum classes. Mostly printing, plotting and saving routines.

class ChiantiPy.base._IonTrails.ionTrails

Bases: object

Base class for ChiantiPy.core.ion and ChiantiPy.core.spectrum

argCheck(temperature=None, eDensity=None, pDensity='default', em=None, verbose=0)

to check the compatibility of the three arguments and put them into numpy arrays of atleast_1d

intensityList(index=-1, wvlRange=None, wvlRanges=None, top=10, relative=0, outFile=0, rightDigits=4)

List the line intensities. Checks to see if there is an existing Intensity attribute. If it exists, then those values are used. Otherwise, the intensity method is called.

This method prints an ASCII table with the following columns:

1. Ion: the CHIANTI style notation for the ion, e.g. ‘c_4’ for C IV

2. lvl1: the lower level of the transition in the CHIANTI .elvlc file

3. lvl2: the upper level of the transition in the CHIANTI .elvlc file

4. lower: the notation, usually in LS coupling, of the lower fine structure level

5. upper: the notation, usually in LS coupling, of the upper fine structure level

6. Wvl(A): the wavelength of the transition in units as specified in the chiantirc file.

7. Intensity

8. A value: the Einstein coefficient for spontaneous emission from level ‘j’ to level ‘i’

9. Obs: indicates whether the CHIANTI database considers this an observed line or one obtained from theoretical energy levels

Regarding the intensity column, if ‘flux’ in the chiantirc file is set to ‘energy’, the intensity is given by,

$I = \Delta E_{ij}n_jA_{ij}\mathrm{Ab}\frac{1}{N_e} \frac{N(X^{+m})}{N(X)}\mathrm{EM},$

in units of ergs cm-2 s-1 sr-1. If ‘flux’ is set to ‘photon’,

$I = n_jA_{ij}\mathrm{Ab}\frac{1}{N_e}\frac{N(X^{+m})}{N(X)} \mathrm{EM},$

where,

• $$\Delta E_{ij}$$ is the transition energy (ergs)

• $$n_j$$ is the fractions of ions in level $$j$$

• $$A_{ij}$$ is the Einstein coefficient for spontaneous emission from level $$j$$ to level $$i$$ (in s-1)

• $$\mathrm{Ab}$$ is the abundance of the specified element relative to hydrogen

• $$N_e$$ is the electron density (in cm-3)

• $$N(X^{+m})/N(X)$$ is the fractional ionization of ion as a function of temperature

• $$\mathrm{EM}$$ is the emission measure integrated along the line-of-sight, $$\int\mathrm{d}l\,N_eN_H$$ (cm-5) where $$N_H$$ is the density of hydrogen (neutral + ionized) (cm-3)

Note that if relative is set, the line intensity is relative to the strongest line and so the output will be unitless.

Parameters
• index (int,optional) – Index the temperature or eDensity array to use. -1 (default) sets the specified value to the middle of the array

• wvlRange (tuple) – Wavelength range

• wvlRanges (a tuple, list or array that contains at least 2) – 2 element tuples, lists or arrays so that multiple wavelength ranges can be specified

• top (int) – Number of lines to plot, sorted by descending magnitude.

• relative (int) – specifies whether to normalize to strongest line default (relative = 0) specified that the intensities should be their calculated values

• outFile (str) – specifies the file that the intensities should be output to default(outFile = 0) intensities are output to the terminal

• rightDigits (int) – specifies the format for the wavelengths for the number of digits to right of the decimal place

intensityPlot(index=-1, wvlRange=None, top=10, linLog='lin', relative=False, verbose=False, plotFile=0, em=0)

Plot the line intensities. Uses Intensity if it already exists. If not, call the intensity method.

Parameters
• index (integer) – specified which value of the temperature array or eDensity array to use. default (index=-1) sets the specified value to the middle of the array

• wvlRange (2 element tuple, list or array determines the wavelength range)

• top (integer) – specifies to plot only the top strongest lines, default = 10

• linLog (str) – default(‘lin’) produces a plot where the intensity scale is linear if set to ‘log’, produces a plot where the intensity scale is logarithmic

• normalize (= 1 specifies whether to normalize to strongest line) – default (relative = 0) specified that the intensities should be their calculated values

• plotFile – default=0, the plot is not saved to a file othewise, the plot is saved to the ‘plotFile’

• em (emission measure) – if an Intensity attribute needs be created, then the emission measure is applied

intensityRatio(wvlRange=None, wvlRanges=None, top=10)

Plot the intensity 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.

Parameters
• wvlRange (array-like) – Wavelength range, i.e. min and max

• wvlRanges (a tuple, list or array that contains at least 2) – 2 element tuples, lists or arrays so that multiple wavelength ranges can be specified

• top (int) – specifies to plot only the top strongest lines, default = 10

intensityRatioSave(outFile=0)

Save the intensity ratio to a file.

The intensity ratio as a function to temperature and eDensity is saved to an asciii file. Descriptive information is included at the top of the file.

Parameters

outFile – default(0): the plot of the intensity ratio is not saved str/unicode: the plot is saved to the file names ‘outFile’

## ChiantiPy.base._SpecTrails module¶

Base class used in several ChiantiPy objects

class ChiantiPy.base._SpecTrails.specTrails(temperature, density)

Bases: object

a collection of methods for use in spectrum calculations

convolve(wavelength=0, filter=(<function gaussianR>, 1000.0), label=0, verbose=0)

the first application of spectrum calculates the line intensities within the specified wavelength range and for set of ions specified

wavelength will not be used if applied to ‘spectrum’ objects

wavelength IS need for ‘bunch’ objects - in this case, the wavelength should not extend beyond the limits of the wvlRange used for the ‘bunch’ calculation

ionGate(elementList=None, ionList=None, minAbund=None, doLines=1, doContinuum=1, doWvlTest=1, verbose=0)

creates a list of ions for free-free, free-bound, and line intensity calculations if doing the radiative losses, accept all wavelength -> doWvlTest=0 the list is a dictionary self.Todo

lineSpectrumPlot(index=0, integrated=0, saveFile=0, linLog='lin')

to plot the line spectrum as a function of wavelength

spectrumPlot(index=-1, integrated=0, saveFile=0, linLog='lin')

to plot the spectrum as a function of wavelength

## Module contents¶

Base classes for ion- and spectrum-related objects.