Isotope Geochemistry

johnson_nyquist_noise

isopy.tb.johnson_nyquist_noise(voltage, resistor=100000000000.0, integration_time=8.389, include_counting_statistics=True, T=309, R=100000000000.0, cpv=62500000.0)[source]

Calculate the Johnson-Nyquist noise and counting statistics for a given voltage.

The Johnson-Nyquist noise (\(n_{jn}\) is calculated as:

\[n_{jn} = \sqrt{ \frac{4*k_{b}*T*r} {t} } * \frac{R} {r}\]

The counting statistics, or shot noise, (\(n_{cs}\) is calculated as:

\[n_{cs} = \sqrt{ \frac{1} {v * c_{V} * t}} * v\]

The two are combined as:

\[n_{all} = \sqrt{ (n_{jn})^2 + (n_{cs})^2 }\]

where \(n\) is the numerator isotope and \(d\) is the denominator isotope.

Adapted from the equations in Liu & Pearson (2014) Chemical Geology, 10, 301-311.

Parameters
  • voltage (isotope_rarray, float, np.ndarray) – The measured voltages. \(v\) in the equations above.

  • resistor (isotope_rarray, float, np.ndarray, dict) – The resistor for the measurement. Default value is 1E11. \(r\) in the equations above. If resistor is a dictionary R will be used for values not in the dictionary.

  • integration_time (float, optional) – The integration time in seconds for a single measurement. Default value is 8.389. \(t\) in the equations above.

  • include_counting_statistics (bool, optional) – If True then the counting statistics are included in the returned value. Default value is True.

  • T (float, optional) – Amplifier housing temperature in kelvin. Default value is 309. \(T\) in the equations above.

  • R (float, optional) – voltage values are reported as volts for this resistor value. Default value is 1E11. \(R\) in the equations above.

  • cpv (float, optional) – Counts per volt per second. Default value is 6.25E7. \(C_{V}\) in the equations above.

Returns

noise – The noise in V for the given voltage/set of voltages.

Return type

np.float or np.ndarray or isotope_rarray

Examples

>>> isopy.tb.johnson_nyquist_noise(10) * 1000 #in millivolts
0.13883808575503015
>>> isopy.tb.johnson_nyquist_noise(10, 1E10) * 1000 # 1E10 resistor
0.14528174343845432
>>> array = isopy.tb.make_ms_array('pd')
>>> array = array * (10 / array['106pd']) #10v on the largest isotope
>>> isopy.tb.johnson_nyquist_noise(array) * 1000 #in millivolts
(row)      102Pd (f8)    104Pd (f8)    105Pd (f8)    106Pd (f8)    108Pd (f8)    110Pd (f8)
-------  ------------  ------------  ------------  ------------  ------------  ------------
None          0.03025       0.08932       0.12565       0.13884       0.13663       0.09156
IsopyNdarray(-1, flavour='isotope', default_value=nan)
>>> resistors = dict(pd102=1E13, pd106=1E10) #1E11 is used for missing keys
>>> isopy.tb.johnson_nyquist_noise(array, resistors) * 1000
(row)      102Pd (f8)    104Pd (f8)    105Pd (f8)    106Pd (f8)    108Pd (f8)    110Pd (f8)
-------  ------------  ------------  ------------  ------------  ------------  ------------
None          0.02672       0.08932       0.12565       0.14528       0.13663       0.09156
IsopyNdarray(-1, flavour='isotope', default_value=nan)

make_ms_array

isopy.tb.make_ms_array(*args, mf_factor=None, isotope_fractions='isotope.fraction', isotope_masses='isotope.mass', **kwargs)[source]

Constructs an isotope array where the first created isotope contains the sum of all given isotopes with the same mass number. The construction order is first args and then kwargs.

Parameters
  • args – Each arg can be either a isotope array, a element key or an isotope key string. If arg is an isotope array an exception will be raised if two or more isotopes have the same mass number. If arg is an element key string then all isotopes of that element are added to the array. If arg is an isotope key string then only that isotope and isotopes with the same mass number as any other isotope in the array is added.

  • mf_factor – If given this mass fractionation factor is applied to all isotopes of an element prior to being added to the result.

  • isotope_fractions – Reference value for the isotope fractions of different elements. Defaults to isopy.refval.isotope.abundance.

  • isotope_masses – Reference value for the isotope masses of different elements. Defaults to isopy.refval.isotope.mass.

  • kwargs – Each kwarg key must be either an element key string or an isotope key string. The isotope fractions added to the array based on the kwarg key are multiplied by the kwarg value. Otherwise behaves the same as for args.

Returns

result – The constructed isotope array.

Return type

IsopyArray

Examples

>>> isopy.tb.make_ms_array('pd')
(row)      102Pd (f8)    104Pd (f8)    105Pd (f8)    106Pd (f8)    108Pd (f8)    110Pd (f8)
-------  ------------  ------------  ------------  ------------  ------------  ------------
None          0.01020       0.11140       0.22330       0.27330       0.26460       0.11720
IsopyNdarray(-1, flavour='isotope', default_value=nan)
>>> isopy.tb.make_ms_array('pd', ru101=0.1)
(row)      101Ru (f8)    102Pd (f8)    104Pd (f8)    105Pd (f8)    106Pd (f8)    108Pd (f8)    110Pd (f8)
-------  ------------  ------------  ------------  ------------  ------------  ------------  ------------
None          0.01706       0.04175       0.13002       0.22330       0.27330       0.26460       0.11720
IsopyNdarray(-1, flavour='isotope', default_value=nan)
>>> isopy.tb.make_ms_array('pd', ru101=0.1, ru99=0) #99Ru doesnt contribute anything to the array but gets a contribution from 101Ru.
(row)      99Ru (f8)    101Ru (f8)    102Pd (f8)    104Pd (f8)    105Pd (f8)    106Pd (f8)    108Pd (f8)    110Pd (f8)
-------  -----------  ------------  ------------  ------------  ------------  ------------  ------------  ------------
None         0.01276       0.01706       0.04175       0.13002       0.22330       0.27330       0.26460       0.11720
IsopyNdarray(-1, flavour='isotope', default_value=nan)
>>> isopy.tb.make_ms_array('pd', 'cd')
(row)      102Pd (f8)    104Pd (f8)    105Pd (f8)    106Pd (f8)    108Pd (f8)    110Pd (f8)    111Cd (f8)    112Cd (f8)    113Cd (f8)    114Cd (f8)    116Cd (f8)
-------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------
None          0.01020       0.11140       0.22330       0.28579       0.27350       0.24205       0.12804       0.24117       0.12225       0.28729       0.07501
IsopyNdarray(-1, flavour='isotope', default_value=nan)
>>> isopy.tb.make_ms_array('pd', cd=1) #Same as example above
(row)      102Pd (f8)    104Pd (f8)    105Pd (f8)    106Pd (f8)    108Pd (f8)    110Pd (f8)    111Cd (f8)    112Cd (f8)    113Cd (f8)    114Cd (f8)    116Cd (f8)
-------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------
None          0.01020       0.11140       0.22330       0.28579       0.27350       0.24205       0.12804       0.24117       0.12225       0.28729       0.07501
IsopyNdarray(-1, flavour='isotope', default_value=nan)

make_ms_beams

isopy.tb.make_ms_beams(*args, mf_factor=None, fixed_voltage=10, fixed_key=<function keymax>, integrations=100, integration_time=8.389, resistor=100000000000.0, random_seed=None, isotope_fractions='isotope.fraction', isotope_masses='isotope.mass', **kwargs)[source]

Simulates a series of measurements with a standard deviation equal to the johnson-nyquist noise and counting statistics.

args and kwargs are passed to isopy.tb.make_ms_array() to create the ms array.

Parameters
  • args – Each arg can be either a isotope array, a element key or an isotope key string. If arg is an isotope array an exception will be raised if two or more isotopes have the same mass number. If arg is an element key string then all isotopes of that element are added to the array. If arg is an isotope key string then only that isotope and isotopes with the same mass number as any other isotope in the array is added.

  • mf_factor – If given this mass fractionation factor is applied to all isotopes of an element prior to being added to the result.

  • fixed_voltage – The voltage of fixed_key in the array. The value for all other isotopes in the array are adjusted accordingly.

  • fixed_key – If not given then the this defaults to the most abundant isotope. If None then the sum of all isotopes in the array will be set to fixed_voltage

  • integrations – The number of simulated measurements. If None no measurements are simulated and the retured array contains the true values.

  • integration_time – The integration time for each simulated measurement.

  • resistor – The resistor used for each measurement. A isotope array or a dictionary can be passed to to give different resistor values for different isotopes.

  • random_seed – Must be an integer. Seed given to the random generator.

  • isotope_fractions – Reference value for the isotope fractions of different elements. Defaults to isopy.refval.isotope.abundance.

  • isotope_masses – Reference value for the isotope masses of different elements. Defaults to isopy.refval.isotope.mass.

  • kwargs – Each kwarg key must be either an element key string or an isotope key string. The isotope fractions added to the array based on the kwarg key are multiplied by the kwarg value. Otherwise behaves the same as for args.

Returns

The simulated measurements.

Return type

IsopyArray

Examples

>>> isopy.tb.make_ms_beams('pd', ru101=0.01)
(row)      101Ru (f8)    102Pd (f8)    104Pd (f8)    105Pd (f8)    106Pd (f8)    108Pd (f8)    110Pd (f8)
-------  ------------  ------------  ------------  ------------  ------------  ------------  ------------
0             0.06239       0.48870       4.14431       8.17054       9.99988       9.68156       4.28856
1             0.06241       0.48866       4.14418       8.17052      10.00002       9.68148       4.28846
2             0.06244       0.48865       4.14416       8.17049       9.99998       9.68170       4.28839
3             0.06241       0.48866       4.14424       8.17060       9.99996       9.68172       4.28826
4             0.06240       0.48867       4.14432       8.17043      10.00002       9.68168       4.28830
               ...           ...           ...           ...           ...           ...           ...
95            0.06244       0.48868       4.14397       8.17066      10.00006       9.68180       4.28820
96            0.06243       0.48868       4.14439       8.17048      10.00007       9.68168       4.28838
97            0.06243       0.48863       4.14421       8.17031      10.00014       9.68160       4.28837
98            0.06237       0.48867       4.14419       8.17038       9.99999       9.68159       4.28828
99            0.06241       0.48864       4.14425       8.17037      10.00001       9.68175       4.28839
IsopyNdarray(100, flavour='isotope', default_value=nan)

make_ms_sample

isopy.tb.make_ms_sample(ms_array, *, fnat=None, fins=None, fixed_voltage=10, fixed_key=<function keymax>, blank=None, blank_fixed_voltage=0.01, blank_fixed_key=<function keymax>, spike=None, spike_fraction=0.5, integrations=100, integration_time=8.389, resistors=100000000000.0, random_seed=None, isotope_fractions='isotope.fraction', isotope_masses='isotope.mass', **interferences)[source]

Creates a simulated the measurement of a sample with natural and instrumental mass fractionation added to the array. The standard deviation of measurements for each isotope is equal to the johnson-nyquist noise and counting statistics.

Parameters
  • ms_array – Any object that can be passed to make_ms_array to returns valid array. Also accepts a tuple or a dict which will be unpacked appropriately.

  • fnat – If given, the natural fractionation fractionation factor is applied to the ms_array before interferences are added to the ms_array.

  • fins – If given, the instrumental mass fractionation factor is applied to the ms_array at the same time the interferences are added to the ms_array.

  • fixed_voltage – The voltage of fixed_key in the array. The value for all other isotopes in the array are adjusted accordingly.

  • fixed_key – If not given then the this defaults to the most abundant isotope. If None then the sum of all isotopes in the array will be set to fixed_voltage

  • blank – The blank sample to be added to the sample. Can be object that can be singularly passed to make_ms_array which returns valid array. Also accepts a tuple or a dict which will be unpacked appropriately.

  • blank_fixed_voltage – The voltage of the blank_fixed_key in returned sample that is blank.

  • blank_fixed_key – If not given then the this defaults to the most abundant isotope. If None then the sum of all isotopes in the array will be set to blank_fixed_voltage

  • spike – If given this spike mixture will be added ms_array after fnat but before fins and interferences are added to the array.

  • spike_fraction – The fraction of spike in the final mixture based on the isotopes in spike.

  • integrations – The number of simulated measurements. If None no measurements are simulated and the retured array contains the true values.

  • integration_time – The integration time for each simulated measurement.

  • resistors – The resistor used for each measurement. A isotope array or a dictionary can be passed to to give different resistor values for different isotopes.

  • random_seed – Must be an integer. Seed given to the random generator.

  • isotope_fractions – Reference value for the isotope fractions of different elements. Defaults to isopy.refval.isotope.abundance.

  • isotope_masses – Reference value for the isotope masses of different elements. Defaults to isopy.refval.isotope.mass.

  • interferences – Each kwarg key must be either an element key string or an isotope key string. The isotope fractions added to the array based on the kwarg key are multiplied by the kwarg value. Otherwise behaves the same as for args. A dictionary named interferences can be passed for keys that cannot be passed as kwargs, e.g. ‘137Ba++’.

Returns

The simulated measurements.

Return type

IsopyArray

Examples

>>> isopy.tb.make_ms_sample('pd', ru101=0.01, cd111=0.001, fnat = 0.1, fins=-1.6)
(row)      101Ru (f8)    102Pd (f8)    104Pd (f8)    105Pd (f8)    106Pd (f8)    108Pd (f8)    110Pd (f8)    111Cd (f8)
-------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------
0             0.49399       1.29459       4.70717       8.28435      10.00013       9.41279       4.09031       0.03591
1             0.49401       1.29462       4.70724       8.28425      10.00002       9.41281       4.09014       0.03593
2             0.49401       1.29459       4.70734       8.28425       9.99998       9.41288       4.09025       0.03594
3             0.49404       1.29462       4.70733       8.28416      10.00019       9.41271       4.09034       0.03592
4             0.49396       1.29463       4.70736       8.28428      10.00011       9.41278       4.09022       0.03591
               ...           ...           ...           ...           ...           ...           ...           ...
95            0.49395       1.29455       4.70720       8.28435       9.99995       9.41284       4.09020       0.03592
96            0.49404       1.29467       4.70718       8.28439      10.00013       9.41264       4.09039       0.03592
97            0.49405       1.29465       4.70730       8.28448       9.99992       9.41271       4.09031       0.03591
98            0.49394       1.29459       4.70733       8.28431      10.00006       9.41278       4.09040       0.03592
99            0.49397       1.29457       4.70732       8.28445       9.99980       9.41286       4.09026       0.03592
IsopyNdarray(100, flavour='isotope', default_value=nan)

remove_mass_fractionation

isopy.tb.remove_mass_fractionation(data, fractionation_factor, denom=None, isotope_masses='isotope.mass')[source]

Remove exponential mass fractionation from data.

Calculated using:

\[R_{n,d} = \frac{r_{n,d}}{(m_{n,d})^{ \alpha }}\]

where \(n\) is the numerator isotope and \(d\) is the denominator isotope.

Parameters
  • data (IsopyArray) – Array containing data to be changed. \(r\) in the equation above.

  • fractionation_factor (float) – Fractionation factor to be applied. \(\alpha\) in the equation above

  • denom – The denominator isotope if data is an isotope array. If not given then the key with the largest median value is used.

  • isotope_masses – Reference value for the isotope masses of different elements. Defaults to isopy.refval.isotope.mass.

Returns

Will have the same flavour as data. \(R\) in the equation above.

Return type

IsopyArray

Examples

>>> array = isopy.tb.make_ms_array('pd').ratio('105pd')
>>> array
(row)      102Pd/105Pd (f8)    104Pd/105Pd (f8)    106Pd/105Pd (f8)    108Pd/105Pd (f8)    110Pd/105Pd (f8)
-------  ------------------  ------------------  ------------------  ------------------  ------------------
None                0.04568             0.49888             1.22391             1.18495             0.52485
IsopyNdarray(-1, flavour='ratio[isotope, isotope]', default_value=nan)
>>> array = isopy.tb.remove_mass_fractionation(array, 0.15)
>>> array
(row)      102Pd/105Pd (f8)    104Pd/105Pd (f8)    106Pd/105Pd (f8)    108Pd/105Pd (f8)    110Pd/105Pd (f8)
-------  ------------------  ------------------  ------------------  ------------------  ------------------
None                0.04588             0.49960             1.22218             1.17995             0.52120
IsopyNdarray(-1, flavour='ratio[isotope, isotope]', default_value=nan)
>>> isopy.tb.mass_fractionation_factor(array, '108pd/105pd')
-0.1500000000000046

See also

isopy.tb.add_mass_fractionation

remove_mass_fractionation

isopy.tb.remove_mass_fractionation(data, fractionation_factor, denom=None, isotope_masses='isotope.mass')[source]

Remove exponential mass fractionation from data.

Calculated using:

\[R_{n,d} = \frac{r_{n,d}}{(m_{n,d})^{ \alpha }}\]

where \(n\) is the numerator isotope and \(d\) is the denominator isotope.

Parameters
  • data (IsopyArray) – Array containing data to be changed. \(r\) in the equation above.

  • fractionation_factor (float) – Fractionation factor to be applied. \(\alpha\) in the equation above

  • denom – The denominator isotope if data is an isotope array. If not given then the key with the largest median value is used.

  • isotope_masses – Reference value for the isotope masses of different elements. Defaults to isopy.refval.isotope.mass.

Returns

Will have the same flavour as data. \(R\) in the equation above.

Return type

IsopyArray

Examples

>>> array = isopy.tb.make_ms_array('pd').ratio('105pd')
>>> array
(row)      102Pd/105Pd (f8)    104Pd/105Pd (f8)    106Pd/105Pd (f8)    108Pd/105Pd (f8)    110Pd/105Pd (f8)
-------  ------------------  ------------------  ------------------  ------------------  ------------------
None                0.04568             0.49888             1.22391             1.18495             0.52485
IsopyNdarray(-1, flavour='ratio[isotope, isotope]', default_value=nan)
>>> array = isopy.tb.remove_mass_fractionation(array, 0.15)
>>> array
(row)      102Pd/105Pd (f8)    104Pd/105Pd (f8)    106Pd/105Pd (f8)    108Pd/105Pd (f8)    110Pd/105Pd (f8)
-------  ------------------  ------------------  ------------------  ------------------  ------------------
None                0.04588             0.49960             1.22218             1.17995             0.52120
IsopyNdarray(-1, flavour='ratio[isotope, isotope]', default_value=nan)
>>> isopy.tb.mass_fractionation_factor(array, '108pd/105pd')
-0.1500000000000046

See also

isopy.tb.add_mass_fractionation

mass_fractionation_factor

isopy.tb.mass_fractionation_factor(data, mf_ratio, isotope_fractions='isotope.fraction', isotope_masses='isotope.mass')[source]

Calculate the mass fractionation factor for a given ratio in data.

\[\alpha = \ln{( \frac{r_{n,d}}{R_{n,d}} )} * \frac{1}{ \ln{( m_{n,d} } )}\]

where \(n\) is the numerator isotope and \(d\) is the denominator isotope.

Parameters
  • data – Fractionated data. \(r\) in the equation above.

  • mf_ratio – The isotope ratio from which the fractionation factor should be calculated. \(n,d\) in the equation above.

  • isotope_fractions – Reference value for the isotope fractions of different elements. Defaults to isopy.refval.isotope.abundance.

  • isotope_masses – Reference value for the isotope masses of different elements. Defaults to isopy.refval.isotope.mass.

Returns

The fractionation factor for ratio in data. \(\alpha\) in the equation above.

Return type

float

Examples

>>> array = isopy.tb.make_ms_array('pd').ratio('105pd')
>>> array = isopy.tb.add_mass_fractionation(array, 0.1)
>>> isopy.tb.mass_fractionation_factor(array, '108pd/105pd')
0.09999999999999679
>>> array = isopy.tb.make_ms_array('pd').ratio('105pd')
>>> array = isopy.tb.remove_mass_fractionation(array, 0.15)
>>> isopy.tb.mass_fractionation_factor(array, '108pd/105pd')
-0.1500000000000046

internal_normalisation

isopy.tb.internal_normalisation(data, mf_ratio, interference_correction=True, extnorm_value=None, extnorm_factor=None, isotope_fractions='isotope.fraction', isotope_masses='isotope.mass', mf_tol=1e-08)[source]

A data reduction scheme for internaly normalised data.

If interference_correction is True an interference correction will be applied for all isotopes that are different from the mf_ratio numerator element. This will be done together with the mass fractionation correction to account for isobaric interferences on the mf_ratio. If more than one isotope exists for an an element the largest isotope is used for the interference correction.

If extnorm_value and/or extnorm_factor is given then the returned data is externally normalised to these values using the rDelta function. The default value for extnorm_value is 1 and the default value for extnorm_factor is the same as isotope_fractions, should only one of these values be given.

Parameters
  • data – The data to be corrected. Isotope arrays will automatically be converted to ratio arrays. Ratio arrays must have a common denominator that is the same as the that of mf_ratio.

  • mf_ratio – The data will be internally normalised to this ratio. Must be present in data.

  • interference_correction – If True then the data is corrected for isobaric interferences.

  • extnorm_value – If given the result in normalised to this value with extnorm_factor. If extnorm_value is not given a normalisation factor of 1 is used.

  • extnorm_factor – If given and normalisation_value is not the result is normalised against isotope_fractions.

  • isotope_fractions – Reference value for the isotope fractions of different elements. Defaults to isopy.refval.isotope.abundance

  • isotope_masses – Reference value for the isotope masses of different elements. Defaults to isopy.refval.isotope.mass

  • mf_tol – Only when the difference between the current and the previous mass_fractionation factor is below this value is the interference correction assumed to have converged.

Returns

Only contains the isotopes of the element with the same element symbol as mf_ratio

Return type

IsopyArray

Examples

>>> array = isopy.tb.make_ms_array('pd', ru101 = 0.1, cd111 = 0.1, mf_factor=0.1).normalise(10, isopy.keymax)
>>> array
(row)      101Ru (f8)    102Pd (f8)    104Pd (f8)    105Pd (f8)    106Pd (f8)    108Pd (f8)    110Pd (f8)    111Cd (f8)
-------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------
None          0.62089       1.51955       4.72959       8.12576      10.00000       9.68819       4.73963       0.46692
IsopyNdarray(-1, flavour='isotope', default_value=nan)
>>> isopy.tb.internal_normalisation(array, '108Pd/105Pd')
(row)      102Pd/105Pd (f8)    104Pd/105Pd (f8)    106Pd/105Pd (f8)    110Pd/105Pd (f8)
-------  ------------------  ------------------  ------------------  ------------------
None                0.04568             0.49888             1.22391             0.52485
IsopyNdarray(-1, flavour='ratio[isotope, isotope]', default_value=nan)
>>> isopy.tb.internal_normalisation(array, '108Pd/105Pd') / isopy.refval.isotope.fraction
(row)      102Pd/105Pd (f8)    104Pd/105Pd (f8)    106Pd/105Pd (f8)    110Pd/105Pd (f8)
-------  ------------------  ------------------  ------------------  ------------------
None                1.00000             1.00000             1.00000             1.00000
IsopyNdarray(-1, flavour='ratio[isotope, isotope]', default_value=nan)
>>> isopy.tb.internal_normalisation(array, '108Pd/105Pd', interference_correction=False, extnorm_factor=1)
(row)      102Pd/105Pd (f8)    104Pd/105Pd (f8)    106Pd/105Pd (f8)    110Pd/105Pd (f8)
-------  ------------------  ------------------  ------------------  ------------------
None                3.11997             0.16916             0.00343             0.10006
IsopyNdarray(-1, flavour='ratio[isotope, isotope]', default_value=nan)

Presets

The following presets are avaliable for this function:

  • internal_normalisation.permil(*args, **kwargs, extnorm_factor = 1000)

  • internal_normalisation.ppt(*args, **kwargs, extnorm_factor = 1000)

  • internal_normalisation.epsilon(*args, **kwargs, extnorm_factor = 10000.0)

  • internal_normalisation.ppm(*args, **kwargs, extnorm_factor = 1000000.0)

  • internal_normalisation.mu(*args, **kwargs, extnorm_factor = 1000000.0)

rDelta

isopy.tb.rDelta(data, reference_data, factor=1, deviations=1)[source]

Externally normalise data to the given reference values.

\[\Delta^{r} \textrm{normalised} = (\frac{\textrm{data}} {\textrm{reference data}} - \textrm{deviations} ) * \textrm{factor}\]
Parameters
  • data – Data to be normalised

  • reference_data – The reference values used to normalise the data. If a reference values contains more than one value the mean is used. Multiple values can be passed as a tuple in which case the mean of those values is used.

  • factor – The multiplication factor to be applied to data during the normalisation.

  • deviations1 if reference_data should be subtracted from data.

Examples

>>> ref = isopy.tb.make_ms_array('pd').ratio('105pd')
>>> array = isopy.tb.make_ms_sample('pd', fins=1, fixed_voltage=0.1).ratio('105pd')
>>> isopy.tb.rDelta(array, ref)
(row)      102Pd/105Pd (f8)    104Pd/105Pd (f8)    106Pd/105Pd (f8)    108Pd/105Pd (f8)    110Pd/105Pd (f8)
-------  ------------------  ------------------  ------------------  ------------------  ------------------
0                  -0.03424            -0.00985             0.00929             0.02838             0.04719
1                  -0.03133            -0.00905             0.00956             0.02905             0.04813
2                  -0.02188            -0.00911             0.00908             0.02869             0.04882
3                  -0.02505            -0.00954             0.00946             0.02845             0.04779
4                  -0.02477            -0.00964             0.00937             0.02881             0.04688
                     ...                 ...                 ...                 ...                 ...
95                 -0.02539            -0.00981             0.00991             0.02870             0.04741
96                 -0.03228            -0.00967             0.00965             0.02834             0.04753
97                 -0.02951            -0.01016             0.00947             0.02935             0.04818
98                 -0.02557            -0.00915             0.00982             0.02870             0.04775
99                 -0.02639            -0.00938             0.00919             0.02882             0.04825
IsopyNdarray(100, flavour='ratio[isotope, isotope]', default_value=nan)
>>> isopy.tb.rDelta(array, ref, factor=1E4)
(row)      102Pd/105Pd (f8)    104Pd/105Pd (f8)    106Pd/105Pd (f8)    108Pd/105Pd (f8)    110Pd/105Pd (f8)
-------  ------------------  ------------------  ------------------  ------------------  ------------------
0                -342.37270           -98.49275            92.90093           283.76418           471.91203
1                -313.33018           -90.46715            95.64488           290.54236           481.25233
2                -218.81828           -91.11607            90.79193           286.86373           488.23901
3                -250.54618           -95.42314            94.63710           284.45763           477.88220
4                -247.71363           -96.39945            93.69597           288.07581           468.76867
                     ...                 ...                 ...                 ...                 ...
95               -253.86651           -98.10488            99.10170           287.04024           474.05514
96               -322.77188           -96.65319            96.45140           283.40338           475.31330
97               -295.11884          -101.55413            94.69753           293.47311           481.82985
98               -255.68137           -91.53948            98.16303           286.97835           477.46565
99               -263.94694           -93.75097            91.94048           288.19007           482.45473
IsopyNdarray(100, flavour='ratio[isotope, isotope]', default_value=nan)
>>> isopy.tb.rDelta.epsilon(array, ref) # preset where factor = 1E4
(row)      102Pd/105Pd (f8)    104Pd/105Pd (f8)    106Pd/105Pd (f8)    108Pd/105Pd (f8)    110Pd/105Pd (f8)
-------  ------------------  ------------------  ------------------  ------------------  ------------------
0                -342.37270           -98.49275            92.90093           283.76418           471.91203
1                -313.33018           -90.46715            95.64488           290.54236           481.25233
2                -218.81828           -91.11607            90.79193           286.86373           488.23901
3                -250.54618           -95.42314            94.63710           284.45763           477.88220
4                -247.71363           -96.39945            93.69597           288.07581           468.76867
                     ...                 ...                 ...                 ...                 ...
95               -253.86651           -98.10488            99.10170           287.04024           474.05514
96               -322.77188           -96.65319            96.45140           283.40338           475.31330
97               -295.11884          -101.55413            94.69753           293.47311           481.82985
98               -255.68137           -91.53948            98.16303           286.97835           477.46565
99               -263.94694           -93.75097            91.94048           288.19007           482.45473
IsopyNdarray(100, flavour='ratio[isotope, isotope]', default_value=nan)

Presets

The following presets are avaliable for this function:

  • rDelta.permil(*args, **kwargs, factor = 1000)

  • rDelta.ppt(*args, **kwargs, factor = 1000)

  • rDelta.epsilon(*args, **kwargs, factor = 10000.0)

  • rDelta.ppm(*args, **kwargs, factor = 1000000.0)

  • rDelta.mu(*args, **kwargs, factor = 1000000.0)

inverse_rDelta

isopy.tb.inverse_rDelta(data, reference_data, factor=1, deviations=1)[source]

Denormalise data to the given reference values.

\[\textrm{denormalised data} = (\frac{\Delta^{r} \textrm{data}} {\textrm{factor}} + \textrm{deviations}) * \textrm{reference data}\]
Parameters
  • data – Normalised data to be denormalised

  • reference_data – The reference values used to denormalise the data. If multiple values are passed the mean of all the reference values are used. If a reference values contains more than one value the mean is used.

  • factor – The multiplication factor applied to data during the normalisation.

  • deviations1 if reference_data should be added to the denormalised data.

Examples

>>> ref = isopy.tb.make_ms_array('pd').ratio('105pd')
>>> array = isopy.tb.make_ms_sample('pd', fins=1).ratio('105pd')
>>> norm = isopy.toolbox.isotope.rDelta(array, ref, 1E4)
>>> isopy.tb.inverse_rDelta(norm, ref, 1E4)
(row)      102Pd/105Pd (f8)    104Pd/105Pd (f8)    106Pd/105Pd (f8)    108Pd/105Pd (f8)    110Pd/105Pd (f8)
-------  ------------------  ------------------  ------------------  ------------------  ------------------
0                   0.04438             0.49412             1.23557             1.21884             0.54989
1                   0.04438             0.49413             1.23560             1.21887             0.54989
2                   0.04437             0.49410             1.23555             1.21879             0.54988
3                   0.04437             0.49412             1.23555             1.21880             0.54989
4                   0.04437             0.49410             1.23551             1.21880             0.54987
                     ...                 ...                 ...                 ...                 ...
95                  0.04437             0.49411             1.23557             1.21882             0.54988
96                  0.04437             0.49411             1.23557             1.21883             0.54988
97                  0.04437             0.49413             1.23557             1.21886             0.54986
98                  0.04437             0.49413             1.23555             1.21883             0.54987
99                  0.04438             0.49413             1.23559             1.21884             0.54988
IsopyNdarray(100, flavour='ratio[isotope, isotope]', default_value=nan)
>>> isopy.tb.inverse_rDelta.epsilon(norm, ref) / array
(row)      102Pd/105Pd (f8)    104Pd/105Pd (f8)    106Pd/105Pd (f8)    108Pd/105Pd (f8)    110Pd/105Pd (f8)
-------  ------------------  ------------------  ------------------  ------------------  ------------------
0                   1.00000             1.00000             1.00000             1.00000             1.00000
1                   1.00000             1.00000             1.00000             1.00000             1.00000
2                   1.00000             1.00000             1.00000             1.00000             1.00000
3                   1.00000             1.00000             1.00000             1.00000             1.00000
4                   1.00000             1.00000             1.00000             1.00000             1.00000
                     ...                 ...                 ...                 ...                 ...
95                  1.00000             1.00000             1.00000             1.00000             1.00000
96                  1.00000             1.00000             1.00000             1.00000             1.00000
97                  1.00000             1.00000             1.00000             1.00000             1.00000
98                  1.00000             1.00000             1.00000             1.00000             1.00000
99                  1.00000             1.00000             1.00000             1.00000             1.00000
IsopyNdarray(100, flavour='ratio[isotope, isotope]', default_value=nan)

Presets

The following presets are avaliable for this function:

  • inverse_rDelta.permil(*args, **kwargs, factor = 1000)

  • inverse_rDelta.ppt(*args, **kwargs, factor = 1000)

  • inverse_rDelta.epsilon(*args, **kwargs, factor = 10000.0)

  • inverse_rDelta.ppm(*args, **kwargs, factor = 1000000.0)

  • inverse_rDelta.mu(*args, **kwargs, factor = 1000000.0)

ds_correction

isopy.tb.ds_correction(measured, spike, standard=None, inversion_keys=None, interference_correction=True, isotope_fractions='isotope.fraction', isotope_masses='isotope.mass', method='rudge', fins_tol=1e-06, fins_guess=None, **method_kwargs)[source]

A double spike data reduction.

If interference_correction is True a correction is applied for all isotopes in measured that have a different element symbol from the keys in spike. If more than one isotope exists for an an element the largest isotope is used for the interference correction.

Parameters
  • measured (IsopyArray) – Measured isotope ratios

  • standard (IsopyArray, dict) – References isotope ratios or a dict or references values

  • spike (IsopyArray, dict) – Spike isotope ratios or a dict or references values

  • isotope_masses (IsopyArray, dict, Optional) – Mass isotope ratios or a dict or references values. If not given hte isotope.mass will be used.

  • inversion_keys (RatioKeyList, Optional) – Keys used for the inversion. Can either be 3 ratio key strings or 4 isotope key strings. Does not have to be given if the inversion keys can be inferred from spike.

  • method (str) – Inversion method to be used. Options are ‘rudge’ and ‘siebert’.

  • fins_tol (float) – The interference correction is considered a success once the difference between the current and the previous fins value is below this value.

  • fins_guess – The fins value used for the first iteration of the interference correction. If not given the fins value of an inversion without an interference correction applied is used.

  • method_kwargs – Keyword arguments for inversion method. For advanced users only. See inversion_rudge and inversion_siebert for list of possible arguments.

Returns

inversion_result – The returned DSResult object contains the the following attributes:

  • method - Name of the method used to do the inversion.

  • alpha - The natural fractionation factor as defined by Rudge (\(n = N * mass^\alpha\)). Note this value has the opposite sign to fnat.

  • beta - The instrumental mass fractionation factor as defined by Rudge (\(m = M * mass^\beta\)). Same as fins.

  • lambda_ - The lambda value defined by rudge.

  • fnat - The natural fractionation factor as defined by Siebert (\(\textrm{SA} = \textrm{ST} * mass^{fnat}\)). Note this value has the opposite sign to alpha.

  • fins - The instrumental fractionation factor as defined by Siebers (\(\textrm{MS} = \textrm{MT} * mass^{fins}\)). Same as beta.

  • spike_fraction - The fraction of spike in the sample-spike mixture. Calculated on the basis of the four isotopes used in the inversion.

  • sample_fraction - The fraction of sample in the sample-spike mixture. Calculated on the basis of the four isotopes used in the inversion.

  • Q - The sample_fraction to spike_fraction ratio.

Array functions, e.g. np.mean and isopy.sd can be used on this object. The function will be performed on each attribute and a new DSResult object returned.

Return type

DSResult

ds_Delta

isopy.tb.ds_Delta(mass_ratio, fnat, reference_fnat=0, *, factor=1, isotope_masses=None)[source]

Calculate the Δ value for mass_ratio of a sample using the fnat mass fractionation factor.

\[\Delta \frac{smp_{i}} {smp_{j}} = \left( \left(\frac{mass_i} {mass_j} \right)^{fnat} - 1\right) * \textrm{factor}\]

Where \(norm\) is the normalisation factor. If reference_fnat values are given \(fnat\) is the difference between the fnat and reference_fnat:

\[fnat = fnat_{smp} - fnat_{ref}\]

If multiple reference_fnat values are passed the mean of those values is used. If the each reference_fnat passed has more than one value the mean is used.

Presets

The following presets are avaliable for this function:

  • ds_Delta.permil(*args, **kwargs, factor = 1000)

  • ds_Delta.delta(*args, **kwargs, factor = 1000)

  • ds_Delta.mu(*args, **kwargs, factor = 1000000.0)

ds_Delta_prime

isopy.tb.ds_Delta_prime(mass_ratio, fnat, reference_fnat=0, *, factor=1, isotope_masses=None)[source]

Calculate the Δ’ value for mass_ratio of a sample using the fnat mass fractionation factor.

\[\Delta^{\prime} \frac{smp_{i}} {smp_{j}} = \textrm{norm} * fnat * log\left(\frac{mass_i} {mass_j} \right)\]

Where norm is the normalisation factor and fnat is the difference between the sample and optional standard:

\[fnat = fnat_{smp} - fnat_{std}\]

Presets

The following presets are avaliable for this function:

  • ds_Delta_prime.permil(*args, **kwargs, factor = 1000)

  • ds_Delta_prime.delta(*args, **kwargs, factor = 1000)

  • ds_Delta_prime.mu(*args, **kwargs, factor = 1000000.0)

ds_grid

isopy.tb.ds_grid(standard, spike1, spike2=None, inversion_keys=None, n=19, *, fnat=0, fins=2, fixed_voltage=10, fixed_key=None, blank=None, blank_fixed_voltage=None, blank_fixed_key=None, integrations=100, integration_time=8.389, resistor=100000000000.0, random_seed=46, method='siebert', fins_guess=None, isotope_masses='isotope.mass', isotope_fractions='isotope.fraction', correction_method=<function ds_correction>, interferences=None, **kwargs)[source]

Compute the inversion result for a simulated measurement with varied sample/spike and spike1/spike2 ratios.

Parameters
  • standard – Any object that can be passed to make_ms_array to returns valid array. Also accepts a tuple or a dict which will be unpacked appropriately.

  • spike1 – The composition of spike 1. If spike 2 is not given then this must contain both spikes.

  • spike2 – The composition of spike 2. Not necessary if spike1 contains both spikes. In this case spike1/spike2 ratio will be fixed.

  • inversion_keys – Keys used for the inversion. Can either be 3 ratio key strings or 4 isotope key strings. Does not have to be given if the inversion keys can be inferred from spike1.

  • n – The number of intervals in the grid. The total number of data points will be \(n^2\).

  • fnat – If given, the natural fractionation fractionation factor is applied to the ms_array before interferences are added to the ms_array.

  • fins – If given, the instrumental mass fractionation factor is applied to the ms_array at the same time the interferences are added to the ms_array.

  • fixed_voltage – The voltage of the most abundant isotope in the array. The value for all other isotopes in the array are adjusted accordingly.

  • fixed_key – If not given then the sum of the inversion keys will be set to fixed_voltage.

  • blank – The blank sample to be added to the sample. Can be object that can be singularly passed to make_ms_array which returns valid array. Also accepts a tuple or a dict which will be unpacked appropriately.

  • blank_fixed_voltage – The voltage of the blank_fixed_key in returned sample that is blank.

  • blank_fixed_key – If not given then the sum of the inversion keys will be set to blank_fixed_voltage.

  • integrations – The number of simulated measurements.

  • integration_time – The integration time for each simulated measurement.

  • resistor – The resistor used for each measurement. A isotope array or a dictionary can be passed to to give different resistor values for different isotopes.

  • random_seed – Seed given for the random generator. The same seed will be used for all data points resulting in the same normal distribution for each set of integrations. If None then each point in the grid will have a different normal distribution.

  • method – Method used for the doublespike inversion. Default is the "siebert" method as it is faster however it occasionally fails to find solutions to extreme edge cases. If these are important use the "rudge" method instead.

  • fins_guess – The fins value used for the first iteration of the interference correction. If not given the fins value of an inversion without an interference correction applied is used.

  • correction_method – The method used to perform the double spike inversion. Must have the same signature as ds_correction. Defaults to ds_correction.

  • isotope_fractions – Reference value for the isotope fractions of different elements. Defaults to isopy.refval.isotope.fractions.

  • isotope_masses – Reference value for the isotope masses of different elements. Defaults to isopy.refval.isotope.mass.

  • interferences – A dictionary containing the interferences and relative abundances to the main elements.

  • kwargs – Additional keyword arguments for the inversion method.

Returns

grid_result – The returned DSGridResult contains the following attributes:

  • solutions.method - Grid containing the method used to do the inversion for each datapoint.

  • solutions.alpha - Grid containing the natural fractionation factor as defined by Rudge (\(n = N * m^\alpha\)) for each datapoint. Note this value has the opposite sign to fnat.

  • solutions.beta - Grid containing the instrumental mass fractionation factor as defined by Rudge (\(m = M * m^\beta\)) for each datapoint. Same as fins.

  • solutions.lambda_ - Grid containing the lambda value defined by Rudge for each datapoint.

  • solutions.fnat - Grid containing the natural fractionation factor as defined by Siebert (\(\textrm{SA} = \textrm{ST} * m^\alpha\)) for each datapoint. Note this value has the opposite sign to alpha.

  • solutions.fins - Grid containing the instrumental fractionation factor as defined by Siebert (\(\textrm{MT} = \textrm{MS} * m^\alpha\)) for each datapoint. Same as beta.

  • solutions.spike_fraction - Grid containing the fraction of spike in the sample-spike mixture for each datapoint. Calculated on the basis of the four isotopes used in the inversion.

  • solutions.sample_fraction - Grid containing the fraction of sample in the sample-spike mixture for each datapoint. Calculated on the basis of the four isotopes used in the inversion.

  • solutions.Q - Grid containing the sample_fraction to spike_fraction ratio for each datapoint.

  • input.doublespike_fraction - List of the true double spike fraction (\(\frac{\textrm{double spike}} {\textrm{double spike} + \textrm{sample}}\)) for each datapoint in the x-axis.

  • input.sample_fraction - List of the true sample fraction (\(\frac{\textrm{sample}} {\textrm{double spike} + \textrm{sample}}\)) for each datapoint in the x-axis.

  • input.spike1_fraction - List of the true spike 1 fraction (\(\frac{\textrm{spike 1}} {\textrm{spike 1} + \textrm{spike 2}}\)) for each datapoint in the y-axis.

  • input.spike2_fraction - List of the true spike 2 fraction (\(\frac{\textrm{spike 2}} {\textrm{spike 1} + \textrm{spike 2}}\)) for each datapoint in the y-axis.

  • input.fnat - The true natural fractionation value for each datapoint.

  • input.fins - The true instrumental fractionation value for each datapoint.

  • input.measured Grid containing the measured values for each datapoint.

The returned DSGridResult contains the following methods:

  • xyz(zeval=isopy.sd, zattr='solutions.fnat') - Returns input.doublespike_fraction. input.spike1_fraction, zeval(getattr(grid_result, zattr)).

  • yz(xval=0.5, zeval=isopy.sd, zattr='solutions.fnat') - Returns input.spike1_fraction and a 1-dimensional array of zeval(getattr(grid_result, zattr)) at xval.

  • xz(yval=0.5, zeval=isopy.sd, zattr='solutions.fnat') - Returns input.doublespike_fraction and a 1-dimensional array of zeval(getattr(grid_result, zattr)) at yval.

Return type

DSGridResult