A Python package for radioactive decay calculations that supports 1252 radionuclides, including full decay chains and branching.
Project description
radioactivedecay
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.
- Full Documentation: https://alexmalins.com/radioactivedecay
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.contents
{'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('I123')
>>> 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).
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 radioactive decay, 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
- Center for Computational Science & e-Systems, Japan Atomic Energy Agency
- Kenny McKee for their help and support to this project.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for radioactivedecay-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eddb150286c838dd51f604aa0246416b8505156675da4941b64b58d8de623bb9 |
|
MD5 | a78b890f769715699fb6b6649830a190 |
|
BLAKE2b-256 | 30a9c459be64daeae00a7ddbebe85f2441fc676297640311bf7be2476d958a0a |