Elemental abundances¶
Abundance patterns¶
- class PyAstronomy.pyasl.AbundancePatterns¶
This class provides widely adopted patterns of (number) abundances.
Data are from https://heasarc.gsfc.nasa.gov/docs/xanadu/xspec/manual/XSabund.html
The following abundance patterns are available:
angr, from Anders E. & Grevesse N. (1989, Geochimica et Cosmochimica Acta 53, 197)
aspl, from Asplund M., Grevesse N., Sauval A.J. & Scott P. (2009, ARAA, 47, 481)
feld, from Feldman U.(1992, Physica Scripta 46, 202 except for elements not listed which are given grsa abundances),
aneb, from Anders E. & Ebihara (1982, Geochimica et Cosmochimica Acta 46, 2363),
grsa from Grevesse, N. & Sauval, A.J. (1998, Space Science Reviews 85, 161)
wilm from Wilms, Allen & McCray (2000, ApJ 542, 914 except for elements not listed which are given zero abundance)
lodd from Lodders, K (2003, ApJ 591, 1220)
lgpp from Lodders K., Palme H., Gail H.P. (2009, Landolt-Börnstein, New Series, vol VI/4B) (Photospheric, using Table 4)
lpgs from same as lgpp (Proto-solar, using Table 10)
Methods
abundance
(element[, pat])Get the abundance of a specific element.
Returns the names (abbreviations) of the available abundance patterns.
Return atomic weight pattern
pattern
(name[, form, key])Get the elemental abundance pattern
patternByMass
(name[, awp, key])Get abundance of element in units of mass.
- abundance(element, pat='angr')¶
Get the abundance of a specific element.
- Parameters
- elementint or string
If an integer is given, it is interpreted as the atomic number. If a string is given, it is the elemental symbol (e.g., H, He).
- patstring, optional
The name of the abundance table.
- Returns
- abundancefloat
Number abundance of specified element relative to hydrogen.
- availablePatterns()¶
Returns the names (abbreviations) of the available abundance patterns.
- Returns
- namesarray of strings
The names of the available abundance patterns.
- getAtomicWeightPattern(awp)¶
Return atomic weight pattern
- Returns
- Patterndictionary
Dictionary mapping atomic number to standard atomic weight.
- pattern(name, form='array', key='symbol')¶
Get the elemental abundance pattern
- Parameters
- namestring
The abbreviation of the abundance pattern.
- formstring, {array, dict}, optional
Return the abundances as a plain array or as a dictionary. The default is ‘array’.
- keystring, {symbol, number}, optional
If return type is a dictionary, this parameter determined whether the elemental symbol or the atomic number is used as the key. The default is “symbol”.
- Returns
- abundancesnumpy array or dict (depending on ``form’’)
Number abundances (not mass) relative to H.
- patternByMass(name, awp=None, key='symbol')¶
Get abundance of element in units of mass.
Relative number abundances are converted into mass fractions based on standard atomic weights.
- Parameters
- namestring
The abbreviation of the abundance pattern.
- awpdictionary, optional
Atomic weight pattern. Dictionary mapping atomic number to standard atomic weight. If None, data for from the mendeleev package will be used.
- keystring, {symbol, number}, optional
This parameter determines whether the elemental symbol or the atomic number is used as the key in the return dictionary. The default is “symbol”.
- Returns
- Patterndictionary
Dictionary mapping atomic number to the respective fraction of mass
Example of usage¶
from __future__ import print_function, division
from PyAstronomy import pyasl
ap = pyasl.AbundancePatterns()
print("Names of the available abundance patterns:")
print(ap.availablePatterns())
print()
print("Get the Asplund et al. pattern (aspl) as a dictionary using")
print("atomic number as a key:")
print(ap.pattern("aspl", form="dict", key="number"))
print()
print("Get (relative) number abundance of oxygen using elemental symbol:")
print(ap.abundance("O", pat="wilm"))
print("or atomic number")
print(ap.abundance(8, pat="wilm"))
print()
for el, ab in ap.patternByMass("aspl", key="symbol").items():
print(f"Element: {el} with mass fraction of {ab}")