### Install radioactivedecay from source Source: https://radioactivedecay.github.io/installation.html Install the package in editable mode from a local clone of the repository. ```bash $ pip install -e . ``` -------------------------------- ### Install radioactivedecay Source: https://radioactivedecay.github.io/_sources/overview.rst.txt Installation commands for the package using pip or conda. ```bash $ pip install radioactivedecay ``` ```bash $ conda install -c conda-forge radioactivedecay ``` -------------------------------- ### Run tests for radioactivedecay Source: https://radioactivedecay.github.io/installation.html Execute the unittest framework to verify the installation. ```bash $ cd radioactivedecay $ python -m unittest discover ``` -------------------------------- ### Initialize InventoryHP instances Source: https://radioactivedecay.github.io/inventory.html Examples of creating InventoryHP objects with different nuclide inputs and units. ```python >>> rd.InventoryHP({'Tc-99m': 2.3, 'I-123': 5.8}, 'Bq') InventoryHP activities: {'I-123': 2.3, 'Tc-99m': 5.8}, decay dataset: icrp107 >>> H3 = rd.Nuclide('H-3') >>> rd.InventoryHP({H3: 3.0} 'Bq') InventoryHP activities: {'H-3': 3.0}, decay dataset: icrp107 >>> rd.InventoryHP({'U-238': 21.1, 'Co-57': 7.2}, 'Ci') InventoryHP activities: {'Co-57': 7.2, 'U-238': 21.1}, decay dataset: icrp107 ``` -------------------------------- ### Install radioactivedecay via pip Source: https://radioactivedecay.github.io/installation.html Use this command to install the package and its dependencies from the Python Package Index. ```bash $ pip install radioactivedecay ``` -------------------------------- ### Perform basic decay calculation Source: https://radioactivedecay.github.io/_sources/overview.rst.txt Example of creating an inventory and calculating decay over time. ```python3 >>> import radioactivedecay as rd >>> inv_t0 = rd.Inventory({'H-3': 10.0}, 'Bq') >>> inv_t1 = inv_t0.decay(12.32, 'y') >>> inv_t1.activities() {'H-3': 5.0} ``` -------------------------------- ### Install radioactivedecay via conda Source: https://radioactivedecay.github.io/installation.html Use this command to install the package from the conda-forge channel. ```bash $ conda install -c conda-forge radioactivedecay ``` -------------------------------- ### CSV file format example Source: https://radioactivedecay.github.io/fileio.html A valid CSV file structure with nuclide strings and quantities. ```text H-3,1.0 C-14,2.0 ``` -------------------------------- ### Reading inventory from CSV Source: https://radioactivedecay.github.io/_sources/tutorial.rst.txt Load inventory data from a CSV file. The example shows the file format and the command to read it. ```text nuclide|amount|units C-14|5.0|Ci H-3|0.2|g He-3|1|mol ``` ```python3 >>> inv = rd.read_csv('example_file.csv', delimiter='|', skip_rows=1) ``` -------------------------------- ### Calculate decay with mass and mole units Source: https://radioactivedecay.github.io/_sources/overview.rst.txt Examples of using different units for inventory decay calculations. ```python3 >>> inv_mass_t0 = rd.Inventory({'H-3': 3.2}, 'g') >>> inv_mass_t1 = inv_mass_t0.decay(12.32, 'y') >>> inv_mass_t1.masses('g') {'H-3': 1.6000000000000003, 'He-3': 1.5999894116584246} >>> inv_mol_t0 = rd.Inventory({'C-14': 1.0}, 'mol') >>> inv_mol_t1 = inv_mol_t0.decay(3000.0, 'y') >>> inv_mol_t1.moles('mol') {'C-14': 0.6943255713073281, 'N-14': 0.3056744286926719} >>> inv_mol_t1.numbers() {'C-14': 4.181326323680147e+23, 'N-14': 1.840814436319853e+23} >>> inv_mol_t1.mole_fractions() {'C-14': 0.6943255713073281, 'N-14': 0.3056744286926719} ``` -------------------------------- ### Retrieving branching fractions Source: https://radioactivedecay.github.io/nuclide.html Getting the branching fractions to direct progeny. ```python >>> K40 = rd.Nuclide('K-40') >>> K40.branching_fractions() [0.8914, 0.1086] ``` -------------------------------- ### TSV file format example Source: https://radioactivedecay.github.io/fileio.html A valid TSV file structure including units in the third column. ```text H-3 3.0 Bq He-3 17.0 mol C-14 5.0 Ci ``` -------------------------------- ### Uninstall radioactivedecay Source: https://radioactivedecay.github.io/installation.html Remove the package using either pip or conda depending on the original installation method. ```bash $ pip uninstall radioactivedecay ``` ```bash $ conda uninstall radioactivedecay ``` -------------------------------- ### Initializing inventories with different units Source: https://radioactivedecay.github.io/_sources/tutorial.rst.txt Demonstrates initializing inventories using default activity units (Bq) or explicit atom counts ('num'). ```python3 # initialize an inventory using activities: >>> inv = rd.Inventory({'C-14': 5.0, 'H-3': 2.0}) >>> inv.activities('Bq') {'C-14': 5.0, 'H-3': 2.0} >>> inv.numbers() {'C-14': 1297520091697.4946, 'H-3': 1121785791.5588164} # initialize an inventory using number of atoms: >>> inv = rd.Inventory({'U-238': 2000.0, 'U-235': 3000.0, 'U-234': 1500.0}, 'num') >>> inv.activities('Bq') {'U-234': 1.3420556696283726e-10, 'U-235': 9.360075764027427e-14, 'U-238': 9.832129719300668e-15} >>> inv.numbers() {'U-234': 1500.0, 'U-235': 3000.0, 'U-238': 2000.0} ``` -------------------------------- ### Initializing Inventory Instances Source: https://radioactivedecay.github.io/inventory.html Create Inventory objects using different input formats like nuclide strings, Nuclide objects, or canonical IDs with various units. ```python >>> rd.Inventory({'Tc-99m': 2.3, 'I-123': 5.8}, 'Bq') Inventory activities (Bq): {'I-123': 2.3, 'Tc-99m': 5.8}, decay dataset: icrp107_ame2020_nubase2020 >>> H3 = rd.Nuclide('H-3') >>> rd.Inventory({H3: 3.0}, 'g') Inventory activities (Bq): {'H-3': 1067957043281807.0}, decay dataset: icrp107_ame2020_nubase2020 >>> rd.Inventory({270570000: 7.2, 922380000: 21.1}, 'Ci') Inventory activities (Bq): {'Co-57': 266400000000.0, 'U-238': 780700000000.0001}, decay dataset: icrp107_ame2020_nubase2020 ``` -------------------------------- ### Retrieve Canonical ID Source: https://radioactivedecay.github.io/_sources/tutorial.rst.txt Get the canonical zzzaaammmm format ID for a nuclide. ```python3 >>> nuc = rd.Nuclide('Co-58m') >>> nuc.id 270580001 ``` -------------------------------- ### Retrieving decay modes Source: https://radioactivedecay.github.io/nuclide.html Getting the decay mode labels defined in the dataset. ```python >>> K40 = rd.Nuclide('K-40') >>> K40.decay_modes() ['β-', 'β+ & EC'] ``` -------------------------------- ### Creating a nuclide inventory Source: https://radioactivedecay.github.io/_sources/tutorial.rst.txt Initialize an inventory of nuclides specifying the amount and unit type. ```python3 >>> inv_t0 = rd.Inventory({'U-238': 99.274, 'U-235': 0.720, 'U-234': 0.005}, 'mol') ``` -------------------------------- ### Specify Nuclides via Multiple Formats Source: https://radioactivedecay.github.io/_sources/tutorial.rst.txt Demonstrates equivalent ways to specify nuclides, including string formats and canonical IDs. ```python >>> inv = rd.Inventory({'Rn-222': 1.0}) >>> inv = rd.Inventory({'Rn222': 1.0}) >>> inv = rd.Inventory({'222Rn': 1.0}) >>> inv = rd.Inventory({862220000: 1.0}) ``` -------------------------------- ### Initializing Nuclide instances Source: https://radioactivedecay.github.io/nuclide.html Constructing Nuclide objects using various string formats or canonical IDs. ```python >>> rd.Nuclide('K-40') Nuclide: K-40, decay dataset: icrp107_ame2020_nubase2020 >>> rd.Nuclide('K40') Nuclide: K-40, decay dataset: icrp107_ame2020_nubase2020 >>> rd.Nuclide(190400000) Nuclide: K-40, decay dataset: icrp107_ame2020_nubase2020 >>> rd.Nuclide(280560001) Nuclide: Ni-56m, decay dataset: icrp107_ame2020_nubase2020 ``` -------------------------------- ### Importing the radioactivedecay package Source: https://radioactivedecay.github.io/api.html Standard import convention used throughout the documentation. ```python >>> import radioactivedecay as rd ``` -------------------------------- ### Clone the radioactivedecay repository Source: https://radioactivedecay.github.io/installation.html Download the source code from GitHub to access the test suite. ```bash $ git clone https://github.com/radioactivedecay/radioactivedecay.git ``` -------------------------------- ### Inspecting inventory contents Source: https://radioactivedecay.github.io/_sources/tutorial.rst.txt Retrieve inventory data in various units such as activities, masses, moles, and atom counts. ```python3 >>> inv_t0.activities('MBq') {'U-234': 269.4016050086039, 'U-235': 13.528246506057048, 'U-238': 293.90300567125} >>> inv_t0.nuclides ['U-234', 'U-235', 'U-238'] >>> inv_t0.numbers() {'U-234': 3.01107038e+21, 'U-235': 4.3359413471999995e+23, 'U-238': 5.9784200180824e+25} >>> inv_t0.masses('g') {'U-234': 1.17020475148, 'U-235': 169.23162824424, 'U-238': 23632.253822284463} >>> inv_t0.mass_fractions() {'U-234': 4.916278117985593e-05, 'U-235': 0.007109779290811992, 'U-238': 0.992841057928008} >>> inv_t0.moles() {'U-234': 0.005, 'U-235': 0.72, 'U-238': 99.274} >>> inv_t0.mole_fractions() {'U-234': 5.000050000500006e-05, 'U-235': 0.0072000720007200075, 'U-238': 0.992749927499275} >>> inv_t0 Inventory activities (Bq): {'U-234': 269401605.0086039, 'U-235': 13528246.506057048, 'U-238': 293903005.67125}, decay dataset: icrp107_ame2020_nubase2020 ``` -------------------------------- ### build_nuclide_string(Z, A, meta_state='') Source: https://radioactivedecay.github.io/utils.html Builds a nuclide string from given atomic mass and number. ```APIDOC ## build_nuclide_string(Z, A, meta_state='') ### Description Builds a nuclide string from given atomic mass and number. ### Parameters - **Z** (int) - Required - Atomic number. - **A** (int) - Required - Atomic mass. - **meta_state** (str) - Optional - Metastable state indicator character. ### Returns - (str) - Nuclide string built in symbol - mass number format. ``` -------------------------------- ### add Source: https://radioactivedecay.github.io/inventory.html Adds quantities to the existing inventory. ```APIDOC ## add(add_contents, units='Bq') ### Description Updates the inventory by adding the specified quantities of nuclides. ### Parameters - **add_contents** (dict) - Required - Dictionary of nuclides and quantities to add. - **units** (str) - Optional - Units of the values being added. Default is 'Bq'. ``` -------------------------------- ### InventoryHP Constructor Source: https://radioactivedecay.github.io/inventory.html Initializes a new InventoryHP instance with a dictionary of nuclides and their quantities. ```APIDOC ## InventoryHP(contents, units='Bq', check=True, decay_data=None) ### Description Creates an instance of an inventory using high-precision arithmetic for radioactive decay calculations. ### Parameters - **contents** (dict) - Required - Dictionary of nuclides (strings/objects) and their quantities. - **units** (str) - Optional - Units of the values (e.g., 'Bq', 'Ci', 'g'). Default is 'Bq'. - **check** (bool) - Optional - Whether to validate contents and decay data. Default is True. - **decay_data** (DecayData) - Optional - The decay dataset to use. ``` -------------------------------- ### Calculate Isotope Activities After Decay Source: https://radioactivedecay.github.io/_sources/tutorial.rst.txt Demonstrates using the decay() method to calculate activities of isotopes after a specified time period. ```python >>> inv_t1 = inv_t0.decay(1E9, 'y') >>> inv_t1.activities('Bq') {'Ac-227': 5054315.0114205815, 'At-218': 50337.39144073731, 'At-219': 4.184972829456502, 'Bi-210': 251686958.45501313, 'Bi-211': 5054319.0714315465, 'Bi-214': 251686906.8663001, 'Bi-215': 4.059423644572891, 'Fr-223': 69749.54715760818, 'Hg-206': 4.782052210630576, 'Pa-231': 5054314.855110146, 'Pa-234': 402670.06690959306, 'Pa-234m': 251668791.81845263, 'Pb-206': 0.0, 'Pb-207': 0.0, 'Pb-210': 251686958.45423996, 'Pb-211': 5054319.071431517, 'Pb-214': 251636619.8122487, 'Po-210': 251686958.47635475, 'Po-211': 13949.920637151068, 'Po-214': 251634102.95324954, 'Po-215': 5054319.071431024, 'Po-218': 251686957.20368654, 'Ra-223': 5054315.01200738, 'Ra-226': 251686957.20309648, 'Rn-218': 50.33739144073732, 'Rn-219': 5054315.01200738, 'Rn-222': 251686957.20368624, 'Th-227': 4984565.464625097, 'Th-230': 251686867.07347885, 'Th-231': 5054079.657163195, 'Th-234': 251668791.81845245, 'Tl-206': 337.00883737124855, 'Tl-207': 5040369.15079446, 'Tl-210': 52854.250441923046, 'U-234': 251682620.8433893, 'U-235': 5054079.657142295, 'U-238': 251668791.8147358} ``` -------------------------------- ### Plotting inventory decay graphs Source: https://radioactivedecay.github.io/_sources/plotting.rst.txt Creates graphs showing the decay of nuclides in an inventory over time, with options for scaling and filtering. ```python3 >>> inv = rd.Inventory({'Rn-222': 10.0}) >>> fig, ax = inv.plot(5, 'h') ``` ```python3 >>> fig, ax = inv.plot(1000, 'd', xscale='log', yscale='log', xmin=1, ymin=1E-17, yunits='mg') ``` ```python3 >>> fig, ax = inv.plot(1000, 'd', display=['Rn-222', 'Pb-210', 'Po-210'], xscale='log', yscale='log', xmin=1, ymin=1E-8) ``` ```python3 >>> fig, ax = inv.plot(5, 'h', order='alphabetical') ``` -------------------------------- ### Initialize and Analyze Radioactive Decay Inventory Source: https://radioactivedecay.github.io/_sources/tutorial.rst.txt Initializes an inventory with specific isotope quantities and generates a decay time series dataframe. The resulting dataframe can be filtered to isolate isotopes exceeding a specific quantity threshold. ```python >>> inv = rd.Inventory({'U-238': 2000.0, 'U-235': 3000.0, 'U-234': 1500.0}, 'num') >>> df = inv.decay_time_series_pandas(time_period=1E9, time_units='y', decay_units='num', npoints=10) >>> df Ac-227 At-218 At-219 Bi-210 Bi-211 Bi-214 Bi-215 Fr-223 Hg-206 ... Th-230 Th-231 Th-234 Tl-206 Tl-207 Tl-210 U-234 U-235 U-238 Time (y) ... 0.000000e+00 0.000000 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 ... 0.000000 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1500.000000 3000.000000 2000.000000 1.111111e+08 0.000083 4.183008e-18 5.612824e-18 6.039192e-09 1.554277e-11 1.664837e-11 4.433329e-17 2.205038e-12 1.295477e-19 ... 0.033168 1.112054e-08 2.903132e-08 4.704880e-18 3.454878e-11 2.283922e-16 0.108020 2689.120153 1965.820782 2.222222e+08 0.000075 4.111522e-18 5.031186e-18 5.935985e-09 1.393213e-11 1.636385e-11 3.973918e-17 1.976537e-12 1.273338e-19 ... 0.032601 9.968160e-09 2.853519e-08 4.624475e-18 3.096861e-11 2.244890e-16 0.106174 2410.455732 1932.225673 3.333333e+08 0.000067 4.041257e-18 4.509821e-18 5.834541e-09 1.248839e-11 1.608420e-11 3.562115e-17 1.771716e-12 1.251577e-19 ... 0.032044 8.935193e-09 2.804754e-08 4.545445e-18 2.775944e-11 2.206526e-16 0.104360 2160.668362 1899.204692 4.444444e+08 0.000060 3.972194e-18 4.042484e-18 5.734831e-09 1.119426e-11 1.580933e-11 3.192985e-17 1.588119e-12 1.230188e-19 ... 0.031496 8.009269e-09 2.756821e-08 4.467765e-18 2.488282e-11 2.168817e-16 0.102577 1936.765612 1866.748026 5.555556e+08 0.000054 3.904311e-18 3.623575e-18 5.636825e-09 1.003423e-11 1.553915e-11 2.862107e-17 1.423547e-12 1.209165e-19 ... 0.030958 7.179296e-09 2.709708e-08 4.391413e-18 2.230430e-11 2.131753e-16 0.100824 1736.065147 1834.846033 6.666667e+08 0.000048 3.837588e-18 3.248076e-18 5.540494e-09 8.994421e-12 1.527360e-11 2.565516e-17 1.276030e-12 1.188501e-19 ... 0.030429 6.435330e-09 2.663401e-08 4.316365e-18 1.999298e-11 2.095322e-16 0.099100 1556.162591 1803.489231 7.777778e+08 0.000043 3.772005e-18 2.911489e-18 5.445809e-09 8.062360e-12 1.501258e-11 2.299660e-17 1.143799e-12 1.168190e-19 ... 0.029909 5.768458e-09 2.617884e-08 4.242600e-18 1.792117e-11 2.059514e-16 0.097407 1394.902728 1772.668305 8.888889e+08 0.000039 3.707543e-18 2.609781e-18 5.352742e-09 7.226885e-12 1.475602e-11 2.061354e-17 1.025271e-12 1.148226e-19 ... 0.029398 5.170692e-09 2.573145e-08 4.170096e-18 1.606406e-11 2.024318e-16 0.095742 1250.353679 1742.374097 1.000000e+09 0.000035 3.644182e-18 2.339338e-18 5.261266e-09 6.477987e-12 1.450384e-11 1.847743e-17 9.190258e-13 1.128603e-19 ... 0.028895 4.634871e-09 2.529171e-08 4.098830e-18 1.439940e-11 1.989723e-16 0.094106 1120.783759 1712.597605 [10 rows x 37 columns] >>> df.loc[:, df.max() > 100] Pb-206 Pb-207 U-234 U-235 U-238 Time (y) 0.000000e+00 0.000000 0.000000 1500.000000 3000.000000 2000.000000 1.111111e+08 1534.039370 310.754872 0.108020 2689.120153 1965.820782 2.222222e+08 1567.636948 589.432493 0.106174 2410.455732 1932.225673 3.333333e+08 1600.660357 839.231695 0.104360 2160.668362 1899.204692 4.444444e+08 1633.119409 1063.145051 0.102577 1936.765612 1866.748026 5.555556e+08 1665.023749 1263.855025 0.100824 1736.065147 1834.846033 6.666667e+08 1696.382856 1443.766102 0.099100 1556.162591 1803.489231 7.777778e+08 1727.206048 1605.033604 0.097407 1394.902728 1772.668305 8.888889e+08 1757.502483 1749.589500 0.095742 1250.353679 1742.374097 1.000000e+09 1787.281165 1879.165558 0.094106 1120.783759 1712.597605 ``` -------------------------------- ### Standard Inventory Decay Calculation Source: https://radioactivedecay.github.io/_sources/theory.rst.txt Demonstrates a standard decay calculation for Es-254, which may result in small numerical artifacts for progeny activities. ```python >>> inv = rd.Inventory({'Es-254': 1.0}) >>> inv.decay(0.0).activities() {'At-218': -8.24439035981494e-30, 'Bi-210': 2.5308844932098316e-26, 'Bi-214': -4.256549745172888e-26, 'Bk-250': 0.0, 'Cf-250': 0.0, 'Cm-246': 8.802967479989175e-21, 'Es-254': 1.0, 'Fm-254': 0.0, 'Hg-206': -3.4696439711117526e-34, 'Pa-234': 2.330729590281097e-29, 'Pa-234m': -1.5696690930108473e-26, 'Pb-206': 0.0, 'Pb-210': 2.673060958594837e-26, 'Pb-214': -7.310828272597407e-27, 'Po-210': -1.048466176320909e-27, 'Po-214': 2.3260114484256133e-26, 'Po-218': -1.1433437709020225e-26, 'Pu-242': 1.3827905917787723e-22, 'Ra-226': -1.0811575068833228e-26, 'Rn-218': -1.618765025703667e-33, 'Rn-222': -1.581593359682259e-26, 'Th-230': -1.2628442466252288e-26, 'Th-234': -2.6140879622245746e-27, 'Tl-206': -4.332210492987691e-34, 'Tl-210': 2.2028710112960294e-31, 'U-234': -1.0389580591195201e-26, 'U-238': -8.466705440297454e-27} ``` -------------------------------- ### Manage Inventory with Nuclide Objects Source: https://radioactivedecay.github.io/_sources/tutorial.rst.txt Use Nuclide objects instead of strings when initializing or modifying an Inventory. Note that the Inventory's decay dataset takes precedence if it differs from the Nuclide's. ```python3 >>> H3 = rd.Nuclide('H-3') >>> inv = rd.Inventory({H3: 1.0}) >>> inv.activities() {'H-3': 1.0} >>> Be10 = rd.Nuclide('Be-10') >>> inv.add({Be10: 2.0}) >>> inv.activities() {'Be-10': 2.0, 'H-3': 1.0} >>> inv.remove(H3) >>> inv.activities() {'Be-10': 2.0} ``` -------------------------------- ### load_dataset(dataset_name, dir_path=None, load_sympy=False) Source: https://radioactivedecay.github.io/decaydata.html Loads a radioactive decay dataset from either the bundled sub-packages or a specified local directory. ```APIDOC ## load_dataset(dataset_name, dir_path=None, load_sympy=False) ### Description Loads a decay dataset, either from a set of data files packaged within radioactivedecay, or by specifying a local directory containing the data files. ### Parameters - **dataset_name** (str) - Required - Name of the decay dataset (or sub-package directory name). - **dir_path** (None or str) - Optional - Path to the directory containing the decay dataset files. Default is None. - **load_sympy** (bool) - Optional - Load SymPy version of the decay data for arbitrary-precision decay calculations. Default is False. ### Returns - **DecayData** - A decay dataset object used by radioactivedecay. ``` -------------------------------- ### Calculating Activity Fractions Source: https://radioactivedecay.github.io/inventory.html Determine the proportion of total activity contributed by each nuclide in the inventory. ```python >>> rd.Inventory({'Tc-99m': 2.3, 'I-123': 5.8}, 'Bq').activity_fractions() {'I-123': 0.7160493827160493, 'Tc-99m': 0.2839506172839506} ``` -------------------------------- ### Calculate Mole Fractions Source: https://radioactivedecay.github.io/inventory.html Returns a dictionary containing the mole fraction of each nuclide in the inventory. ```python >>> rd.Inventory({'Tc-99m': 2.3, 'I-123': 5.8}, 'Bq').mole_fractions() {'I-123': 0.8476385041932588, 'Tc-99m': 0.15236149580674116} ``` -------------------------------- ### Build nuclide string Source: https://radioactivedecay.github.io/utils.html Constructs a nuclide string in symbol-mass format from atomic number and mass. ```python >>> rd.utils.build_nuclide_string(26, 56) 'Fe-56' >>> rd.utils.build_nuclide_string(28, 56, 'm') 'Fe-56m' ``` -------------------------------- ### Retrieving Inventory Activities Source: https://radioactivedecay.github.io/inventory.html Calculate and return the activity of each nuclide in the inventory in specified units. ```python >>> rd.Inventory({'Tc-99m': 2300, 'I-123': 5800}, 'Bq').activities('kBq') {'I-123': 5.8, 'Tc-99m': 2.3} ``` -------------------------------- ### Scale Inventory by Constants Source: https://radioactivedecay.github.io/_sources/tutorial.rst.txt Multiply or divide all nuclide amounts in an inventory by a constant value. ```python3 >>> inv = rd.Inventory({'Sr-90': 1.0, 'Cs-137': 1.0}, 'num') >>> inv = 2*inv >>> inv.numbers() {'Sr-90': 2.0, 'Cs-137': 2.0} >>> inv = inv / 2 >>> inv.numbers() {'Sr-90': 1.0, 'Cs-137': 1.0} ``` -------------------------------- ### Accessing atomic mass Source: https://radioactivedecay.github.io/nuclide.html Retrieving the atomic mass in g/mol. ```python >>> H3 = rd.Nuclide('H-3') >>> H3.atomic_mass 3.01604928132 >>> Ba137m = rd.Nuclide('Ba-137m') >>> Ba137m.atomic_mass 136.9065375271172 ``` -------------------------------- ### plot() Source: https://radioactivedecay.github.io/inventory.html Plots a decay graph using high precision decay calculations. ```APIDOC ## plot(xmax, xunits='s', xmin=0.0, xscale='linear', yscale='linear', ymin=0.0, ymax=None, yunits='Bq', display='all', order='dataset', npoints=51, fig=None, axes=None, **kwargs) ### Description Plots a decay graph using high precision decay calculations. ### Parameters - **xmax** (float) - Required - Maximum decay time on x-axis. - **xunits** (str) - Optional - Units for decay times. Default is 's'. - **xmin** (float) - Optional - Minimum decay time on x-axis. - **xscale** (str) - Optional - Time axis scale type ('linear' or 'log'). Default is 'linear'. - **yscale** (str) - Optional - Y-axis scale type ('linear' or 'log'). Default is 'linear'. - **ymin** (float) - Optional - Minimum value for the y-axis. - **ymax** (float) - Optional - Maximum value for the y-axis. - **yunits** (str) - Optional - Units to display on the y-axis. Default is 'Bq'. - **display** (str/list) - Optional - Nuclides to display. Default is 'all'. - **order** (str) - Optional - Order to display decay curves ('dataset' or 'alphabetical'). Default is 'dataset'. - **npoints** (int) - Optional - Number of time points. Default is 51. ### Returns - **tuple[Figure, Axes]** - A tuple containing the matplotlib figure and axes objects. ``` -------------------------------- ### Calculate Mass Fractions Source: https://radioactivedecay.github.io/inventory.html Returns a dictionary containing the mass fraction of each nuclide in the inventory. ```python >>> rd.Inventory({'Tc-99m': 2.3, 'I-123': 5.8}, 'Bq').mass_fractions() {'I-123': 0.8736297770616593, 'Tc-99m': 0.12637022293834066} ``` -------------------------------- ### Nuclide Class Constructor Source: https://radioactivedecay.github.io/nuclide.html Initializes a new Nuclide instance from a name string or canonical ID. ```APIDOC ## Class: Nuclide ### Description Represents a single nuclide. Can be constructed from a string (e.g., 'H-3') or a canonical ID (zzzaaassss). ### Constructor `Nuclide(nuclide: str | int, decay_data: DecayData = None)` ### Parameters - **nuclide** (str | int) - Required - The nuclide name or canonical ID. - **decay_data** (DecayData) - Optional - The decay dataset to use (defaults to ICRP-107). ``` -------------------------------- ### activities Source: https://radioactivedecay.github.io/inventory.html Returns the activity of each nuclide in the inventory. ```APIDOC ## activities(units='Bq') ### Description Calculates and returns the activity of each nuclide in the inventory as a dictionary. ### Parameters - **units** (str) - Optional - The units for the returned activity values. Default is 'Bq'. ``` -------------------------------- ### Export Inventory to CSV Source: https://radioactivedecay.github.io/_sources/tutorial.rst.txt Write inventory contents to a file using the to_csv method with custom delimiters and unit formatting. ```python3 >>> inv = rd.Inventory({'Cs-137': 1.02, 'Sr-90': 3.05}, 'Bq') >>> inv.to_csv('test_output.csv', units='mBq', delimiter='|', write_units=True, header=["nuclide", "quantity", "units"]) ``` ```text nuclide|amount|units Cs-137|1020.0|mBq Sr-90|3050.0|mBq ``` -------------------------------- ### to_csv Source: https://radioactivedecay.github.io/inventory.html Writes the inventory contents to a CSV file. ```APIDOC ## to_csv(filename, units='Bq', delimiter=',', write_units=False, header=None, encoding='utf-8') ### Description Exports the current inventory data to a CSV file format. ### Parameters - **filename** (str|Path) - Required - Path to the output file. - **units** (str) - Optional - Output units for quantities. Default is 'Bq'. - **delimiter** (str) - Optional - Delimiter character. Default is ','. - **write_units** (bool) - Optional - Whether to include a units column. Default is False. - **header** (list[str]|None) - Optional - List of column names for the header row. - **encoding** (str) - Optional - File encoding. Default is 'utf-8'. ``` -------------------------------- ### decay_time_series_pandas(time_period, time_units='s', time_scale='linear', decay_units='Bq', npoints=501) Source: https://radioactivedecay.github.io/inventory.html Returns a pandas DataFrame with the initial isotope and all decay progeny decayed for the amount of time specified. ```APIDOC ## decay_time_series_pandas(time_period, time_units='s', time_scale='linear', decay_units='Bq', npoints=501) ### Description Returns a pandas DataFrame containing the decay data for the initial isotope and all progeny over the specified time period. ### Parameters - **time_period** (float | ndarray) - Required - Time to decay the chain. - **time_units** (str) - Optional - Units for time series. - **time_scale** (str) - Optional - 'linear' or 'log'. - **decay_units** (str) - Optional - Units for decayed values. - **npoints** (int) - Optional - Number of time points. ### Response - **DataFrame** - A pandas DataFrame containing the decay time series data. ``` -------------------------------- ### Calculate Branching Fractions Source: https://radioactivedecay.github.io/inventory.html Retrieves the branching fractions for nuclides in the inventory. ```python >>> inv = rd.Inventory({'C-14': 1.0, 'K-40': 2.0}, 'Bq') >>> inv.branching_fractions() {'C-14': [1.0], 'K-40': [0.8914, 0.1086]) ``` -------------------------------- ### radioactivedecay.fileio.read_csv Source: https://radioactivedecay.github.io/fileio.html Creates an Inventory or InventoryHP instance by reading nuclide quantities from a CSV or TSV file. ```APIDOC ## radioactivedecay.fileio.read_csv(filepath, inventory_type='Inventory', units=None, decay_data=None, delimiter=',', skip_rows=0, encoding='utf-8') ### Description Create an inventory by reading from a CSV file. The file must contain at least two columns: nuclide strings/canonical ids and quantities. An optional third column can specify units. ### Parameters - **filepath** (str or pathlib.Path) - Required - Name or path of the file to read in. - **inventory_type** (str) - Optional - The type of inventory to create: 'Inventory' (default) or 'InventoryHP'. - **units** (str or None) - Optional - The units of the nuclide quantities. Overridden by units specified in the file. - **decay_data** (DecayData or None) - Optional - The decay dataset to use. Defaults to ICRP-107. - **delimiter** (str) - Optional - The delimiter used to separate items. Default is ','. - **skip_rows** (int) - Optional - Number of rows to ignore at the start of the file. Default is 0. - **encoding** (str) - Optional - Encoding of the file. Default is 'utf-8'. ### Returns - **Inventory | InventoryHP** - An inventory instance populated with the data from the file. ### Raises - **ValueError** - If the file or function parameters are invalid. ``` -------------------------------- ### build_id(Z, A, state='') Source: https://radioactivedecay.github.io/utils.html Builds a canonical nuclide id from atomic number, atomic mass, and energy state. ```APIDOC ## build_id(Z, A, state='') ### Description Builds a canonical nuclide id from atomic number, atomic mass, and energy state. ### Parameters - **Z** (int) - Required - Atomic number. - **A** (int) - Required - Atomic mass. - **state** (str) - Optional - Energy state. ### Returns - (int) - Canonical nuclide id. ``` -------------------------------- ### decay_time_series(time_period, time_units='s', time_scale='linear', decay_units='Bq', npoints=501) Source: https://radioactivedecay.github.io/inventory.html Returns a tuple containing time points and decay data for the initial isotope and all progeny over a specified time period. ```APIDOC ## decay_time_series(time_period, time_units='s', time_scale='linear', decay_units='Bq', npoints=501) ### Description Returns a tuple with time data and decay data for the initial isotope and all progeny decayed for the specified time_period. ### Parameters - **time_period** (float | ndarray) - Required - Time to decay the chain. - **time_units** (str) - Optional - Units for time series (default 's'). - **time_scale** (str) - Optional - 'linear' or 'log' (default 'linear'). - **decay_units** (str) - Optional - Units for decayed values (default 'Bq'). - **npoints** (int) - Optional - Number of time points (default 501). ### Response - **tuple[list[float], dict[str, list[float]]]** - A tuple containing the time points list and a dictionary of isotopes with their decay data lists. ``` -------------------------------- ### Retrieve Progeny and Decay Modes Source: https://radioactivedecay.github.io/_sources/tutorial.rst.txt Obtain direct progeny, branching fractions, and decay modes for a radionuclide. ```python3 >>> nuc.progeny() ['Te-123', 'Te-123m'] >>> nuc.branching_fractions() [0.99996, 4.442e-05] >>> nuc.decay_modes() ['EC', 'EC'] ``` -------------------------------- ### Retrieve Inventory Progeny Source: https://radioactivedecay.github.io/inventory.html Returns a dictionary mapping nuclides to their direct progeny, ordered by branching fraction. ```python >>> inv = rd.Inventory({'C-14': 1.0, 'K-40': 2.0}, 'Bq') >>> inv.progeny() {'C-14': ['N-14'], 'K-40': ['Ca-40', 'Ar-40']) ``` -------------------------------- ### Perform Inventory Addition Source: https://radioactivedecay.github.io/_sources/tutorial.rst.txt Combine the contents of two inventories using the addition operator. ```python3 >>> inv1 = rd.Inventory({'H-3': 1.0}, 'g') >>> inv2 = rd.Inventory({'C-14': 1.0}, 'g') >>> inv = inv1 + inv2 >>> inv.masses() {'C-14': 1.0, 'H-3': 1.0} ``` -------------------------------- ### Inventory Operations with Units Source: https://radioactivedecay.github.io/_sources/tutorial.rst.txt Perform inventory modifications using different input units such as number of atoms or mass. ```python3 >>> inv.add({'H-3': 1.3E9}, 'num') >>> inv.activities() {'C-14': 3.0, 'H-3': 2.3177330463306007} >>> inv.subtract({'C-14': 7.1E-12}, 'g') >>> inv.activities() {'C-14': 1.8233790683016682, 'H-3': 2.3177330463306007} ``` -------------------------------- ### branching_fraction(parent, progeny) Source: https://radioactivedecay.github.io/decaydata.html Returns the branching fraction for a specified parent to progeny transition. ```APIDOC ## branching_fraction(parent: str, progeny: str) -> float ### Description Returns the branching fraction for parent to progeny (if it exists). ### Parameters - **parent** (str) - Required - Nuclide string of the parent. - **progeny** (str) - Required - Nuclide string of the progeny (can be stable or radioactive nuclide). ### Returns - **float** - Branching fraction (or zero if progeny is not actually a direct progeny of parent). ``` -------------------------------- ### Plot inventory decay Source: https://radioactivedecay.github.io/_sources/overview.rst.txt Visualize the decay of an inventory over a specified time period. ```python3 >>> inv_t0.plot(100, 'y') ``` -------------------------------- ### Retrieve Nuclides List Source: https://radioactivedecay.github.io/inventory.html Returns a list of all nuclides present in the inventory. ```python >>> rd.Inventory({'Tc-99m': 2.3, 'I-123': 5.8}, 'Bq').nuclides ['I-123', 'Tc-99m'] ```