{ "cells": [ { "cell_type": "markdown", "id": "41ead5fc-5552-42e6-881c-45a1ed144d77", "metadata": {}, "source": [ "# Produce sample of radioactive decay data files" ] }, { "cell_type": "code", "execution_count": 1, "id": "5911301f-43c6-4b41-b22e-996b6c9a9594", "metadata": { "execution": { "iopub.execute_input": "2026-01-19T15:04:52.471943Z", "iopub.status.busy": "2026-01-19T15:04:52.471784Z", "iopub.status.idle": "2026-01-19T15:04:53.305677Z", "shell.execute_reply": "2026-01-19T15:04:53.304881Z" } }, "outputs": [], "source": [ "import sandy\n", "import glob" ] }, { "cell_type": "markdown", "id": "ff81c09a-cab4-4414-966f-46f543ef11f1", "metadata": {}, "source": [ "## Sampling procedure" ] }, { "cell_type": "markdown", "id": "30624ae2-d982-423f-bf22-a9acb573bc10", "metadata": {}, "source": [ "Get a few ENDF-6 decay data files from JEFF-3.3, just to make the notebook run faster.\n", "> To process the full radioactive decay data library just replace this line with `sandy.get_endf6_file(\"jeff_33\", \"decay\", \"all\")`" ] }, { "cell_type": "code", "execution_count": 2, "id": "5fcc5280-36da-482a-a5a6-88e728bc51ce", "metadata": { "execution": { "iopub.execute_input": "2026-01-19T15:04:53.307824Z", "iopub.status.busy": "2026-01-19T15:04:53.307589Z", "iopub.status.idle": "2026-01-19T15:04:55.459043Z", "shell.execute_reply": "2026-01-19T15:04:55.458241Z" } }, "outputs": [], "source": [ "tape = sandy.get_endf6_file(\"jeff_33\", \"decay\", [10010, 10040, 270600, 571380])" ] }, { "cell_type": "markdown", "id": "539ab7f9-96a5-41d7-8f1a-f2da1dfa6f1a", "metadata": {}, "source": [ "Then write the data locally to file." ] }, { "cell_type": "code", "execution_count": 3, "id": "fe661f82-0bad-417b-86f3-c0fae9ae48f5", "metadata": { "execution": { "iopub.execute_input": "2026-01-19T15:04:55.461245Z", "iopub.status.busy": "2026-01-19T15:04:55.461048Z", "iopub.status.idle": "2026-01-19T15:04:55.471086Z", "shell.execute_reply": "2026-01-19T15:04:55.470330Z" } }, "outputs": [], "source": [ "tape.to_file(\"decay_data.jeff33\")" ] }, { "cell_type": "markdown", "id": "b1829be7-3d7c-4e7a-91cd-3d0521de726f", "metadata": {}, "source": [ "To produce 3 random files you can run the following from the command line:" ] }, { "cell_type": "code", "execution_count": 4, "id": "3a895b58-7dff-4bb0-bede-e45aaf135b7f", "metadata": { "execution": { "iopub.execute_input": "2026-01-19T15:04:55.472637Z", "iopub.status.busy": "2026-01-19T15:04:55.472484Z", "iopub.status.idle": "2026-01-19T15:04:56.831348Z", "shell.execute_reply": "2026-01-19T15:04:56.830335Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ ":128: RuntimeWarning: 'sandy.sampling' found in sys.modules after import of package 'sandy', but prior to execution of 'sandy.sampling'; this may result in unpredictable behaviour\r\n", " - Processing file: 'decay_data.jeff33'...\r\n", "########################################################\r\n", " GET PERTURBATIONS \r\n", "########################################################\r\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "########################################################\r\n", " APPLY PERTURBATIONS \r\n", "########################################################\r\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Total running time: 0.19 sec\r\n" ] } ], "source": [ "!python -m sandy.sampling decay_data.jeff33 --samples 3 --processes 1" ] }, { "cell_type": "markdown", "id": "4f91e40d-3b3e-4dd3-8fc0-6aaea7a1387f", "metadata": {}, "source": [ "This is equivalent to using the python interface:" ] }, { "cell_type": "code", "execution_count": 5, "id": "226e9dde-1f17-45f0-8550-a7e2dc36c391", "metadata": { "execution": { "iopub.execute_input": "2026-01-19T15:04:56.833432Z", "iopub.status.busy": "2026-01-19T15:04:56.833253Z", "iopub.status.idle": "2026-01-19T15:04:57.031370Z", "shell.execute_reply": "2026-01-19T15:04:57.030615Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ " - Parsing input file options...\n", "\tdecay_data.jeff33 --samples 3 --processes 1\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ " - Processing file: 'decay_data.jeff33'...\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "########################################################\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ " GET PERTURBATIONS \n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "########################################################\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "########################################################\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ " APPLY PERTURBATIONS \n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "########################################################\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "Total running time: 0.19 sec\n" ] } ], "source": [ "cli = \"decay_data.jeff33 --samples 3 --processes 1\"\n", "sandy.sampling.run(cli.split())" ] }, { "cell_type": "markdown", "id": "33b9d9c1-bd0c-48b7-b230-91b52a7234c2", "metadata": {}, "source": [ "Three perturbed decay data file are created." ] }, { "cell_type": "code", "execution_count": 6, "id": "cc016094-a987-4825-a20e-0ff8e2194b55", "metadata": { "execution": { "iopub.execute_input": "2026-01-19T15:04:57.033048Z", "iopub.status.busy": "2026-01-19T15:04:57.032882Z", "iopub.status.idle": "2026-01-19T15:04:57.038711Z", "shell.execute_reply": "2026-01-19T15:04:57.038134Z" } }, "outputs": [ { "data": { "text/plain": [ "['decay_data_1', 'decay_data_2', 'decay_data_0', 'decay_data.jeff33']" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "glob.glob(\"decay_data*\")" ] }, { "cell_type": "markdown", "id": "af74588e-edea-465f-a9b8-80e861441909", "metadata": {}, "source": [ "## Check outputs" ] }, { "cell_type": "markdown", "id": "a67ec1f8-d666-44a5-9acf-5d9ddca31426", "metadata": {}, "source": [ "You can see that the decay constants, decay energya nd branching ratios of La-138 are perturbed.\n", "\n", "Branching ratios are also normalized to 1, ensuring physical consistency." ] }, { "cell_type": "code", "execution_count": 7, "id": "1f4d66a2-c827-4359-bbc4-72731ab2eae3", "metadata": { "execution": { "iopub.execute_input": "2026-01-19T15:04:57.040297Z", "iopub.status.busy": "2026-01-19T15:04:57.040142Z", "iopub.status.idle": "2026-01-19T15:04:57.047996Z", "shell.execute_reply": "2026-01-19T15:04:57.047333Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 5.713800+4 1.367220+2 0 0 0 51904 8457 1\n", " 3.26930+18 6.31139+16 0 0 6 01904 8457 2\n", " 3.625050+4 9.621470+2 1.221250+6 1.389240+4 0.000000+0 0.000000+01904 8457 3\n", " 5.000000+0 1.000000+0 0 0 12 21904 8457 4\n", " 2.000000+0 0.000000+0 1.740000+6 3.400000+3 6.520000-1 6.000000-31904 8457 5\n", " 1.000000+0 0.000000+0 1.051700+6 4.000000+3 3.480000-1 6.000000-31904 8457 6\n", "\n" ] } ], "source": [ "print(sandy.Endf6.from_file(\"decay_data.jeff33\").data[(1904, 8, 457)][:(66+15)*6])" ] }, { "cell_type": "code", "execution_count": 8, "id": "5565f8c7-ef55-4c1e-a59d-979785759f58", "metadata": { "execution": { "iopub.execute_input": "2026-01-19T15:04:57.049500Z", "iopub.status.busy": "2026-01-19T15:04:57.049340Z", "iopub.status.idle": "2026-01-19T15:04:57.057473Z", "shell.execute_reply": "2026-01-19T15:04:57.056649Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 57138.0000 136.722000 0 0 0 51904 8457 1\n", " 3.10528+18 6.31139+16 0 0 6 01904 8457 2\n", " 36187.7463 962.147000 1266535.50 13892.4000 0.00000000 0.000000001904 8457 3\n", " 5.00000000 1.00000000 0 0 12 21904 8457 4\n", " 2.00000000 0.00000000 1740000.00 3400.00000 6.496113-1 6.000000-31904 8457 5\n", " 1.00000000 0.00000000 1051700.00 4000.00000 3.503887-1 6.000000-31904 8457 6\n", "\n" ] } ], "source": [ "print(sandy.Endf6.from_file(\"decay_data_0\").data[(1904, 8, 457)][:(66+15)*6])" ] }, { "cell_type": "code", "execution_count": 9, "id": "dc904ea8-531b-4b89-b351-e77964499c33", "metadata": { "execution": { "iopub.execute_input": "2026-01-19T15:04:57.058951Z", "iopub.status.busy": "2026-01-19T15:04:57.058799Z", "iopub.status.idle": "2026-01-19T15:04:57.066751Z", "shell.execute_reply": "2026-01-19T15:04:57.065933Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 57138.0000 136.722000 0 0 0 51904 8457 1\n", " 3.27894+18 6.31139+16 0 0 6 01904 8457 2\n", " 36567.8947 962.147000 1234692.34 13892.4000 0.00000000 0.000000001904 8457 3\n", " 5.00000000 1.00000000 0 0 12 21904 8457 4\n", " 2.00000000 0.00000000 1740000.00 3400.00000 6.597479-1 6.000000-31904 8457 5\n", " 1.00000000 0.00000000 1051700.00 4000.00000 3.402521-1 6.000000-31904 8457 6\n", "\n" ] } ], "source": [ "print(sandy.Endf6.from_file(\"decay_data_1\").data[(1904, 8, 457)][:(66+15)*6])" ] }, { "cell_type": "code", "execution_count": 10, "id": "615fba10-5549-482f-837c-5e1aaf11c5d8", "metadata": { "execution": { "iopub.execute_input": "2026-01-19T15:04:57.068253Z", "iopub.status.busy": "2026-01-19T15:04:57.068064Z", "iopub.status.idle": "2026-01-19T15:04:57.076855Z", "shell.execute_reply": "2026-01-19T15:04:57.076113Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 57138.0000 136.722000 0 0 0 51904 8457 1\n", " 3.25798+18 6.31139+16 0 0 6 01904 8457 2\n", " 35866.1521 962.147000 1233368.10 13892.4000 0.00000000 0.000000001904 8457 3\n", " 5.00000000 1.00000000 0 0 12 21904 8457 4\n", " 2.00000000 0.00000000 1740000.00 3400.00000 6.544969-1 6.000000-31904 8457 5\n", " 1.00000000 0.00000000 1051700.00 4000.00000 3.455031-1 6.000000-31904 8457 6\n", "\n" ] } ], "source": [ "print(sandy.Endf6.from_file(\"decay_data_2\").data[(1904, 8, 457)][:(66+15)*6])" ] }, { "cell_type": "markdown", "id": "09d8040e-9672-4483-878a-bf80df471a7f", "metadata": {}, "source": [ "The gamma decay energy of H-4 is also perturbed, despite having zero uncertainty.\n", "\n", "> When decay constants and decay energies are found with zero uncertainty, a default 5% uncertainty is assigned by default. " ] }, { "cell_type": "code", "execution_count": 11, "id": "e912729b-18cc-49d3-8114-96b2e8ab93c9", "metadata": { "execution": { "iopub.execute_input": "2026-01-19T15:04:57.078328Z", "iopub.status.busy": "2026-01-19T15:04:57.078164Z", "iopub.status.idle": "2026-01-19T15:04:57.086511Z", "shell.execute_reply": "2026-01-19T15:04:57.085909Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 1.00400+03 3.99320+00 0 0 0 0 5 8457 1\n", " 1.39000-22 1.00000-23 0 0 6 0 5 8457 2\n", " 0.00000+00 0.00000+00 0.00000+00 0.00000+00 2.87890+06 0.00000+00 5 8457 3\n", "\n" ] } ], "source": [ "print(sandy.Endf6.from_file(\"decay_data.jeff33\").data[(5, 8, 457)][:(66+15)*3])" ] }, { "cell_type": "code", "execution_count": 12, "id": "b34ef81b-ca11-40ab-bc56-6cd46d38a790", "metadata": { "execution": { "iopub.execute_input": "2026-01-19T15:04:57.088220Z", "iopub.status.busy": "2026-01-19T15:04:57.088049Z", "iopub.status.idle": "2026-01-19T15:04:57.096165Z", "shell.execute_reply": "2026-01-19T15:04:57.095332Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 1004.00000 3.99320000 0 0 0 0 5 8457 1\n", " 1.39966-22 1.00000-23 0 0 6 0 5 8457 2\n", " 0.00000000 0.00000000 0.00000000 0.00000000 3093402.32 0.00000000 5 8457 3\n", "\n" ] } ], "source": [ "print(sandy.Endf6.from_file(\"decay_data_2\").data[(5, 8, 457)][:(66+15)*3])" ] } ], "metadata": { "kernelspec": { "display_name": "sandy-devel", "language": "python", "name": "sandy-devel" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.14" } }, "nbformat": 4, "nbformat_minor": 5 }