Isopy Tutorial 1 - Arrays and Reference Values¶
In this tutorial we provide brief introduction to isopy arrays, reference values and ways to use them. For a thorough description of the functions and methods available see the
Before we start we have to import the isopy library and the numpy libraries,
import isopy
import numpy as np
Array Introduction¶
An isopy array is subclass of a numpy array with a number of special features aimed at working with geochemical data. The data is stored in rows and columns, each column has a key with a certain flavour describing the type of data it represents. There are 6 key string flavours, in order of priority, they are:
massconsists of a mass number. Only accepts positive integers. E.g"102"or \(102\)elementconsists of an element symbol. E.g"Pd"or \(\mathrm{Pd}\)isotopeconsists of a mass number followed by a element symbol. E.g"102Pd"or \({}^{102}\mathrm{Pd}\)moleculeconsists of multiple element and/or isotope keys. E.g."[H2O]"or \(\mathrm{H}_{2}\mathrm{O}\)ratioconsists of a numerator and a denominator key string. E.g."108Pd/105Pd"or \(\cfrac{{}^{108}\mathrm{Pd}}{{}^{105}\mathrm{Pd}}\)generalaccepts any string. E.g."whatever"or \(\mathrm{whatever}\)
The highest priority flavour, that the input string is compatible with, is used for the array. Each key string type adheres to a strict format but it is flexible with the formatting of the input string. For example the 102pd, Pd102 and palladium-102 will all yield the isotope key string 102Pd. You can read more about key strings in the here.
You can create arrays using the isopy.array() function,
data = {'ru': [1, 2], 'pd': [3, 4], 'cd': [5, 6]}
a = isopy.array(data); a # column keys inferred from the dictionary
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|
| 0 | 1.00000 | 3.00000 | 5.00000 |
| 1 | 2.00000 | 4.00000 | 6.00000 |
Indexing¶
You can index arrays using either the row number or the column key. You can also use the IsopyArray.get() method to fetch the column which will return a default value if a column does not exits in the array.
a['pd'] # key string automatically formatted
array([3., 4.])
a[1]
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|
| None | 2.00000 | 4.00000 | 6.00000 |
a.get('ge'), a.get('ge', 1)
(array([nan, nan]), array([1., 1.]))
Attributes & Methods¶
The nrows, ncols and the keys attributes will return the number of row, number of columns and the keys for each column in the array respectively. For a full list of attributes and methods see the IsopyArray documentation.
a.nrows, a.ncols, a.keys
(2, 3, IsopyKeyList('Ru', 'Pd', 'Cd', flavour='element'))
The IsopyArray.ratio() method will divide the value in each column with the value of the given column creating a new array with ratio column keys. The IsopyArray.deratio() method will reverse it.
b = a.ratio('pd'); b
| (row) | $\cfrac{\mathrm{Ru}}{\mathrm{Pd}}$ (f8) | $\cfrac{\mathrm{Cd}}{\mathrm{Pd}}$ (f8) |
|---|---|---|
| 0 | 0.33333 | 1.66667 |
| 1 | 0.50000 | 1.50000 |
b.deratio()
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|
| 0 | 0.33333 | 1.00000 | 1.66667 |
| 1 | 0.50000 | 1.00000 | 1.50000 |
The IsopyArray.normalise() method will by default normalise the array such that the sum of each row is equal to 1. You can also specify the normalisation value for a specific set of keys. Note that the method return a new array.
a.normalise()
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|
| 0 | 0.11111 | 0.33333 | 0.55556 |
| 1 | 0.16667 | 0.33333 | 0.50000 |
a.normalise([10], 'pd') # Renormalises each row so the Pd columns is equal to 10
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|
| 0 | 3.33333 | 10.00000 | 16.66667 |
| 1 | 5.00000 | 10.00000 | 15.00000 |
Finally, there are several functions for turning array into other data types. For example the IsopyArray.to_dict() method will convert the array to a dictionary, e.g.
a.to_dict()
{'Ru': [1.0, 2.0], 'Pd': [3.0, 4.0], 'Cd': [5.0, 6.0]}
Creating Arrays¶
Arrays can be created with the isopy.array() function. Each array must consist of data and a set of keys, if it cannot be inferred from the data.
isopy.array([[1, 3, 5], [2, 4, 6]],'ru pd cd')
isopy.array({'ru': [1, 2], 'pd': [3, 4], 'cd': [5, 6]})
isopy.array(ru = [1, 2], pd=[3, 4], cd=[5, 6])
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|
| 0 | 1.00000 | 3.00000 | 5.00000 |
| 1 | 2.00000 | 4.00000 | 6.00000 |
You can also create arrays from existing isopy arrays, structured numpy arrays and pandas dataframes. If the input is an isopy array isopy.array() will return a copy of the array while isopy.asarray() will return a reference to it, assuming it satisfies any other arguments given.
a = isopy.array([[1, 3, 5], [2, 4, 6]],'ru pd cd')
b = isopy.array(a)
c = isopy.asarray(a)
a is b, a is c
(False, True)
There are functions to create arrays filled with 0’s, 1’s or random numbers. See the Arrays for more details. For example an array filled with a normal distribution of random values can be created using the isopy.random() function
isopy.random(10, keys = 'ru pd cd')
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|
| 0 | 0.94193 | -0.84010 | -1.46872 |
| 1 | 0.84349 | 0.19054 | -0.92886 |
| 2 | -0.68974 | -1.30829 | 0.61475 |
| 3 | 1.32635 | 0.58710 | 0.21810 |
| 4 | -0.40937 | 0.32379 | 1.90051 |
| 5 | 1.31348 | -1.00570 | 0.00971 |
| 6 | 0.59463 | -0.27932 | -0.33032 |
| 7 | 0.34017 | -1.29789 | 0.12494 |
| 8 | -0.73290 | -0.63486 | -0.86405 |
| 9 | 3.10324 | -1.40903 | 0.66490 |
Arrays can be zero or one dimensional depending on the input. The ndim attribute can be used to check the number of dimensions of the array. If the array is 0-dimensional nrows will be have a value of -1.
isopy.array({'ru': [1], 'pd': [3], 'cd': [5]})
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|
| 0 | 1.00000 | 3.00000 | 5.00000 |
isopy.array({'ru': 1, 'pd': 3, 'cd': 5})
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|
| None | 1.00000 | 3.00000 | 5.00000 |
You can use the ndim keyword to specify the number of dimensions of the array. If ndim=-1 then the returned array will be 0-dimensional if possible otherwise 1-dimensional.
isopy.array({'ru': [1], 'pd': [3], 'cd': [5]}, ndim=-1)
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|
| None | 1.00000 | 3.00000 | 5.00000 |
By default the data type for python objects will be float64 if possible and otherwise whatever numpy suggests. The datatype is given in abbreviated in parenthesis next to the column key in the repr of the array. The data type of each column can also be found from the datatypes attribute.
isopy.array({'ru': [1, 2], 'pd': [3, 4], 'cd': [5, 6]}).datatypes
(dtype('float64'), dtype('float64'), dtype('float64'))
If you create an array from a numpy array them it will inherit the data type of the numpy array.
isopy.array({'ru': np.array([1, 2]), # dtype = int64
'pd': np.array([3, 4], dtype=np.float64),
'cd': np.array([5, 6], dtype=str)}).datatypes
(dtype('int64'), dtype('float64'), dtype('<U1'))
You can also specify the data type for each column using the dtype keyword. You can either pass a single datatype, that will be used for each column, or a list of datatypes, one for each column.
isopy.array({'ru': [1, 2], 'pd': [3, 4], 'cd': [5, 6]}, dtype=np.int64).datatypes
(dtype('int64'), dtype('int64'), dtype('int64'))
When creating an array the highest priority key string flavour, that the string is compatible with, is used for the column key. Optionally, you can specify the flavour of the column keys using the flavour key word, multiple flavours should be separated with a |.
isopy.array({'ru': [1, 2], 'pd': [3, 4], 'cd': [5, 6]}, flavour='general')
| (row) | $\mathrm{ru}$ (f8) | $\mathrm{pd}$ (f8) | $\mathrm{cd}$ (f8) |
|---|---|---|---|
| 0 | 1.00000 | 3.00000 | 5.00000 |
| 1 | 2.00000 | 4.00000 | 6.00000 |
Array Functions¶
We loosely define any function that accepts one or more values, performs a mathematical calculation and returns a new value as an array function. The simplest ones being the +, -, *, / and ** operators. These operators are fully supported by isopy arrays.
a = isopy.array({'ru': [1, 2], 'pd': [3, 4], 'cd': [5, 6]})
a * 2 # Multiplies each column by 2
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|
| 0 | 2.00000 | 6.00000 | 10.00000 |
| 1 | 4.00000 | 8.00000 | 12.00000 |
[1, 10] - a
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|
| 0 | 0.00000 | -2.00000 | -4.00000 |
| 1 | 8.00000 | 6.00000 | 4.00000 |
If combining two isopy arrays then the result will contain the combined keys of both arrays. A default value, nan, will be used for missing columns.
b = isopy.array([11, 12, 13], keys='ru ag cd')
a + b
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Ag}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|---|
| 0 | 12.00000 | nan | nan | 18.00000 |
| 1 | 13.00000 | nan | nan | 19.00000 |
You can set a temporary default value using the IsopyArray.default() method when performing calculations.
a.default(10) + b
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Ag}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|---|
| 0 | 12.00000 | nan | 22.00000 | 18.00000 |
| 1 | 13.00000 | nan | 22.00000 | 19.00000 |
Isopy arrays natively support a wide range of numpy functions. By default the result will be computed on each column and the result compiled into a new array. However, for functions that support it, you can set axis to None to compute the result over the entire array or 1 to compute the result for each row.
All the numpy functions that have been tested with isopy arrays are listed here.
np.sum(a)
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|
| None | 3.00000 | 7.00000 | 11.00000 |
np.sum(a, axis=None), np.sum(a, axis=1)
(21.0, array([ 9., 12.]))
All the numpy function that have been tested with isopy arrays are also avaliable from the isopy namespace. These functions have been enhanced so that they accept a keys argument where you can specify which keys the return array should have.
isopy.sum(a, keys='ru cd')
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|
| None | 3.00000 | 11.00000 |
In addition isopy also comes with a set of custom array functions documented here. For example the isopy.sd() and isopy.se() functions compute the standard deviation and standard error of the sample (1 degree of freedom), respectively.
c = isopy.random(100, keys='ru pd cd')
isopy.se(c) # The standard deviation of the distribution is 1 by default
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|
| None | 0.08599 | 0.09690 | 0.09187 |
These functions also allow you to specify the zscore or the confidence interval, ci, of a T distribution. E.g.
isopy.se(c, ci=0.95) # 95 % confidence interval
| (row) | $\mathrm{Ru}$ (f8) | $\mathrm{Pd}$ (f8) | $\mathrm{Cd}$ (f8) |
|---|---|---|---|
| None | 0.17063 | 0.19228 | 0.18230 |
Reference Values¶
Reference values are constants or literature values, such as the mass of each isotope, that are often used in calculations. There are, where appropriate, stored in a custom dictionary, with a few special features, as scalar values.
Isopy comes with several reference values, available in the refval namespace documented here. For convinience the repr of the isopy.refval object return a list of the avaliable reference values and a short description.
isopy.refval
isopy.refval.mass contains the following reference values
isotopes - Dictionary containing all naturally occuring isotopes with a given mass number.
isopy.refval.element contains the following reference values
isotopes - Dictionary containing all naturally occurring isotopes for each element symbol.
all_symbols - A tuple of all the element symbols.
symbol_name - Dictionary containing the full element name mapped to the element symbol.
name_symbol - Dictionary containing the element symbol mapped to the full element name.
atomic_weight - Dictionary containing the atomic weight for each element symbol.
atomic_number - Dictionary containing the atomic number for each element symbol.
initial_solar_system_abundance_L09 - Dictionary containing the element abundance of the initial solar system composition (normalized to N(Si) = 10^6 atoms) from Lodders et al. (2019).
isopy.refval.isotope contains the following reference values
mass - Dictionary containing the default mass of each isotope.
fraction - Dictionary containing the default fraction of each isotope.
mass_W17 - Dictionary containing isotope mass of each isotope from Wang et al. (2016).
mass_AME20 - Dictionary containing isotope mass of each isotope from the 2020 Atomic Mass Evaluation.
mass_number - Dictionary containing mass number of each isotope.
best_measurement_fraction_M16 - Dictionary containing the isotope fraction from the best avaliable measurement from Meija et al. (2016).
initial_solar_system_fraction_L09 - Dictionary containing the isotope fraction of the inital solar system composition from Lodders et al. (2019).
initial_solar_system_abundance_L09 - Dictionary containing the isotope abundance of the inital solar system composition (normalized to N(Si) = 10^6 atoms) from Lodders et al. (2019).
initial_solar_system_abundance_L09b - Dictionary containing the isotope abundance calcualted from the elemental abundance and the isotope fraction.
present_solar_system_fraction_AG89 - Dictionary containing the isotope fraction of the present solar system composition from Anders & Grevesse 1989.
initial_solar_system_abundance_AG89 - Dictionary containing the isotope abundance of the initial solar system abundance from Anders & Grevesse 1989.
present_solar_system_abundance_AG89 - Dictionary containing the isotope abundance of the present solar system abundance from Anders & Grevesse 1989.
sprocess_fraction_B11 - Dictionary containing the estimated s-process fraction of each isotope from Bisterzo et al. (2011).
There are two ways of retrieving the reference values that come with isopy. Directly though refval object or by passing the name to the isopy.asrefval() function. Note that the latter only works for reference values which contain scalars.
isopy.refval.isotope.fraction # or isopy.asrefval('isotope.fraction')
| (row) | ${}^{1}\mathrm{H}$ (f8) | ${}^{2}\mathrm{H}$ (f8) | ${}^{3}\mathrm{He}$ (f8) | ${}^{4}\mathrm{He}$ (f8) | ${}^{6}\mathrm{Li}$ (f8) | ${}^{7}\mathrm{Li}$ (f8) | ${}^{9}\mathrm{Be}$ (f8) | ${}^{10}\mathrm{B}$ (f8) | ${}^{11}\mathrm{B}$ (f8) | ${}^{12}\mathrm{C}$ (f8) | ${}^{13}\mathrm{C}$ (f8) | ${}^{14}\mathrm{N}$ (f8) | ${}^{15}\mathrm{N}$ (f8) | ${}^{16}\mathrm{O}$ (f8) | ${}^{17}\mathrm{O}$ (f8) | ${}^{18}\mathrm{O}$ (f8) | ${}^{19}\mathrm{F}$ (f8) | ${}^{20}\mathrm{Ne}$ (f8) | ${}^{21}\mathrm{Ne}$ (f8) | ${}^{22}\mathrm{Ne}$ (f8) | ${}^{23}\mathrm{Na}$ (f8) | ${}^{24}\mathrm{Mg}$ (f8) | ${}^{25}\mathrm{Mg}$ (f8) | ${}^{26}\mathrm{Mg}$ (f8) | ${}^{27}\mathrm{Al}$ (f8) | ${}^{28}\mathrm{Si}$ (f8) | ${}^{29}\mathrm{Si}$ (f8) | ${}^{30}\mathrm{Si}$ (f8) | ${}^{31}\mathrm{P}$ (f8) | ${}^{32}\mathrm{S}$ (f8) | ${}^{33}\mathrm{S}$ (f8) | ${}^{34}\mathrm{S}$ (f8) | ${}^{36}\mathrm{S}$ (f8) | ${}^{35}\mathrm{Cl}$ (f8) | ${}^{37}\mathrm{Cl}$ (f8) | ${}^{36}\mathrm{Ar}$ (f8) | ${}^{38}\mathrm{Ar}$ (f8) | ${}^{40}\mathrm{Ar}$ (f8) | ${}^{39}\mathrm{K}$ (f8) | ${}^{40}\mathrm{K}$ (f8) | ${}^{41}\mathrm{K}$ (f8) | ${}^{40}\mathrm{Ca}$ (f8) | ${}^{42}\mathrm{Ca}$ (f8) | ${}^{43}\mathrm{Ca}$ (f8) | ${}^{44}\mathrm{Ca}$ (f8) | ${}^{46}\mathrm{Ca}$ (f8) | ${}^{48}\mathrm{Ca}$ (f8) | ${}^{45}\mathrm{Sc}$ (f8) | ${}^{46}\mathrm{Ti}$ (f8) | ${}^{47}\mathrm{Ti}$ (f8) | ${}^{48}\mathrm{Ti}$ (f8) | ${}^{49}\mathrm{Ti}$ (f8) | ${}^{50}\mathrm{Ti}$ (f8) | ${}^{50}\mathrm{V}$ (f8) | ${}^{51}\mathrm{V}$ (f8) | ${}^{50}\mathrm{Cr}$ (f8) | ${}^{52}\mathrm{Cr}$ (f8) | ${}^{53}\mathrm{Cr}$ (f8) | ${}^{54}\mathrm{Cr}$ (f8) | ${}^{55}\mathrm{Mn}$ (f8) | ${}^{54}\mathrm{Fe}$ (f8) | ${}^{56}\mathrm{Fe}$ (f8) | ${}^{57}\mathrm{Fe}$ (f8) | ${}^{58}\mathrm{Fe}$ (f8) | ${}^{59}\mathrm{Co}$ (f8) | ${}^{58}\mathrm{Ni}$ (f8) | ${}^{60}\mathrm{Ni}$ (f8) | ${}^{61}\mathrm{Ni}$ (f8) | ${}^{62}\mathrm{Ni}$ (f8) | ${}^{64}\mathrm{Ni}$ (f8) | ${}^{63}\mathrm{Cu}$ (f8) | ${}^{65}\mathrm{Cu}$ (f8) | ${}^{64}\mathrm{Zn}$ (f8) | ${}^{66}\mathrm{Zn}$ (f8) | ${}^{67}\mathrm{Zn}$ (f8) | ${}^{68}\mathrm{Zn}$ (f8) | ${}^{70}\mathrm{Zn}$ (f8) | ${}^{69}\mathrm{Ga}$ (f8) | ${}^{71}\mathrm{Ga}$ (f8) | ${}^{70}\mathrm{Ge}$ (f8) | ${}^{72}\mathrm{Ge}$ (f8) | ${}^{73}\mathrm{Ge}$ (f8) | ${}^{74}\mathrm{Ge}$ (f8) | ${}^{76}\mathrm{Ge}$ (f8) | ${}^{75}\mathrm{As}$ (f8) | ${}^{74}\mathrm{Se}$ (f8) | ${}^{76}\mathrm{Se}$ (f8) | ${}^{77}\mathrm{Se}$ (f8) | ${}^{78}\mathrm{Se}$ (f8) | ${}^{80}\mathrm{Se}$ (f8) | ${}^{82}\mathrm{Se}$ (f8) | ${}^{79}\mathrm{Br}$ (f8) | ${}^{81}\mathrm{Br}$ (f8) | ${}^{78}\mathrm{Kr}$ (f8) | ${}^{80}\mathrm{Kr}$ (f8) | ${}^{82}\mathrm{Kr}$ (f8) | ${}^{83}\mathrm{Kr}$ (f8) | ${}^{84}\mathrm{Kr}$ (f8) | ${}^{86}\mathrm{Kr}$ (f8) | ${}^{85}\mathrm{Rb}$ (f8) | ${}^{87}\mathrm{Rb}$ (f8) | ${}^{84}\mathrm{Sr}$ (f8) | ${}^{86}\mathrm{Sr}$ (f8) | ${}^{87}\mathrm{Sr}$ (f8) | ${}^{88}\mathrm{Sr}$ (f8) | ${}^{89}\mathrm{Y}$ (f8) | ${}^{90}\mathrm{Zr}$ (f8) | ${}^{91}\mathrm{Zr}$ (f8) | ${}^{92}\mathrm{Zr}$ (f8) | ${}^{94}\mathrm{Zr}$ (f8) | ${}^{96}\mathrm{Zr}$ (f8) | ${}^{93}\mathrm{Nb}$ (f8) | ${}^{92}\mathrm{Mo}$ (f8) | ${}^{94}\mathrm{Mo}$ (f8) | ${}^{95}\mathrm{Mo}$ (f8) | ${}^{96}\mathrm{Mo}$ (f8) | ${}^{97}\mathrm{Mo}$ (f8) | ${}^{98}\mathrm{Mo}$ (f8) | ${}^{100}\mathrm{Mo}$ (f8) | ${}^{96}\mathrm{Ru}$ (f8) | ${}^{98}\mathrm{Ru}$ (f8) | ${}^{99}\mathrm{Ru}$ (f8) | ${}^{100}\mathrm{Ru}$ (f8) | ${}^{101}\mathrm{Ru}$ (f8) | ${}^{102}\mathrm{Ru}$ (f8) | ${}^{104}\mathrm{Ru}$ (f8) | ${}^{103}\mathrm{Rh}$ (f8) | ${}^{102}\mathrm{Pd}$ (f8) | ${}^{104}\mathrm{Pd}$ (f8) | ${}^{105}\mathrm{Pd}$ (f8) | ${}^{106}\mathrm{Pd}$ (f8) | ${}^{108}\mathrm{Pd}$ (f8) | ${}^{110}\mathrm{Pd}$ (f8) | ${}^{107}\mathrm{Ag}$ (f8) | ${}^{109}\mathrm{Ag}$ (f8) | ${}^{106}\mathrm{Cd}$ (f8) | ${}^{108}\mathrm{Cd}$ (f8) | ${}^{110}\mathrm{Cd}$ (f8) | ${}^{111}\mathrm{Cd}$ (f8) | ${}^{112}\mathrm{Cd}$ (f8) | ${}^{113}\mathrm{Cd}$ (f8) | ${}^{114}\mathrm{Cd}$ (f8) | ${}^{116}\mathrm{Cd}$ (f8) | ${}^{113}\mathrm{In}$ (f8) | ${}^{115}\mathrm{In}$ (f8) | ${}^{112}\mathrm{Sn}$ (f8) | ${}^{114}\mathrm{Sn}$ (f8) | ${}^{115}\mathrm{Sn}$ (f8) | ${}^{116}\mathrm{Sn}$ (f8) | ${}^{117}\mathrm{Sn}$ (f8) | ${}^{118}\mathrm{Sn}$ (f8) | ${}^{119}\mathrm{Sn}$ (f8) | ${}^{120}\mathrm{Sn}$ (f8) | ${}^{122}\mathrm{Sn}$ (f8) | ${}^{124}\mathrm{Sn}$ (f8) | ${}^{121}\mathrm{Sb}$ (f8) | ${}^{123}\mathrm{Sb}$ (f8) | ${}^{120}\mathrm{Te}$ (f8) | ${}^{122}\mathrm{Te}$ (f8) | ${}^{123}\mathrm{Te}$ (f8) | ${}^{124}\mathrm{Te}$ (f8) | ${}^{125}\mathrm{Te}$ (f8) | ${}^{126}\mathrm{Te}$ (f8) | ${}^{128}\mathrm{Te}$ (f8) | ${}^{130}\mathrm{Te}$ (f8) | ${}^{127}\mathrm{I}$ (f8) | ${}^{124}\mathrm{Xe}$ (f8) | ${}^{126}\mathrm{Xe}$ (f8) | ${}^{128}\mathrm{Xe}$ (f8) | ${}^{129}\mathrm{Xe}$ (f8) | ${}^{130}\mathrm{Xe}$ (f8) | ${}^{131}\mathrm{Xe}$ (f8) | ${}^{132}\mathrm{Xe}$ (f8) | ${}^{134}\mathrm{Xe}$ (f8) | ${}^{136}\mathrm{Xe}$ (f8) | ${}^{133}\mathrm{Cs}$ (f8) | ${}^{130}\mathrm{Ba}$ (f8) | ${}^{132}\mathrm{Ba}$ (f8) | ${}^{134}\mathrm{Ba}$ (f8) | ${}^{135}\mathrm{Ba}$ (f8) | ${}^{136}\mathrm{Ba}$ (f8) | ${}^{137}\mathrm{Ba}$ (f8) | ${}^{138}\mathrm{Ba}$ (f8) | ${}^{138}\mathrm{La}$ (f8) | ${}^{139}\mathrm{La}$ (f8) | ${}^{136}\mathrm{Ce}$ (f8) | ${}^{138}\mathrm{Ce}$ (f8) | ${}^{140}\mathrm{Ce}$ (f8) | ${}^{142}\mathrm{Ce}$ (f8) | ${}^{141}\mathrm{Pr}$ (f8) | ${}^{142}\mathrm{Nd}$ (f8) | ${}^{143}\mathrm{Nd}$ (f8) | ${}^{144}\mathrm{Nd}$ (f8) | ${}^{145}\mathrm{Nd}$ (f8) | ${}^{146}\mathrm{Nd}$ (f8) | ${}^{148}\mathrm{Nd}$ (f8) | ${}^{150}\mathrm{Nd}$ (f8) | ${}^{144}\mathrm{Sm}$ (f8) | ${}^{147}\mathrm{Sm}$ (f8) | ${}^{148}\mathrm{Sm}$ (f8) | ${}^{149}\mathrm{Sm}$ (f8) | ${}^{150}\mathrm{Sm}$ (f8) | ${}^{152}\mathrm{Sm}$ (f8) | ${}^{154}\mathrm{Sm}$ (f8) | ${}^{151}\mathrm{Eu}$ (f8) | ${}^{153}\mathrm{Eu}$ (f8) | ${}^{152}\mathrm{Gd}$ (f8) | ${}^{154}\mathrm{Gd}$ (f8) | ${}^{155}\mathrm{Gd}$ (f8) | ${}^{156}\mathrm{Gd}$ (f8) | ${}^{157}\mathrm{Gd}$ (f8) | ${}^{158}\mathrm{Gd}$ (f8) | ${}^{160}\mathrm{Gd}$ (f8) | ${}^{159}\mathrm{Tb}$ (f8) | ${}^{156}\mathrm{Dy}$ (f8) | ${}^{158}\mathrm{Dy}$ (f8) | ${}^{160}\mathrm{Dy}$ (f8) | ${}^{161}\mathrm{Dy}$ (f8) | ${}^{162}\mathrm{Dy}$ (f8) | ${}^{163}\mathrm{Dy}$ (f8) | ${}^{164}\mathrm{Dy}$ (f8) | ${}^{165}\mathrm{Ho}$ (f8) | ${}^{162}\mathrm{Er}$ (f8) | ${}^{164}\mathrm{Er}$ (f8) | ${}^{166}\mathrm{Er}$ (f8) | ${}^{167}\mathrm{Er}$ (f8) | ${}^{168}\mathrm{Er}$ (f8) | ${}^{170}\mathrm{Er}$ (f8) | ${}^{169}\mathrm{Tm}$ (f8) | ${}^{168}\mathrm{Yb}$ (f8) | ${}^{170}\mathrm{Yb}$ (f8) | ${}^{171}\mathrm{Yb}$ (f8) | ${}^{172}\mathrm{Yb}$ (f8) | ${}^{173}\mathrm{Yb}$ (f8) | ${}^{174}\mathrm{Yb}$ (f8) | ${}^{176}\mathrm{Yb}$ (f8) | ${}^{175}\mathrm{Lu}$ (f8) | ${}^{176}\mathrm{Lu}$ (f8) | ${}^{174}\mathrm{Hf}$ (f8) | ${}^{176}\mathrm{Hf}$ (f8) | ${}^{177}\mathrm{Hf}$ (f8) | ${}^{178}\mathrm{Hf}$ (f8) | ${}^{179}\mathrm{Hf}$ (f8) | ${}^{180}\mathrm{Hf}$ (f8) | ${}^{180}\mathrm{Ta}$ (f8) | ${}^{181}\mathrm{Ta}$ (f8) | ${}^{180}\mathrm{W}$ (f8) | ${}^{182}\mathrm{W}$ (f8) | ${}^{183}\mathrm{W}$ (f8) | ${}^{184}\mathrm{W}$ (f8) | ${}^{186}\mathrm{W}$ (f8) | ${}^{185}\mathrm{Re}$ (f8) | ${}^{187}\mathrm{Re}$ (f8) | ${}^{184}\mathrm{Os}$ (f8) | ${}^{186}\mathrm{Os}$ (f8) | ${}^{187}\mathrm{Os}$ (f8) | ${}^{188}\mathrm{Os}$ (f8) | ${}^{189}\mathrm{Os}$ (f8) | ${}^{190}\mathrm{Os}$ (f8) | ${}^{192}\mathrm{Os}$ (f8) | ${}^{191}\mathrm{Ir}$ (f8) | ${}^{193}\mathrm{Ir}$ (f8) | ${}^{190}\mathrm{Pt}$ (f8) | ${}^{192}\mathrm{Pt}$ (f8) | ${}^{194}\mathrm{Pt}$ (f8) | ${}^{195}\mathrm{Pt}$ (f8) | ${}^{196}\mathrm{Pt}$ (f8) | ${}^{198}\mathrm{Pt}$ (f8) | ${}^{197}\mathrm{Au}$ (f8) | ${}^{196}\mathrm{Hg}$ (f8) | ${}^{198}\mathrm{Hg}$ (f8) | ${}^{199}\mathrm{Hg}$ (f8) | ${}^{200}\mathrm{Hg}$ (f8) | ${}^{201}\mathrm{Hg}$ (f8) | ${}^{202}\mathrm{Hg}$ (f8) | ${}^{204}\mathrm{Hg}$ (f8) | ${}^{203}\mathrm{Tl}$ (f8) | ${}^{205}\mathrm{Tl}$ (f8) | ${}^{204}\mathrm{Pb}$ (f8) | ${}^{206}\mathrm{Pb}$ (f8) | ${}^{207}\mathrm{Pb}$ (f8) | ${}^{208}\mathrm{Pb}$ (f8) | ${}^{209}\mathrm{Bi}$ (f8) | ${}^{230}\mathrm{Th}$ (f8) | ${}^{232}\mathrm{Th}$ (f8) | ${}^{231}\mathrm{Pa}$ (f8) | ${}^{234}\mathrm{U}$ (f8) | ${}^{235}\mathrm{U}$ (f8) | ${}^{238}\mathrm{U}$ (f8) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| None | 0.99984 | 0.00016 | 0.00000 | 1.00000 | 0.07589 | 0.92411 | 1.00000 | 0.19820 | 0.80180 | 0.98892 | 0.01108 | 0.99634 | 0.00366 | 0.99762 | 0.00038 | 0.00200 | 1.00000 | 0.90484 | 0.00270 | 0.09247 | 1.00000 | 0.78951 | 0.10020 | 0.11029 | 1.00000 | 0.92230 | 0.04683 | 0.03087 | 1.00000 | 0.95041 | 0.00749 | 0.04196 | 0.00015 | 0.75765 | 0.24235 | 0.00334 | 0.00063 | 0.99604 | 0.93258 | 0.00012 | 0.06730 | 0.96941 | 0.00647 | 0.00135 | 0.02086 | 0.00004 | 0.00187 | 1.00000 | 0.08249 | 0.07437 | 0.73720 | 0.05409 | 0.05185 | 0.00250 | 0.99750 | 0.04345 | 0.83789 | 0.09501 | 0.02365 | 1.00000 | 0.05845 | 0.91754 | 0.02119 | 0.00282 | 1.00000 | 0.68077 | 0.26223 | 0.01140 | 0.03635 | 0.00926 | 0.69174 | 0.30826 | 0.49170 | 0.27731 | 0.04040 | 0.18448 | 0.00611 | 0.60108 | 0.39892 | 0.20526 | 0.27446 | 0.07760 | 0.36523 | 0.07745 | 1.00000 | 0.00863 | 0.09220 | 0.07594 | 0.23685 | 0.49813 | 0.08825 | 0.50686 | 0.49314 | 0.00355 | 0.02286 | 0.11593 | 0.11500 | 0.56988 | 0.17279 | 0.72165 | 0.27835 | 0.00557 | 0.09857 | 0.07001 | 0.82585 | 1.00000 | 0.51452 | 0.11223 | 0.17146 | 0.17380 | 0.02799 | 1.00000 | 0.14649 | 0.09187 | 0.15873 | 0.16673 | 0.09582 | 0.24292 | 0.09744 | 0.05542 | 0.01869 | 0.12758 | 0.12599 | 0.17060 | 0.31552 | 0.18621 | 1.00000 | 0.01020 | 0.11140 | 0.22330 | 0.27330 | 0.26460 | 0.11720 | 0.51839 | 0.48161 | 0.01249 | 0.00890 | 0.12485 | 0.12804 | 0.24117 | 0.12225 | 0.28729 | 0.07501 | 0.04281 | 0.95719 | 0.00973 | 0.00659 | 0.00339 | 0.14536 | 0.07676 | 0.24223 | 0.08585 | 0.32593 | 0.04629 | 0.05789 | 0.57213 | 0.42787 | 0.00096 | 0.02603 | 0.00908 | 0.04816 | 0.07139 | 0.18952 | 0.31687 | 0.33799 | 1.00000 | 0.00095 | 0.00089 | 0.01910 | 0.26401 | 0.04071 | 0.21232 | 0.26909 | 0.10436 | 0.08857 | 1.00000 | 0.00106 | 0.00101 | 0.02417 | 0.06592 | 0.07853 | 0.11232 | 0.71699 | 0.00089 | 0.99911 | 0.00186 | 0.00251 | 0.88449 | 0.11114 | 1.00000 | 0.27153 | 0.12173 | 0.23798 | 0.08293 | 0.17189 | 0.05756 | 0.05638 | 0.03078 | 0.15004 | 0.11248 | 0.13824 | 0.07365 | 0.26740 | 0.22741 | 0.47810 | 0.52190 | 0.00203 | 0.02181 | 0.14800 | 0.20466 | 0.15652 | 0.24835 | 0.21863 | 1.00000 | 0.00056 | 0.00095 | 0.02329 | 0.18889 | 0.25475 | 0.24896 | 0.28260 | 1.00000 | 0.00139 | 0.01601 | 0.33501 | 0.22872 | 0.26985 | 0.14901 | 1.00000 | 0.00123 | 0.02982 | 0.14086 | 0.21686 | 0.16103 | 0.32025 | 0.12995 | 0.97401 | 0.02599 | 0.00162 | 0.05260 | 0.18595 | 0.27281 | 0.13621 | 0.35080 | 0.00012 | 0.99988 | 0.00120 | 0.26499 | 0.14314 | 0.30642 | 0.28426 | 0.37398 | 0.62602 | 0.00020 | 0.01586 | 0.01964 | 0.13243 | 0.16147 | 0.26258 | 0.40781 | 0.37272 | 0.62728 | 0.00012 | 0.00782 | 0.32864 | 0.33775 | 0.25211 | 0.07357 | 1.00000 | 0.00155 | 0.10038 | 0.16938 | 0.23138 | 0.13170 | 0.29743 | 0.06818 | 0.29524 | 0.70476 | 0.01425 | 0.24145 | 0.22083 | 0.52348 | 1.00000 | 0.00001 | 0.99999 | 1.00000 | 0.00005 | 0.00720 | 0.99274 |
You can of course also create new reference values by passing a dict to the isopy.asrefval() function.
One special feature of reference values is that the RefValDict.get() method can compute missing values for ratio and molecule key strings from the contents of the array, e.g.
isopy.asrefval('isotope.fraction').get('108pd/105pd') # Divides the value for 108Pd by 105Pd
1.1849529780564263
isopy.asrefval('isotope.fraction').get('(16O)(1H)') # Multiplies the value for 16O by the value for 1H
0.997465230567756
For more information on how these are computed see the documentation of RefValDict.get().
Reference values also work with array functions. Combining isopy arrays and reference values will return an array consisting of only of the keys in the array.
a = isopy.ones(1, '101ru 105pd 111cd')
a * isopy.asrefval('isotope.fraction')
| (row) | ${}^{101}\mathrm{Ru}$ (f8) | ${}^{105}\mathrm{Pd}$ (f8) | ${}^{111}\mathrm{Cd}$ (f8) |
|---|---|---|---|
| 0 | 0.17060 | 0.22330 | 0.12804 |
a = isopy.ones(1, '101ru/99ru 108pd/105pd 111cd/116cd') # Calculates the ratios automatically
a * isopy.asrefval('isotope.fraction')
| (row) | $\cfrac{{}^{101}\mathrm{Ru}}{{}^{99}\mathrm{Ru}}$ (f8) | $\cfrac{{}^{108}\mathrm{Pd}}{{}^{105}\mathrm{Pd}}$ (f8) | $\cfrac{{}^{111}\mathrm{Cd}}{{}^{116}\mathrm{Cd}}$ (f8) |
|---|---|---|---|
| 0 | 1.33721 | 1.18495 | 1.70697 |
You can also use numpy functions on reference values. It might be considerably faster to use the function in the isopy namespace together with the keys argument to avoid computing the result for unused keys.
isopy.log(isopy.asrefval('isotope.fraction'), keys='101ru 105pd 111cd')
| (row) | ${}^{101}\mathrm{Ru}$ (f8) | ${}^{105}\mathrm{Pd}$ (f8) | ${}^{111}\mathrm{Cd}$ (f8) |
|---|---|---|---|
| None | -1.76843 | -1.49924 | -2.05541 |
You can convert reference values, or a subsection thereof, to an array using the RefValDict.to_array()function. The first argument is the keys the array should contain.
isopy.asrefval('isotope.fraction').to_array('101ru 105pd 111cd')
| (row) | ${}^{101}\mathrm{Ru}$ (f8) | ${}^{105}\mathrm{Pd}$ (f8) | ${}^{111}\mathrm{Cd}$ (f8) |
|---|---|---|---|
| None | 0.17060 | 0.22330 | 0.12804 |