PyNeb
1.1.2
PyNeb Reference Manua
|
Inherits object.
Public Member Functions | |
def | __init__ |
def | getOmega |
def | getCollRates |
def | getTransition |
def | printTransition (self, wave) |
def | printSources (self) |
def | getSources (self) |
def | getA |
def | getPopulations |
def | getLowDensRatio |
def | getHighDensRatio |
def | getDensityRange |
def | getCritDensity |
def | getEmissivity |
def | getTemDen |
def | getIonAbundance |
def | printIonic |
def | printTemDen |
def | plotEmiss |
def | plotGrotrian |
def | __repr__ (self) |
Define the atom object, fill it with data, explore the data, and compute quantities such as level populations and line emissivities.
def __init__ | ( | self, | |
elem = None , |
|||
spec = None , |
|||
atom = None , |
|||
OmegaInterp = 'Linear' , |
|||
noExtrapol = False , |
|||
NLevels = None |
|||
) |
Atom constructor Parameters: - elem symbol of the selected element - spec ionization stage in spectroscopic notation (I = 1, II = 2, etc.) - atom ion (e.g. 'O3'). - OmegaInterp one of ('Cheb', 'Linear'). Default is Linear. "Cheb" works only for fits files. - noExtrapol if set to False (default), Omega will be extrapolated above and below the highest and lowest temperatures where it is defined. If set to True a NaN will be return. Usage: O3 = pn.Atom('O',3) N2 = pn.Atom(atom='N2') S2 = pn.Atom(atom='S2', OmegaInterp='Linear')
def __repr__ | ( | self | ) |
def getA | ( | self, | |
lev_i = -1 , |
|||
lev_j = -1 , |
|||
wave = -1 |
|||
) |
Return the transition probability data. If no arguments are given, the whole array of A is returned. A specific A value can be obtained by giving either the upper and lower levels or the wavelength of the transition (keyword wave). Usage: A_O3 = O3.getA() # The whole A array is stored in A_O3 O3.getA(4, 2) # A(4, 2) of the O3 atom is printed O3.getA(2, 4) # Returns 0 O3.getA(wave=4959) Parameters: - lev_i upper level of transition (default= -1, returns complete array) - lev_j lower level of transition (default= -1, returns complete array) - wave wavelength of transition. Takes precedence on lev_i and lev_j. Ignored if not set.
def getCollRates | ( | self, | |
tem, | |||
NLevels = None |
|||
) |
Return (n_levels x n_levels) array of collision rates at given temperature. Usage: O3.getCollRates(tem=10000) O3.getCollRates([8e3, 1e4, 1.2e4]) Parameters: - tem electronic temperature in K. May be an array.
def getCritDensity | ( | self, | |
tem, | |||
level = -1 |
|||
) |
Return the critical density of selected level at given temperature. If no transition is selected, return complete array. Usage: O3.getCritDensity(12000) O3.getCritDensity(12000, 4) Parameters: - tem electronic temperature in K. May be an array. - level selected atomic level (default= -1)
def getDensityRange | ( | self, | |
lev_i1 = -1 , |
|||
lev_i2 = -1 , |
|||
lev_j1 = -1 , |
|||
lev_j2 = -1 , |
|||
wave1 = -1 , |
|||
wave2 = -1 , |
|||
to_eval = None , |
|||
tol = 0.1 , |
|||
tem = 1e4 |
|||
) |
Return the range of density where a given line ratio is between 10% and 90% of the low and high density limits
def getEmissivity | ( | self, | |
tem, | |||
den, | |||
lev_i = -1 , |
|||
lev_j = -1 , |
|||
wave = -1 , |
|||
product = True |
|||
) |
Return the line emissivity of selected transition or complete array of emissivities The transition is selected by the argument wave (if given); if wave is not supplied, it is selected by the upper and lower levels (lev_i and lev_j); if neither is given, the whole array is computed Usage: O3.getEmissivity(12000, 100, 4, 2) # (4, 2) transition O3.getEmissivity(10000, 10000, wave=5007) # (4, 2) transition O3.getEmissivity(12000, 100) # all transitions O3.getEmissivity([10000, 12000], [100, 500], 4, 2) O3.getEmissivity([10000, 12000], [100, 500]) Parameters: - tem electronic temperature in K. May be an array. - den electronic density in cm^-3. May be an array. - lev_i upper level (default= -1) - lev_j lower level (default= -1) - wave wavelength of transition. Takes precedence on lev_i and lev_j if set, ignored otherwise. It can also be a blend label. - product Boolean. If True (default), all the combination of (tem, den) are used. If False, tem and den must have the same size and are joined.
def getHighDensRatio | ( | self, | |
lev_i1 = -1 , |
|||
lev_i2 = -1 , |
|||
lev_j1 = -1 , |
|||
lev_j2 = -1 , |
|||
wave1 = -1 , |
|||
wave2 = -1 , |
|||
to_eval = None |
|||
) |
Return the value of a diagostic ratio at the high density limit S2.getHighDensRatio(lev_i1 = 3, lev_i2 = 2) S2.getHighDensRatio(wave1 = 6716, wave2 = 6731) S2.getHighDensRatio(to_eval = 'L(6716)/L(6731)')
def getIonAbundance | ( | self, | |
int_ratio, | |||
tem, | |||
den, | |||
lev_i = -1 , |
|||
lev_j = -1 , |
|||
wave = -1 , |
|||
to_eval = None , |
|||
Hbeta = 100. |
|||
) |
Compute the ionic abundance relative to H+ given the intensity of a line or sum of lines, the temperature, and the density. The line can be specified as a transition (i.e., giving the two atomic level involved), as a wavelength, or as an algebraic expression. In the last case, a sum of lines can also be supplied. Usage: O3.getIonAbundance(100, 1.5e4, 100., wave=5007) O3.getIonAbundance(130, 1.5e4, 100., to_eval='I(4,3) + I(4,2)') O3.getIonAbundance(np.array([100, 150]), np.array([1.5e4, 1.2e4]), np.array([100., 120]), wave=5007) O2.getIonAbundance(int_ratio=100, tem=1.5e4, den=100., to_eval='L(3726)+L(3729)') Parameters: - int_ratio relative line intensity (default normalization: Hbeta = 100). May be an array. - tem electronic temperature in K. May be an array. - den electronic density in cm^-3. May be an array. - lev_i upper level of transition - lev_j lower level of transition - wave wavelength of transition. Takes precedence on lev_i and lev_j if set, ignored otherwise - to_eval expression to be evaluated. Takes precedence on wave if set, ignored otherwise. - Hbeta line intensity normalization at Hbeta (default Hbeta = 100)
def getLowDensRatio | ( | self, | |
lev_i1 = -1 , |
|||
lev_i2 = -1 , |
|||
wave1 = -1 , |
|||
wave2 = -1 , |
|||
to_eval = None |
|||
) |
Return the value of a diagostic ratio at the low density limit S2.getLowDensRatio(lev_i1 = 3, lev_i2 = 2) S2.getLowDensRatio(wave1 = 6716, wave2 = 6731) S2.getLowDensRatio(to_eval = 'L(6716)/L(6731)')
def getOmega | ( | self, | |
tem, | |||
lev_i = -1 , |
|||
lev_j = -1 , |
|||
wave = -1 |
|||
) |
Return interpolated value of the collision strength value at the given temperature for the complete array or a specified transition. If kappa is not None (non-maxwellian distribution of e-velocities), the collision strength is corrected as in Mendoza & Bautista, 2014 ApJ 785, 91. Usage: O3.getOmega(15000.) O3.getOmega([8e3, 1e4, 1.2e4]) O3.getOmega([8e3, 1e4, 1.2e4], 5, 4) Parameters: - tem electronic temperature in K. May be an array. - lev_i upper level - lev_j lower level
def getPopulations | ( | self, | |
tem, | |||
den, | |||
product = True , |
|||
NLevels = None |
|||
) |
Return array of populations at given temperature and density. The method returns a 1-, 2- or 3-D array containing the population of each level for all temperatures and densities specified in the input vectors tem and den (which can be n-element or 1-element vectors). If either quantity (tem or den) is a 1-element vector -that is, a single value-, the resulting population array is collapsed along that dimension; as a result, the result population array can be a 1-D, 2-D or 3-D array (the three cases corresponding to situations in which both tem and den are single values; one of them is a single value and the other an n-element vector; or both are multielement vectors, respectively). In the general case, the level index is the first [WARNING! It is not in physical unit, i.e. ground level = 0; to be normalized], followed by the temperature index (if it exists) and the density index. Usage: O3.getPopulations(1e4, 1e2) tem=np.array([10000., 12000., 15000., 20000]) # An array of four temperatures den=np.array([600., 800., 1000]) # An array of three densities O3.getPopulations(tem, den) # is a (6, 4, 3) array O3.getPopulations(tem, den)[0,2,1] # Returns the population of level 1 for T = 15000 and Ne = 800 tem = 20000 # tem is no longer an array O3.getPopulations(tem, den)[0,2,1] # Crashes: one index too much O3.getPopulations(tem, den)[0,1] # Returns the population of level 1 for T = 20000 and Ne = 800 [see warning] tem=np.array([10000., 15000., 20000]) # An array of three temperatures O3.getPopulations(tem, den, product = False)# is a (6, 3) array, tem and den beeing taken 2 by 2. Parameters: - tem electronic temperature in K - den electronic density in cm^-3 - product operate on all possible combinations of temperature and density (product = True, default case) or on those resulting from combining the i-th value of tem with the i-th value of den (product = False). If product = False, then tem and den must be the same size.
def getSources | ( | self | ) |
def getTemDen | ( | self, | |
int_ratio, | |||
tem = -1 , |
|||
den = -1 , |
|||
lev_i1 = -1 , |
|||
lev_j1 = -1 , |
|||
lev_i2 = -1 , |
|||
lev_j2 = -1 , |
|||
wave1 = -1 , |
|||
wave2 = -1 , |
|||
maxError = 1.e-3 , |
|||
method = 'nsect_recur' , |
|||
log = True , |
|||
start_x = -1 , |
|||
end_x = -1 , |
|||
to_eval = None , |
|||
nCut = 30 , |
|||
maxIter = 20 |
|||
) |
Return either the temperature or the density given the other variable for a selected line ratio of known intensity. The line ratio can involve two or more than two lines. In the first case (only two lines), it can be specified giving either two transitions (four atomic levels, i.e. two for each transition), or two wavelengths. In the general case (any number of lines), it can be specified as an algebraic expression to be evaluated, involving either atomic levels or wavelengths. An array of values, rather than a single value, can also be given, in which case the result will also be an array. Usage: O3.getTemDen(150., den=100., wave1=5007, wave2=4363, maxError=1.e-2) O3.getTemDen(150., den=100., to_eval = '(I(4,3) + I(4,2) + I(4,1)) / I(5,4)') N2.getTemDen(150., den=100., to_eval = '(L(6584) + L(6548)) / L(5755)') O3.getTemDen([0.02, 0.04], den=[1.e4, 1.1e4], to_eval="I(5, 4) / (I(4, 3) + I(4, 2))") Parameters: - int_ratio intensity ratio of the selected transition - tem electronic temperature - den electronic density - lev_i1 upper level of 1st transition - lev_j1 lower level of 1st transition - lev_i2 upper level of 2nd transition - lev_j2 lower level of 2nd transition - wave1 wavelength of 1st transition - wave2 wavelength of 2nd transition - maxError tolerance on difference between input and computed ratio - method numerical method for finding the root (nsect_recur, nsect_iter) - log switch of log (default = True). start_x and end_x are using this parameter. - start_x lower end of the interval to explore. (default: lower end of collision strength temperature array for temperature, 1 if density) - end_x higher end of the interval to explore. (default: higher end of collision strength temperature array for temperature, 1e8 if density) - to_eval expression to be evaluated, using either I (for transitions identified through atomic levels) or L (for transitions identified through wavelengths) - nCut number of sections in which each step is cut. 2 would be dichotomy. - maxIter maximum number of iterations
def getTransition | ( | self, | |
wave, | |||
maxErrorA = 5.e-3 , |
|||
maxErrorm = 5.e-2 |
|||
) |
Return the indexes (upper level, lower level) of a transition for a given atom from the wavelength. Usage: O3.getTransition(4959) Parameters: - wave wavelength in Angstrom (a float or a label: e.g., 5007, '5007A') or in micron (a label: '51.5m') - maxErrorA: tolerance if the input wavelength is in Angstrom - maxErrorm: tolerance if the input wavelength is in micron
def plotEmiss | ( | self, | |
tem_min = 1000 , |
|||
tem_max = 30000 , |
|||
ionic_abund = 1.0 , |
|||
den = 1e3 , |
|||
style = '-' , |
|||
legend_loc = 4 , |
|||
temLog = False , |
|||
plot_total = False , |
|||
plot_only_total = False , |
|||
legend = True , |
|||
total_color = 'black' , |
|||
total_label = 'TOTAL' , |
|||
ax = None |
|||
) |
Plot the emissivity as a function of temperature of all the lines of the selected atom. Usage: O3.plotEmiss(tem_min=10000, tem_max=20000) Parameters: - tem_min minimum value of the temperature range to span (default=1000) - tem_max maximum value of the temperature range to span (default=30000) - ionic_abund relative ionic abundance (default = 1.0) - den electron density - style line style of the plot (default: '-' [solid line]) - legend_loc localization of the legend (default: 4 = lower right; see plt.legend for more details) - temLog linear (False) or logarithmic temperature axis (default = False) - plot_total flag to also plot total emissivity (default = False) - plot_only_total flag to only plot total emissivity (default = False) - legend flag to place legend (default = True) - total_color color of the total emissivity (default = 'black') - total_label label of the total emissivity (default = 'TOTAL') - ax axis where to send the plot. If None, a new axis is done
def plotGrotrian | ( | self, | |
tem = 1e4 , |
|||
den = 1e2 , |
|||
thresh_int = 1e-3 , |
|||
unit = 'eV' , |
|||
detailed = False , |
|||
ax = None |
|||
) |
Draw a Grotrian plot of the selected atom, labelling only lines above a pecified intensity threshold (relative to the most intense line). For ground state levels, the Russell-Saunders term symbol is also given. Usage: O3.plotGrotrian() Parameters: - tem temperature at which the intensity threshold is to be computed - den density at which the intensity threshold is to be computed - thresh_int intensity threshold (relative to the most intense line, default: 1.e-3) - unit one of 'eV' (default), '1/Ang' or 'Ryd' - ax axis where to plot the result
def printIonic | ( | self, | |
tem = None , |
|||
den = None , |
|||
printA = False , |
|||
printPop = True , |
|||
printCrit = True |
|||
) |
Print miscellaneous information (wavelengths, level populations, emissivities, critical densities) for given physical conditions. If an electron temperature is given, level critical densities can be printed (using printCrit=True) If an electron density is also given, line emissivities (also for Hbeta) are printed and level populations can be printed (using printPop=True) Usage: O3.printIonic() O3.printIonic(printA=True) O3.printIonic(tem=10000., printCrit=True) O3.printIonic(tem=10000., den=1e3, printA=True, printPop=True, printCrit=True) Parameters: - tem temperature - den density - printA also print transition probabilities (default=False) - printPop also print level populations (needs tem and den) - printCrit also print critical densities (needs tem)
def printSources | ( | self | ) |
def printTemDen | ( | self, | |
int_ratio, | |||
tem = -1 , |
|||
den = -1 , |
|||
lev_i1 = -1 , |
|||
lev_j1 = -1 , |
|||
lev_i2 = -1 , |
|||
lev_j2 = -1 , |
|||
wave1 = -1 , |
|||
wave2 = -1 , |
|||
maxError = 1.e-3 , |
|||
method = 'nsect_recur' , |
|||
log = True , |
|||
start_x = -1 , |
|||
end_x = -1 , |
|||
to_eval = None , |
|||
nCut = 30 , |
|||
maxIter = 20 |
|||
) |
Print result of getTemDen function. See getTemDen for more details. Usage: O3.printTemDen(100, tem=10000, wave1=5007, wave2=4363) Parameters: - int_ratio intensity ratio of the selected transition - tem electronic temperature - den electronic density - lev_i1 upper level of 1st transition - lev_j1 lower level of 1st transition - lev_i2 upper level of 2nd transition - lev_j2 lower level of 2nd transition - wave1 wavelength of 1st transition - wave2 wavelength of 2nd transition - maxError tolerance on difference between input and computed ratio - method numerical method for finding the root (nsect_recur, nsect_iter) - log log switch (default = True) - start_x lower end of the interval to explore (default: lower end of collision strength temperature array) - end_x higher end of the interval to explore (default: higher end of collision strength temperature array) - to_eval expression to be evaluated, using either I (for transitions identified through atomic levels) or L (for transitions identified through wavelengths) - nCut number of sections in which each step is cut. 2 would be dichotomy. - maxIter maximum number of iterations
def printTransition | ( | self, | |
wave | |||
) |
Print info on transition associated to input wavelength. Usage: O3.printTransition(4959) Parameters: - wave wavelength in Angstrom (a float or a label: e.g., 5007, '5007A') or in micron (a label: '51.5m')
atom |
AtomData |
atomFile |
atomFileType |
atomFitsFile |
atomFitsPath |
AtomHeader |
atomNLevels |
atomPath |
calling |
CollData |
collFile |
collFileType |
collFitsFile |
collFitsPath |
CollHeader |
collNLevels |
collPath |
elem |
energy_eV |
energy_Ryd |
EnergyNLevels |
getEnergy |
getOmegaArray |
getStatWeight |
getTemArray |
gs |
IP |
IP_up |
is_valid |
lineList |
log_ |
name |
NIST |
NLevels |
source |
spec |
tem_units |
type |
wave_Ang |
Z |