-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update * update --------- Co-authored-by: Luca Fiorito <[email protected]>
- Loading branch information
1 parent
bfa5a0a
commit 8d232b0
Showing
4 changed files
with
258 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "2255de27-2a19-4cf9-9c26-122962881e06", | ||
"metadata": {}, | ||
"source": [ | ||
"# Testing sampling of MF35 for U235" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a56e847e-3d93-446a-ac9a-e05cd7ff894f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import matplotlib.pyplot as plt\n", | ||
"import seaborn as sns\n", | ||
"import pandas as pd\n", | ||
"import sandy" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "8a51b18d-3d10-435d-b737-14a8f8f3ad00", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"endf6 = sandy.get_endf6_file(\"jeff_33\", \"xs\", 922350)\n", | ||
"endf6.to_file(\"U235.jeff33\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a0477c60-8ed7-40f2-a0f9-b14ba763bc3d", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"sandy.sampling.run(\"U235.jeff33 --mf 35 --samples 2 --seed35 5 --loglevel error\".split())" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "1df9b6b3-6725-4a43-8f0d-647c9830b38c", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"smp = sandy.Samples.from_excel(\"PERT_92235_MF35.xlsx\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "1469dadc-3ec4-4aab-a4cf-e17a45c9c62f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Extract energy distributions from original and perturbed files\n", | ||
"edistr = sandy.Edistr.from_endf6(endf6)\n", | ||
"edistr0 = sandy.Edistr.from_endf6(sandy.Endf6.from_file(\"92235_0.endf6\"))\n", | ||
"edistr1 = sandy.Edistr.from_endf6(sandy.Endf6.from_file(\"92235_1.endf6\"))\n", | ||
"\n", | ||
"# Calculate ratios, this should be compared to the random samples\n", | ||
"edistr.data[\"RATIO0\"] = edistr0.data.VALUE / edistr.data.VALUE\n", | ||
"edistr.data[\"RATIO1\"] = edistr1.data.VALUE / edistr.data.VALUE" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e6b533bf-1d3a-41fb-8095-02271774a21d", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"fig, ax = plt.subplots()\n", | ||
"\n", | ||
"sns.lineplot(data=edistr.data, x=\"EOUT\", y=\"RATIO0\", errorbar=\"sd\", ax=ax, color=\"dodgerblue\")\n", | ||
"smp.get_eright()[0].reset_index().plot(x=\"ERIGHT\", y=0, drawstyle=\"steps-pre\", ax=ax, color=\"blue\", ls=\"--\", lw=.8)\n", | ||
"\n", | ||
"sns.lineplot(data=edistr.data, x=\"EOUT\", y=\"RATIO1\", errorbar=\"sd\", ax=ax, color=\"tomato\")\n", | ||
"smp.get_eright()[1].reset_index().plot(x=\"ERIGHT\", y=1, drawstyle=\"steps-pre\", ax=ax, color=\"red\", ls=\"--\", lw=.8)\n", | ||
"\n", | ||
"ax.set(xlim=[0,3e7], ylabel='relative perturbation', xlabel='energy / $eV$', title=\"Compare perturbed ENDF-6 files with random samples \")\n", | ||
"ax.legend(title=\"SAMPLE\")\n", | ||
"fig.tight_layout()" | ||
] | ||
} | ||
], | ||
"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.12.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters