Initial Abundance Main Class

IniAbu Initial Abundance Class

class iniabu.main.IniAbu(database='lodders09', unit='num_lin')

Initialize the IniAbu class.

By default, the lodders09 database is read in. Available databases are:

  • asplund09: Asplund et al. (2009), doi: 10.1146/annurev.astro.46.060407.145222

  • lodders09: Lodders et al. (2009), doi: 10.1007/978-3-540-88055-4_34

  • nist: Current (as of 2020) NIST isotopic abundances.

For detailed examples, see: https://iniabu.readthedocs.io/

Example:
>>> from iniabu import ini
>>> ini.iso["Ne"].name
['Ne-20', 'Ne-21', 'Ne-22']
>>> ini.iso["Ne"].abu_solar
array([3060000.,    7330.,  225000.])
>>> ini.iso_delta("Si-30", "Si-28", 0.02)
-403.23624595469255
property database

Get / Set the current database.

Setting a new database does not change the units that are currently loaded. You will get a message printed on what these units are.

Setter:

Database to set.

Type:

str

Returns:

Name of the loaded database.

Return type:

str

Example:
>>> from iniabu import ini  # loads with default ("lodders09")
>>> ini.database = "nist"  # change database to "nist"
>>> ini.database
'nist'
>>> ini.database = "lodders09"  # simple switch back!
property ele

Get information for a specific element.

Calls the :class`iniabu.elements.Elements`. This handler represents a convenient way to dig through elemental information. More information and a full list of properties can be found in the Elements class.

Returns:

Returns a ProxyList initialized with the required element

Return type:

class

Example:
>>> from iniabu import ini
>>> # get the solar abundance of silicon
>>> ini.ele["Si"].abu_solar
999700.0
>>> # get a numpy array of the solar abundance of two elements
>>> ini.ele[["Fe", "Ni"]].abu_solar
array([847990.,  49093.])
>>> # get a list of all atomic numbers for isotopes of helium
>>> ini.ele["He"].iso_a
array([3, 4])
>>> # similarly, query isotopes relative abundances, and solar abundances
>>> ini.ele["He"].iso_abu_rel
array([1.66000e-04, 9.99834e-01])
>>> ini.ele["He"].iso_abu_solar
array([1.03e+06, 2.51e+09])
ele_bracket(nominator, denominator, value, mass_fraction=None)

Calculate the bracket ratio for a given element ratio and a value.

The bracket notation is the usual astronomy / logarithmic ratio, defined as:

result = log10(measured value) - log10(solar ratio)

Nominator and denominator have the same restrictions as for the ele_ratio method. If one element ratio is defined but multiple values, the isotope ratio for all values is calculated and returned as a numpy array. If more than one element ratio is defined, the same number of values must be supplied as there are element ratios defined.

Parameters:
  • nominator (str,list) – Element(s) in nominator.

  • denominator (str,list) – Element(s) in denominator.

  • value (float,ndarray) – Value(s) to calculate bracket notation value with respect to.

  • mass_fraction (bool) – Are the given values in mass fractions? Defaults to None, which makes it dependent on the units that are currently loaded. The loaded setting can be overwritten by setting mass_fraction=True or mass_fraction=False.

Returns:

Bracket notation expression of given values with respect to the solar system abundances.

Return type:

float,ndarray

Raises:

ValueError – Number of element ratios and number of values supplied are mismatched.

Example:
>>> from iniabu import ini
>>> ini.ele_bracket("Ne", "Si", 33)
1.0008802726402624
ele_delta(nominator, denominator, value, mass_fraction=None, delta_factor=1000.0)

Calculate the delta-value for a given element ratio and a value.

The delta-value is defined as:

result = (measured value / solar ratio - 1)

By default, the delta-value is multiplied by 1000, thus, expressing it in permil. Other factors can be chosen.

Nominator and denominator have the same restrictions as for the ele_ratio method. If one element ratio is defined but multiple values, the isotope ratio for all values is calculated and returned as a numpy array. If more than one element ratio is defined, the same number of values must be supplied as there are element ratios defined.

Parameters:
  • nominator (str,list) – Element(s) in nominator.

  • denominator (str,list) – Element(s) in denominator.

  • value (float,ndarray) – Value(s) to calculate delta-value with respect to.

  • mass_fraction (bool) – Are the given values in mass fractions? Defaults to None, which makes it dependent on the units that are currently loaded. The loaded setting can be overwritten by setting mass_fraction=True or mass_fraction=False.

  • delta_factor – What value should the delta value be multiplied with? Defaults to 1000 to return results in permil.

  • delta_factor – float

Returns:

Delta-values of given values with respect to the solar system abundances, multiplied by delta_factor (by default, returns delta-values in permil).

Return type:

float,ndarray

Raises:

ValueError – Number of element ratios and number of values supplied are mismatched.

Example:
>>> from iniabu import ini
>>> ini.ele_delta("Ne", "Si", 3.4)
32.39347210030586
property ele_dict

Get the element dictionary.

The dictionary keys are element symbols, e.g., “H”. The entries for the element dictionary are a list containing the following entries (in order):

  • Solar abundance

  • ndarray with mass numbers of all isotopes

  • ndarray with relative abundances of all isotopes

  • ndarray with solar abundances of all isotopes

Returns:

Element dictionary

Return type:

dict

property ele_dict_log

Get the element dictionary with logarithmic solar abundances.

The dictionary keys are element symbols, e.g., “H”. The entries for the element dictionary are a list containing the following entries (in order):

  • Solar abundance (log)

  • ndarray with mass numbers of all isotopes

  • ndarray with relative abundances of all isotopes

  • ndarray with solar abundances of all isotopes (log)

Returns:

Element dictionary

Return type:

dict

property ele_dict_mf

Get the element dictionary with mass fractions.

The dictionary keys are element symbols, e.g., “H”. The entries for the element dictionary are a list containing the following entries (in order):

  • Solar abundance (mass fractions)

  • ndarray with mass numbers of all isotopes

  • ndarray with relative abundances of all isotopes

  • ndarray with solar abundances of all isotopes (mass fractions)

Returns:

Element dictionary

Return type:

dict

ele_ratio(nominator, denominator, mass_fraction=None)

Get the ratios of given elements.

Nominator and denominator can be element names or lists of element names (if more than one ratio should be calculated). If the denominator is a list, its length must be identical to the list in the nominator.

Parameters:
  • nominator (str,list) – Element or list of elements in nominator of ratio.

  • denominator (str,list) – Element or list of elements in denominator of ratio.

  • mass_fraction (bool) – Are the given values in mass fractions? Defaults to None, which makes it dependent on the units that are currently loaded. The loaded setting can be overwritten by setting mass_fraction=True or mass_fraction=False.

Returns:

The element ratio or a numpy array of the requested ratios.

Return type:

float,ndarray

Raises:

ValueError – Denominator is a list with more than one entry and does not have the same length as the nominator.

Example:
>>> from iniabu import ini
>>> # Calculate H/He ratio
>>> ini.ele_ratio("H", "He")
10.314692775474606
>>> # Calculate same ratio as mass fraction
>>> ini.ele_ratio("H", "He", mass_fraction=True)
2.597460199709773
>>> # Calculate ratios with multiple elements
>>> ini.ele_ratio(["H", "He", "Al"], ["Si"])
array([2.59082755e+04, 2.51178354e+03, 8.46253876e-02])
>>> # Multiple ratios at the same time
>>> ini.ele_ratio(["H", "He"], ["He", "H"])
array([10.31469278,  0.09694908])
>>> # The result when the solar abundance of an element is not avaialble
>>> ini.database = "nist"
>>> ini.ele_ratio("H", "He")
nan
>>> ini.database = "lodders09"  # set back to default and check again
>>> ini.ele_ratio("H", "He")
10.314692775474606
property iso

Get information for a specific isotope.

Calls the :class`iniabu.isotopes.Isotopes`. This handler represents a convenient way to dig through isotopic information. More information and a full list of properties can be found in the Isotopes class.

Returns:

Returns a ProxyList initialized with the required element

Return type:

class

Example:
>>> from iniabu import ini
>>> # get the solar abundance of Si-28
>>> ini.iso["Si-28"].abu_solar
922000.0
>>> # get a numpy array of the solar abundance of two isotopes
>>> ini.iso[["Fe-56", "Ni-60"]].abu_solar
array([778000.,  12900.])
>>> # similarly, query relative abundance(s) of isotope(s)
>>> ini.iso["He-4"].abu_rel
0.999834
>>> ini.iso[["H-2", "He-3"]].abu_rel
array([1.94e-05, 1.66e-04])
iso_bracket(nominator, denominator, value, mass_fraction=None)

Calculate the bracket ratio for a given isotope ratio and a value.

The bracket notation is the usual astronomy / logarithmic ratio, defined as:

result = log10(measured value) - log10(solar ratio)

Nominator and denominator have the same restrictions as for the ele_ratio method. If one isotope ratio is defined but multiple values, the isotope ratio for all values is calculated and returned as a numpy array. If more than one isotope ratio is defined, the same number of values must be supplied as there are isotope ratios defined.

Parameters:
  • nominator (str,list) – Isotope(s) in nominator.

  • denominator (str,list) – Isotope(s) in denominator.

  • value (float,ndarray) – Value(s) to calculate bracket notation value with respect to.

  • mass_fraction (bool) – Are the given values in mass fractions? Defaults to None, which makes it dependent on the units that are currently loaded. The loaded setting can be overwritten by setting mass_fraction=True or mass_fraction=False.

Returns:

Bracket notation expression of given values with respect to the solar system abundances.

Return type:

float,ndarray

Raises:

ValueError – Number of element ratios and number of values supplied are mismatched.

Example:
>>> from iniabu import ini
>>> ini.iso_bracket("Ne-21", "Ne-20", 2.397)
3.0002854858741057
iso_delta(nominator, denominator, value, mass_fraction=None, delta_factor=1000.0)

Calculate the delta-value for a given isotope ratio and a value.

The delta-value is defined as:

result = (measured value / solar ratio - 1)

By default, the delta-value is multiplied by 1000, thus, expressing it in permil. Other factors can be chosen.

Nominator and denominator have the same restrictions as for the ele_ratio method. If one isotope ratio is defined but multiple values, the isotope ratio for all values is calculated and returned as a numpy array. If more than one isotope ratio is defined, the same number of values must be supplied as there are isotope ratios defined.

Parameters:
  • nominator (str,list) – Isotope(s) in nominator.

  • denominator (str,list) – Isotope(s) in denominator.

  • value (float,ndarray) – Value(s) to calculate delta-value with respect to.

  • mass_fraction (bool) – Are the given values in mass fractions? Defaults to None, which makes it dependent on the units that are currently loaded. The loaded setting can be overwritten by setting mass_fraction=True or mass_fraction=False.

  • delta_factor – What value should the delta value be multiplied with? Defaults to 1000 to return results in permil.

  • delta_factor – float

Returns:

Delta-values of given values with respect to the solar system abundances, multiplied by delta_factor (by default, returns delta-values in permil).

Return type:

float,ndarray

Raises:

ValueError – Number of isotope ratios and number of values supplied are mismatched.

Example:
>>> from iniabu import ini
>>> ini.iso_delta("Ne-22", "Ne-20", 0.07, delta_factor=10000)
-479.9999999999993
>>> # For more than 1 ratio
>>> nominator_isos = ["Ne-21", "Ne-22"]
>>> values = [0.01, 0.07]  # values to compare with
>>> ini.iso_delta(nominator_isos, "Ne-20", values, delta_factor=10000)
array([31746.24829468,  -480.        ])
property iso_dict

Get the isotope dictionary.

The dictionary keys are isotope symbols, e.g., “H-1”. The entries for the isotope dictionary are a list containing the following entries (in order):

  • Relative abundance

  • Solar abundance

Returns:

Isotope dictionary

Return type:

dict

property iso_dict_log

Get the isotope dictionary with logarithmic solar abundances.

The dictionary keys are isotope symbols, e.g., “H-1”. The entries for the isotope dictionary are a list containing the following entries (in order):

  • Relative abundance

  • Solar abundance (log)

Returns:

Isotope dictionary

Return type:

dict

property iso_dict_mf

Get the isotope dictionary in mass fractions.

The dictionary keys are isotope symbols, e.g., “H-1”. The entries for the isotope dictionary are a list containing the following entries (in order):

  • Relative abundance

  • Solar abundance (mass fractions)

Returns:

Isotope dictionary

Return type:

dict

iso_int_norm(nominator, norm_isos, sample_values, sample_norm_values, delta_factor=10000, law='exp')

Calculate internally normalized value for isotope data with respect to solar.

The internally normalized value requires two normalizing isotopes. This normalization ratios the value to one normalization isotope and uses the second one to correct for mass-dependent fractionation. Details can be found in the background section of the documentation.

Note: A mass_fraction toggle, as for other routines, is useless here. Internal normalization, by definition, removes any fractionation effects due to mass.

An elemental routine analogous to this one does not make sense since elemental ratios do usually show other effects than mass dependent ones.

Parameters:
  • nominator (str or tuple/list(str)) – Name of the nominator isotope(s) to be used. Multiple can be selected at once by giving them as a list.

  • norm_isos (tuple/list(str, str)) – The names of the normalizing isotopes. First is the major normalizing isotope, i.e., the one that the sample value is ratioed to. The second one is the isotope that is used for correcting mass fractionation effects.

  • sample_values (float, ndarray/tuple/list(floats)) – The sample’s value(s) for the nominator isotope. Shape must match the nominator name and values must be in the same order.

  • sample_norm_values (tuple/list/ndarray(float, float)) – The sample’s values for the normalization isotopes. Same order as the normalization isotope names.

  • delta_factor (float) – What factor should the normalization be multiplied? Defaults to 10000 (for internally normalized epsilon values).

  • law (str) – Normalization law to use: Either “exp” for exponential low or “lin” for linear law. Defaults to “exp”

Returns:

Internally normalized delta-values multiplied with given factor. Returns as many values as given in nominator / sample_values.

Return type:

float, ndarray(float)

Raises:

ValueError – Input values are mismatched, selected law is not valid.

Example:
>>> from iniabu import ini
>>> # define input values
>>> norm_isos = ("Ni-58", "Ni-60") # normalizing isotopes
>>> sample_vals = (1., 0.4, 0.15, 0.5, 0.3)  # measured isotope abundances
>>> sample_norm_vals = (sample_vals[0], sample_vals[1])  # Ni-58, Ni-60
>>> # get the internally normalized values for all nickel isotopes
>>> ini.iso_int_norm("Ni", norm_isos, sample_vals, sample_norm_vals)
array([     0.        ,      0.        ,  75068.93030287,  77568.12815864,
       189333.87185102])
iso_ratio(nominator, denominator, mass_fraction=None)

Get the ratios of given isotopes.

Grabs the isotope ratios for nominator / denominator. If a list of nominator isotopes is given but only one denominator isotope, the ratio with that denominator is formed for each isotope. If both parameters are given as lists, they must be of equal length.

Parameters:
  • nominator (str,list) – Isotope / List of isotopes for nominator, in form: “Si-29”. If an element is given, all isotopes of this element are used. Lists of elements are not allowed.

  • denominator (str,list) – Isotope / List of isotopes for denominator, in form: “Si-29”. Alternatively, an element can be given, i.e., “Si”. In that case, the most abundant isotope is chosen. Lists of elements are not allowed.

  • mass_fraction (bool) – Are the given values in mass fractions? Defaults to None, which makes it dependent on the units that are currently loaded. The loaded setting can be overwritten by setting mass_fraction=True or mass_fraction=False.

Returns:

The isotope ratio or a numpy array of the requested ratios.

Return type:

float,ndarray

Raises:

ValueError – Denominator is a list with more than one entry and does not have the same length as the nominator.

Example:
>>> from iniabu import ini
>>> # calculate Ne-21 / Ne-20 isotope ratio
>>> ini.iso_ratio("Ne-21", "Ne-20")
0.002395424836601307
>>> # calculate isotope ratios for all Ne isotopes versus Ne-20
>>> ini.iso_ratio("Ne", "Ne-20")
array([1.        , 0.00239542, 0.07352941])
>>> # Isotope ratios for Ne-21 and Ne-22 versus most abundant Ne isotope
>>> ini.iso_ratio(["Ne-21", "Ne-22"], "Ne")
array([0.00239542, 0.07352941])
>>> # repeat this calculation assuming mass fractions
>>> ini.iso_ratio(["Ne-21", "Ne-22"], "Ne", mass_fraction=True)
array([0.00251541, 0.08088125])
>>> from iniabu import inimf
>>> # calculate Ne-21 / Ne-20 isotope ratio using mass fractions
>>> inimf.iso_ratio("Ne-21", "Ne-20")
0.002515409891030499
>>> # calculate the same ratio in number fractions
>>> inimf.iso_ratio("Ne-21", "Ne-20", mass_fraction=False)
0.002395424836601307
property norm_isos: dict

Get / Set user defined normalization isotopes.

Note

If you set the norm_isos multiple times, it will not be overwritten. Keys will rather be added to the dictionary. To reset it, please use the function ini.reset_norm_isos().

Setter:

A dictionary with your normalization isotope per element.

Returns:

The dictionary with user defined normalization isotopes.

Example:
>>> from iniabu import ini
>>> ini.norm_isos
{}
>>> ini.norm_isos = {"Ba": "Ba-136"}
>>> ini.norm_isos
{'Ba': 'Ba-136'}
>>> ini.norm_isos = {"Si": "Si-29"}
>>> ini.norm_isos
{'Ba': 'Ba-136', 'Si': 'Si-29'}
>>> ini.reset_norm_isos()
>>> ini.norm_isos
{}
reset_norm_isos()

Reset the user defined normalization isotopes.

This will result in the normalization isotopes to be simple a empty dictionary again.

Example:
>>> from iniabu import ini
>>> ini.norm_isos = {"Ba": "Ba-136"}
>>> ini.norm_isos
{'Ba': 'Ba-136'}
>>> ini.reset_norm_isos()
>>> ini.norm_isos
{}
property unit

Get / Set the unit for the solar abundances.

Routine to easily switch the database between the default linear number abundances, normed to Si with an abundance of 1e6 (num_lin, typically used in cosmo- and geochemistry studies), the logarithmic (num_log, typically used in astronomy) abundance units, normed to H as 12, or mass fractions massf, normed such that all elements sum up to unity.

Setter:

Unit to set, either “num_lin” (default), “num_log”, or “mass_fraction”.

Type:

str

Returns:

Currently set unit.

Return type:

str

Example:
>>> from iniabu import ini  # loads with default linear units
>>> ini.unit = "num_log"  # set logarithmic abundance unit
>>> ini.unit
'num_log'
>>> ini.ele["H"].abu_solar
12.0
>>> ini.unit = "num_lin"  # set back to default
>>> ini.unit
'num_lin'