In [1]:
%matplotlib inline
import numpy as np
import matplotlib
import chianti.core as ch
using cli
using CLI for selections
In [14]:
temp = 10.**(4. + 0.05 * np.arange(81))
rl = ch.radLoss(temp, 1.e+4, minAbund=2.e-5, keepIons=1)
rl.radLossPlot()
elapsed seconds = 1.22e+03
In [17]:
print(rl.__dir__())
['Defaults', 'Temperature', 'EDensity', 'AbundanceName', 'AbundAll', 'IonsCalculated', 'IonInstances', 'Finished', 'WvlRange', 'Todo', 'FreeFreeLoss', 'FreeBoundLoss', 'BoundBoundLoss', 'TwoPhotonLoss', 'RadLoss', '__module__', '__doc__', '__init__', 'radLossPlot', 'convolve', 'ionGate', 'spectrumPlot', 'lineSpectrumPlot', '__dict__', '__weakref__', '__repr__', '__hash__', '__str__', '__getattribute__', '__setattr__', '__delattr__', '__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__new__', '__reduce_ex__', '__reduce__', '__subclasshook__', '__init_subclass__', '__format__', '__sizeof__', '__dir__', '__class__']
In [21]:
rl.IonInstances
Out[21]:
{}
In [12]:
rl.IonsCalculated
Out[12]:
['c_1',
'c_2',
'c_3',
'c_4',
'c_4d',
'c_5',
'c_5d',
'c_6',
'fe_10',
'fe_10d',
'fe_11',
'fe_11d',
'fe_12',
'fe_12d',
'fe_13',
'fe_13d',
'fe_14',
'fe_14d',
'fe_15',
'fe_15d',
'fe_16',
'fe_16d',
'fe_17',
'fe_17d',
'fe_18',
'fe_18d',
'fe_19',
'fe_19d',
'fe_2',
'fe_20',
'fe_20d',
'fe_21',
'fe_21d',
'fe_22',
'fe_22d',
'fe_23',
'fe_23d',
'fe_24',
'fe_24d',
'fe_25',
'fe_25d',
'fe_26',
'fe_2d',
'fe_3',
'fe_3d',
'fe_4',
'fe_4d',
'fe_5',
'fe_5d',
'fe_6',
'fe_6d',
'fe_7',
'fe_7d',
'fe_8',
'fe_8d',
'fe_9',
'fe_9d',
'h_1',
'he_1',
'he_2',
'mg_10',
'mg_10d',
'mg_11',
'mg_11d',
'mg_12',
'mg_2',
'mg_3',
'mg_4',
'mg_5',
'mg_6',
'mg_7',
'mg_8',
'mg_9',
'n_1',
'n_2',
'n_3',
'n_4',
'n_5',
'n_5d',
'n_6',
'n_6d',
'n_7',
'ne_10',
'ne_2',
'ne_3',
'ne_4',
'ne_5',
'ne_6',
'ne_7',
'ne_8',
'ne_8d',
'ne_9',
'ne_9d',
'o_1',
'o_2',
'o_3',
'o_4',
'o_5',
'o_6',
'o_6d',
'o_7',
'o_7d',
'o_8',
's_1',
's_10',
's_11',
's_12',
's_13',
's_14',
's_14d',
's_15',
's_15d',
's_16',
's_2',
's_3',
's_4',
's_5',
's_6',
's_7',
's_8',
's_9',
'si_10',
'si_11',
'si_12',
'si_12d',
'si_13',
'si_13d',
'si_14',
'si_2',
'si_3',
'si_4',
'si_5',
'si_6',
'si_7',
'si_8',
'si_9']
In [13]:
help(ch.radLoss)
Help on class radLoss in module chianti.core.RadLoss:
class radLoss(chianti.core._SpecTrails._specTrails)
| Calculate the emission spectrum as a function of temperature and density.
|
| includes elemental abundances or ionization equilibria
|
| temperature and density can be arrays but, unless the size of either is one (1),
| the two must have the same size
|
| the returned spectrum will be convolved with a filter of the specified width on the
| specified wavelength array
|
| the default filter is gaussianR with a resolving power of 1000. Other filters,
| such as gaussian, box and lorentz, are available in chianti.filters. When using the box filter,
| the width should equal the wavelength interval to keep the units of the continuum and line
| spectrum the same.
|
| A selection of ions can be make with ionList containing the names of
| the desired lines in Chianti notation, i.e. C VI = c_6
|
| a minimum abundance can be specified so that the calculation can be speeded up by excluding
| elements with a low abundance. With solar photospheric abundances -
|
| setting minAbund = 1.e-4 will include H, He, C, O, Ne
| setting minAbund = 2.e-5 adds N, Mg, Si, S, Fe
| setting minAbund = 1.e-6 adds Na, Al, Ar, Ca, Ni
|
| Setting em will multiply the spectrum at each temperature by the value of em.
|
| em [for emission measure], can be a float or an array of the same length as the
| temperature/density.
|
| Method resolution order:
| radLoss
| chianti.core._SpecTrails._specTrails
| builtins.object
|
| Methods defined here:
|
| __init__(self, temperature, eDensity, elementList=0, ionList=0, minAbund=0, doContinuum=1, abundanceName=0, verbose=0, allLines=1, keepIons=0)
| Initialize self. See help(type(self)) for accurate signature.
|
| radLossPlot(self)
| to plot the radiative losses vs temperature
|
| ----------------------------------------------------------------------
| Methods inherited from chianti.core._SpecTrails._specTrails:
|
| convolve(self, wavelength=0, filter=(<function gaussianR at 0x180af36048>, 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(self, elementList=0, ionList=0, minAbund=0, 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
|
| lineSpectrumPlot(self, index=0, integrated=0, saveFile=0, linLog='lin')
| to plot the line spectrum as a function of wavelength
|
| spectrumPlot(self, index=-1, integrated=0, saveFile=0, linLog='lin')
| to plot the spectrum as a function of wavelength
|
| ----------------------------------------------------------------------
| Data descriptors inherited from chianti.core._SpecTrails._specTrails:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
In [24]:
import chianti.filters as chfilters
temperature = [1.e+6, 2.e+6]
density = 1.e+9
wvl = 200. + 0.05 * np.arange(2001)
emeasure = [1.e+27 ,1.e+27]
s = ch.spectrum(temperature, density, wvl, filter = (chfilters.gaussian,.2), em = emeasure, doContinuum=0, minAbund=1.e-5)
subplot(311)
plot(wvl, s.Spectrum['integrated'])
subplot(312)
plot(wvl, s.Spectrum['intensity'][0])
subplot(313)
plot(wvl, s.Spectrum['intensity'][1])
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-24-05d1f0221cde> in <module>()
4 wvl = 200. + 0.05 * np.arange(2001)
5 emeasure = [1.e+27 ,1.e+27]
----> 6 s = ch.spectrum(temperature, density, wvl, filter = (chfilters.gaussian,.2), em = emeasure, doContinuum=0, minAbund=1.e-5)
7 subplot(311)
8 plot(wvl, s.Spectrum['integrated'])
/usr/local/products/ChiantiPy/0.7.0/chiantipy/chianti/core/Spectrum.py in __init__(self, temperature, eDensity, wavelength, filter, label, elementList, ionList, minAbund, doContinuum, em, keepIons, abundanceName, verbose, allLines)
209 print(' calculating spectrum for : %s'%(akey))
210 thisIon = chianti.core.ion(akey, temperature, eDensity, abundanceName=self.AbundanceName)
--> 211 thisIon.intensity(wvlRange=wvlRange, allLines=allLines, em=em)
212 self.IonsCalculated.append(akey)
213 if 'errorMessage' not in list(thisIon.Intensity.keys()):
/usr/local/products/ChiantiPy/0.7.0/chiantipy/chianti/core/Ion.py in intensity(self, wvlRange, allLines, em)
3416 else:
3417 self.ioneqOne()
-> 3418 thisIoneq=self.IoneqOne
3419 # try:
3420 # nwvl, ntempden = emissivity.shape
AttributeError: 'ion' object has no attribute 'IoneqOne'
In [ ]:
print()
Content source: blanton144/exex
Similar notebooks: