{ "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": "2024-09-27T09:42:38.438922Z", "iopub.status.busy": "2024-09-27T09:42:38.438759Z", "iopub.status.idle": "2024-09-27T09:42:38.945894Z", "shell.execute_reply": "2024-09-27T09:42:38.945315Z" } }, "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": "2024-09-27T09:42:38.947946Z", "iopub.status.busy": "2024-09-27T09:42:38.947717Z", "iopub.status.idle": "2024-09-27T09:42:41.400826Z", "shell.execute_reply": "2024-09-27T09:42:41.400275Z" } }, "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": "2024-09-27T09:42:41.402746Z", "iopub.status.busy": "2024-09-27T09:42:41.402571Z", "iopub.status.idle": "2024-09-27T09:42:41.411933Z", "shell.execute_reply": "2024-09-27T09:42:41.411491Z" } }, "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": "2024-09-27T09:42:41.413542Z", "iopub.status.busy": "2024-09-27T09:42:41.413359Z", "iopub.status.idle": "2024-09-27T09:42:42.529415Z", "shell.execute_reply": "2024-09-27T09:42:42.528752Z" } }, "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" ] }, { "name": "stdout", "output_type": "stream", "text": [ "INFO: processing file: 'decay_data.jeff33'\r\n", "INFO: writing to file 'PERT_MF8_MT457.xlsx'...\r\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "INFO: Total running time: 0.30 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": "2024-09-27T09:42:42.531778Z", "iopub.status.busy": "2024-09-27T09:42:42.531365Z", "iopub.status.idle": "2024-09-27T09:42:42.856234Z", "shell.execute_reply": "2024-09-27T09:42:42.855706Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO: processing file: 'decay_data.jeff33'\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "INFO: writing to file 'PERT_MF8_MT457.xlsx'...\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "INFO: Total running time: 0.32 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": "2024-09-27T09:42:42.858056Z", "iopub.status.busy": "2024-09-27T09:42:42.857778Z", "iopub.status.idle": "2024-09-27T09:42:42.863892Z", "shell.execute_reply": "2024-09-27T09:42:42.863404Z" } }, "outputs": [ { "data": { "text/plain": [ "['decay_data_0', 'decay_data_2', 'decay_data_1', '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": "2024-09-27T09:42:42.865760Z", "iopub.status.busy": "2024-09-27T09:42:42.865360Z", "iopub.status.idle": "2024-09-27T09:42:42.873570Z", "shell.execute_reply": "2024-09-27T09:42:42.873130Z" } }, "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": "2024-09-27T09:42:42.875347Z", "iopub.status.busy": "2024-09-27T09:42:42.875013Z", "iopub.status.idle": "2024-09-27T09:42:42.882979Z", "shell.execute_reply": "2024-09-27T09:42:42.882551Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 57138.0000 136.722000 0 0 0 51904 8457 1\n", " 3.27506+18 6.31139+16 0 0 6 01904 8457 2\n", " 38183.6677 962.147000 1210807.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.547640-1 6.000000-31904 8457 5\n", " 1.00000000 0.00000000 1051700.00 4000.00000 3.452360-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": "2024-09-27T09:42:42.884656Z", "iopub.status.busy": "2024-09-27T09:42:42.884308Z", "iopub.status.idle": "2024-09-27T09:42:42.892348Z", "shell.execute_reply": "2024-09-27T09:42:42.891913Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 57138.0000 136.722000 0 0 0 51904 8457 1\n", " 3.29189+18 6.31139+16 0 0 6 01904 8457 2\n", " 36356.5545 962.147000 1216139.00 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.441183-1 6.000000-31904 8457 5\n", " 1.00000000 0.00000000 1051700.00 4000.00000 3.558817-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": "2024-09-27T09:42:42.893997Z", "iopub.status.busy": "2024-09-27T09:42:42.893667Z", "iopub.status.idle": "2024-09-27T09:42:42.901774Z", "shell.execute_reply": "2024-09-27T09:42:42.901316Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 57138.0000 136.722000 0 0 0 51904 8457 1\n", " 3.30311+18 6.31139+16 0 0 6 01904 8457 2\n", " 37929.3494 962.147000 1204430.64 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.522910-1 6.000000-31904 8457 5\n", " 1.00000000 0.00000000 1051700.00 4000.00000 3.477090-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": "2024-09-27T09:42:42.903362Z", "iopub.status.busy": "2024-09-27T09:42:42.903196Z", "iopub.status.idle": "2024-09-27T09:42:42.911056Z", "shell.execute_reply": "2024-09-27T09:42:42.910626Z" } }, "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": "2024-09-27T09:42:42.912603Z", "iopub.status.busy": "2024-09-27T09:42:42.912420Z", "iopub.status.idle": "2024-09-27T09:42:42.920394Z", "shell.execute_reply": "2024-09-27T09:42:42.919946Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 1004.00000 3.99320000 0 0 0 0 5 8457 1\n", " 1.17822-22 1.00000-23 0 0 6 0 5 8457 2\n", " 0.00000000 0.00000000 0.00000000 0.00000000 2851686.17 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.10" } }, "nbformat": 4, "nbformat_minor": 5 }