Skip to main content

A Python package for radioactive decay calculations that supports 1252 radionuclides, including full decay chains and branching.

Project description

radioactivedecay

PyPI Python Version Latest Documentation Test Coverage

radioactivedecay is a Python package for radioactive decay calculations. It fully supports radionuclide decay chains, including those with branching decays or chains passing through metastable states. By default radioactivedecay uses the decay data from ICRP Publication 107, which covers 1252 radionuclides of 97 elements.

Installation

radioactivedecay requires Python 3.6+, NumPy and SciPy.

The easiest way to install radioactivedecay is via the Python Package Index using pip:

$ pip install radioactivedecay

Usage

Decay calculations

Create an Inventory of radionuclides and decay it as follows:

>>> import radioactivedecay as rd
>>> inv = rd.Inventory({'I-123': 1.0, 'Tc-99m': 2.0})
>>> inv = inv.decay(20.0, 'h')
>>> inv.contents
{'I-123': 0.35180331802323694,
 'Tc-99': 5.852125859801924e-09,
 'Tc-99m': 0.19957172182663926,
 'Te-123': 1.6353735405592892e-18,
 'Te-123m': 1.3312369019952352e-07}

Here we created an inventory of 1.0 Bq of 123I and 2.0 Bq of 99mTc and decayed it for 20 hours. The decayed inventory contains 99Tc, which is the progeny of 99mTc, and 123Te and 123mTe, which are progeny of 123I.

Note that radioactivedecay does not require you specify the activity units. This is because its calculations are agnostic of the activity units: units out are the same as units in. So this calculation could have also represented the decay of 1.0 Ci of 123I, or 1.0 dpm, or 1.0 kBq, etc.

However, you have to specify the units of the decay time. In the example we supplied 'h' as an argument to the decay() method to specify the decay time period (20.0) had units of hours. Accepted time units include 'ms', 's', 'm', 'h', 'd', 'y' etc. Note seconds ('s') is the default if you do not supply a time unit to decay()

Radionuclides can be specified in three equivalent ways in radioactivedecay. The strings

  • 'Rn-222', 'Rn222' or '222Rn',
  • 'Ir-192n', 'Ir192n' or '192nIr' are all equivalent ways of specifying 222Rn and 192nIr to the program.

Fetching decay data

radioactivedecay includes a Radionuclide class which can be used to fetch decay information for individual radionuclides.

>>> nuc = rd.Radionuclide('I-123')
>>> nuc.half_life('d')
13.27
>>> nuc.progeny()
['Te-123', 'Te-123m']
>>> nuc.branching_fractions()
[0.99996, 4.442e-05]
>>> nuc.decay_modes()
['EC', 'EC']

The half-life for 123I is thus 13.27 days. Its direct progeny are 123Te and 123mTe, with branching fractions 0.99996 and 4.442e-05 respectively. Both of the decay modes occur via electron capture (EC).

The default decay dataset in radioactivedecay is ICRP-107. Its data can be queried directly as follows:

>>> rd.DEFAULTDATA.dataset
'icrp107'
>>> rd.DEFAULTDATA.half_life('Cs-137', 'y')
30.1671
>>> rd.DEFAULTDATA.branching_fraction('Cs-137', 'Ba-137m')
0.94399
>>> rd.DEFAULTDATA.decay_mode('Cs-137', 'Ba-137m')
'β-'

How radioactivedecay works

radioactivedecay calculates an analytical solution to the decay chain differential equations using matrix multiplications. It implements the method described in this paper: M Amaku, PR Pascholati & VR Vanin, Comp. Phys. Comm. 181, 21-23 (2010). It calls NumPy and SciPy for the matrix operations.

By default radioactivedecay uses decay data from ICRP Publication 107 (2008).

The notebooks folder in the GitHub repository contains Jupyter Notebooks for creating the processed decay datasets that are read in by radioactivedecay, e.g. ICRP 107. It also contains some comparisons of decay calculations against the PyNE and Radiological Toolbox codes.

Tests

From the base directory run:

$ python -m unittest discover

License

radioactivedecay is open source software released under the MIT License. The ICRP-107 decay data is copyright 2008 A. Endo and K.F. Eckerman. See LICENSE for details.

Contributing

Contributors are welcome to fix bugs, add new features or make feature requests. Please open a pull request or a new issue on the GitHub repository.

Acknowledgements

Special thanks to

for their help and support to this project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

radioactivedecay-0.0.9.tar.gz (134.8 kB view hashes)

Uploaded Source

Built Distribution

radioactivedecay-0.0.9-py3-none-any.whl (135.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page