-
Notifications
You must be signed in to change notification settings - Fork 24
Comparison of FENDL3.2b with FENDL2.0 for select isotopes and reactions. #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
eitan-weinstein
wants to merge
2
commits into
svalinn:main
Choose a base branch
from
eitan-weinstein:fendl2_comp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
src/DataLib/fendl32B_retrofit/fendl2_comparison/Cl35_n2p.gendf
This file contains hidden or 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,6 @@ | ||
| 170350 1110 15 CL 35 (N,2P )P 34 1.0000+00* | ||
| ADL-3 | ||
|
|
||
| 1.03281E-03 5.26950E-04 3.71605E-04 1.99564E-04 3.19898E-05 1.25507E-05 | ||
| 4.54330E-06 1.35669E-06 2.98628E-07 5.23140E-08 3.36895E-08 2.47288E-08 | ||
| 1.44759E-08 2.28141E-09 0.00000E+00 |
33 changes: 33 additions & 0 deletions
33
src/DataLib/fendl32B_retrofit/fendl2_comparison/Co59_nγ.gendf
This file contains hidden or 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,33 @@ | ||
| 270590 1020 175 CO 59 (N,G )CO 60G 5.2000-01* | ||
| JEF-2.2; RN - ---/SYS | ||
|
|
||
| 1.63076E-04 2.31130E-04 2.71898E-04 3.34954E-04 4.37590E-04 4.51067E-04 | ||
| 4.58003E-04 4.63075E-04 4.56085E-04 4.45186E-04 4.21674E-04 3.98038E-04 | ||
| 3.76267E-04 3.51476E-04 3.28715E-04 3.07227E-04 3.02375E-04 3.12399E-04 | ||
| 3.21716E-04 3.30649E-04 3.42755E-04 3.71407E-04 4.01101E-04 4.28384E-04 | ||
| 4.46112E-04 4.59112E-04 4.79606E-04 5.06316E-04 5.37881E-04 5.68598E-04 | ||
| 5.97648E-04 6.31200E-04 6.67432E-04 7.19775E-04 7.97541E-04 8.94342E-04 | ||
| 9.60584E-04 1.00075E-03 1.04540E-03 1.08706E-03 1.12751E-03 1.17258E-03 | ||
| 1.20988E-03 1.24958E-03 1.24928E-03 1.24892E-03 1.29299E-03 1.33154E-03 | ||
| 1.38284E-03 1.44602E-03 1.52306E-03 1.59854E-03 1.66880E-03 1.74906E-03 | ||
| 1.84170E-03 2.00423E-03 2.16553E-03 2.30104E-03 2.54463E-03 2.69107E-03 | ||
| 2.79031E-03 2.86624E-03 2.85928E-03 2.85712E-03 2.86068E-03 2.87141E-03 | ||
| 2.88550E-03 2.90498E-03 2.92539E-03 2.95429E-03 2.98964E-03 3.02512E-03 | ||
| 3.06430E-03 3.11696E-03 3.17252E-03 3.22280E-03 3.32292E-03 3.47153E-03 | ||
| 3.57322E-03 3.66476E-03 3.80511E-03 4.01093E-03 4.13595E-03 4.22771E-03 | ||
| 4.22812E-03 4.22817E-03 4.29732E-03 4.52405E-03 4.71916E-03 4.90325E-03 | ||
| 5.06299E-03 5.21706E-03 5.39983E-03 5.61907E-03 5.83812E-03 6.04587E-03 | ||
| 6.23643E-03 6.40466E-03 6.68857E-03 7.01554E-03 7.32169E-03 7.60731E-03 | ||
| 7.83903E-03 8.11908E-03 7.65394E-03 3.55922E-03 3.93837E-03 5.10375E-03 | ||
| 7.27221E-03 4.34722E-03 4.87460E-03 6.20238E-03 6.55539E-03 8.14067E-03 | ||
| 7.66306E-03 1.40577E-02 1.42404E-02 1.53539E-02 1.75365E-02 2.22528E-02 | ||
| 2.58580E-02 1.04219E-02 1.24465E-02 9.80460E-03 2.13873E-02 1.46298E-02 | ||
| 3.01319E-02 2.76998E-02 2.90135E-02 1.81846E-02 1.33533E-01 1.01621E-01 | ||
| 1.22063E-02 8.14578E-03 1.09470E-01 6.05879E-03 5.10611E-03 4.57373E-03 | ||
| 4.19392E-03 4.02672E-03 1.37380E-02 5.46468E-03 7.63845E-03 1.16694E-02 | ||
| 1.95915E-02 3.67390E-02 7.92566E-02 2.18034E-01 9.87435E-01 5.94245E+01 | ||
| 3.87962E+01 2.25866E+00 1.15954E+00 8.60910E-01 7.50581E-01 7.15737E-01 | ||
| 7.19491E-01 7.49133E-01 7.97837E-01 8.64110E-01 9.46694E-01 1.04561E+00 | ||
| 1.16166E+00 1.29734E+00 1.45376E+00 1.63166E+00 1.83836E+00 2.07119E+00 | ||
| 2.33778E+00 2.64018E+00 2.98592E+00 3.37670E+00 3.82313E+00 7.31035E+00 | ||
| 1.51429E+01 |
10 changes: 10 additions & 0 deletions
10
src/DataLib/fendl32B_retrofit/fendl2_comparison/Cr52_np.gendf
This file contains hidden or 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,10 @@ | ||
| 240520 1030 38 CR 52 (N,P )V 52 1.0000+00* | ||
| ADL-3 | ||
|
|
||
| 3.55336E-02 4.60646E-02 5.05820E-02 5.73165E-02 6.89661E-02 7.27693E-02 | ||
| 7.61699E-02 7.82334E-02 7.98318E-02 8.01979E-02 7.91889E-02 7.79585E-02 | ||
| 7.60540E-02 7.28478E-02 6.91464E-02 6.49399E-02 6.04711E-02 5.55452E-02 | ||
| 5.03544E-02 4.51117E-02 3.96357E-02 3.43672E-02 2.91869E-02 2.38878E-02 | ||
| 2.05388E-02 1.81219E-02 1.43092E-02 9.96998E-03 5.84202E-03 3.17528E-03 | ||
| 1.91064E-03 7.14613E-04 2.35443E-04 1.76958E-04 1.06257E-04 4.22540E-05 | ||
| 2.77957E-06 0.00000E+00 |
10 changes: 10 additions & 0 deletions
10
src/DataLib/fendl32B_retrofit/fendl2_comparison/Fe56_np.gendf
This file contains hidden or 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,10 @@ | ||
| 260560 1030 40 FE 56 (N,P )MN 56 1.0000+00* | ||
| IRDF-90.2 | ||
|
|
||
| 5.78494E-02 7.03885E-02 7.65910E-02 8.54927E-02 1.03113E-01 1.08223E-01 | ||
| 1.11960E-01 1.14978E-01 1.16647E-01 1.16545E-01 1.13628E-01 1.08077E-01 | ||
| 1.00616E-01 8.80111E-02 7.94939E-02 7.13988E-02 6.28621E-02 5.72431E-02 | ||
| 5.24037E-02 4.63660E-02 4.14261E-02 3.64617E-02 3.07969E-02 2.72675E-02 | ||
| 2.46129E-02 2.10466E-02 1.64790E-02 1.11513E-02 6.51717E-03 3.17490E-03 | ||
| 1.45158E-03 6.70422E-04 2.59842E-04 4.66349E-05 3.32348E-06 2.61601E-07 | ||
| 4.09019E-08 1.40521E-08 7.80707E-10 0.00000E+00 |
33 changes: 33 additions & 0 deletions
33
src/DataLib/fendl32B_retrofit/fendl2_comparison/Fe56_nγ.gendf
This file contains hidden or 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,33 @@ | ||
| 260560 1020 175 FE 56 (N,G )FE 57 1.0000+00* | ||
| ENDF/B-VI | ||
|
|
||
| 8.76548E-04 9.42826E-04 9.43460E-04 9.27353E-04 8.52640E-04 8.11233E-04 | ||
| 7.71474E-04 7.29954E-04 6.79017E-04 6.18513E-04 5.27280E-04 4.69594E-04 | ||
| 4.15263E-04 3.66423E-04 3.33569E-04 3.17532E-04 3.07280E-04 3.02602E-04 | ||
| 3.03711E-04 3.12189E-04 3.24104E-04 3.52677E-04 3.82480E-04 4.15537E-04 | ||
| 4.42409E-04 4.62303E-04 4.94060E-04 5.34169E-04 5.79617E-04 6.23899E-04 | ||
| 6.66171E-04 7.17555E-04 7.73582E-04 8.55061E-04 1.08279E-03 1.48067E-03 | ||
| 1.67707E-03 1.78446E-03 1.86724E-03 1.91014E-03 1.94992E-03 1.98364E-03 | ||
| 1.97776E-03 1.95306E-03 1.95306E-03 1.95318E-03 1.92578E-03 1.90138E-03 | ||
| 1.86922E-03 1.85804E-03 1.87279E-03 1.89121E-03 1.90829E-03 1.92398E-03 | ||
| 1.94049E-03 1.99756E-03 2.06470E-03 2.11751E-03 2.20326E-03 2.29312E-03 | ||
| 2.35445E-03 2.50396E-03 2.66421E-03 2.95196E-03 4.15091E-03 6.40762E-03 | ||
| 8.06723E-03 7.86761E-03 6.33147E-03 6.40855E-03 6.95907E-03 5.64672E-03 | ||
| 4.66698E-03 5.31992E-03 4.96726E-03 4.72508E-03 4.94772E-03 4.62660E-03 | ||
| 2.78356E-03 3.28077E-03 6.32910E-03 5.68335E-03 6.42675E-03 8.19770E-03 | ||
| 8.19868E-03 8.19927E-03 5.20492E-03 5.31759E-03 7.50693E-03 7.93214E-03 | ||
| 5.00291E-03 6.69457E-03 5.90659E-03 9.12188E-03 6.01730E-03 6.40112E-03 | ||
| 6.86174E-03 1.61159E-03 1.62127E-03 9.65546E-03 6.57874E-03 1.01663E-02 | ||
| 5.28260E-03 5.40098E-03 1.29063E-02 1.38721E-02 1.29316E-02 2.63523E-02 | ||
| 1.22643E-02 3.10049E-04 8.83635E-03 7.47023E-03 1.31364E-02 4.50177E-03 | ||
| 1.70160E-02 4.63741E-03 1.08067E-02 3.86445E-02 1.25036E-02 7.38670E-03 | ||
| 3.47556E-03 2.32661E-03 1.68903E-02 1.46881E-03 1.03882E-03 6.09449E-04 | ||
| 4.08378E-04 4.45371E-04 5.38778E-04 7.21621E-04 9.98272E-04 1.29924E-03 | ||
| 1.53597E-03 1.75843E-03 2.00783E-03 2.23458E-03 2.38104E-03 5.87520E-03 | ||
| 2.97639E-03 3.71825E-03 5.51045E-03 5.37213E-01 8.41383E-03 1.04065E-02 | ||
| 1.28738E-02 1.57881E-02 1.87296E-02 2.22233E-02 2.61702E-02 3.05153E-02 | ||
| 3.53642E-02 4.08925E-02 4.69606E-02 5.38176E-02 6.16419E-02 7.02361E-02 | ||
| 7.99753E-02 9.11971E-02 1.03476E-01 1.17654E-01 1.33675E-01 1.51559E-01 | ||
| 1.72149E-01 1.95195E-01 2.21348E-01 2.51086E-01 2.84445E-01 3.22476E-01 | ||
| 3.65949E-01 4.13976E-01 4.69906E-01 5.32638E-01 6.03391E-01 1.15878E+00 | ||
| 2.40364E+00 |
6 changes: 6 additions & 0 deletions
6
src/DataLib/fendl32B_retrofit/fendl2_comparison/Ni58_n2n.gendf
This file contains hidden or 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,6 @@ | ||
| 280580 160 13 NI 58 (N,2N )NI 57 1.0000+00* | ||
| IRDF-90.2 | ||
|
|
||
| 7.56467E-02 6.69681E-02 6.45875E-02 5.84855E-02 4.31294E-02 3.68879E-02 | ||
| 3.03852E-02 2.32825E-02 1.65977E-02 1.01586E-02 2.69195E-03 1.47943E-04 | ||
| 0.00000E+00 |
Binary file added
BIN
+82 KB
src/DataLib/fendl32B_retrofit/fendl2_comparison/fendl_comp_for_Cl-35_(n,2p).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+119 KB
src/DataLib/fendl32B_retrofit/fendl2_comparison/fendl_comp_for_Co-59_(n,γ).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+83.1 KB
src/DataLib/fendl32B_retrofit/fendl2_comparison/fendl_comp_for_Cr-52_(n,p).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+89 KB
src/DataLib/fendl32B_retrofit/fendl2_comparison/fendl_comp_for_Fe-56_(n,p).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+121 KB
src/DataLib/fendl32B_retrofit/fendl2_comparison/fendl_comp_for_Fe-56_(n,γ).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+78.8 KB
src/DataLib/fendl32B_retrofit/fendl2_comparison/fendl_comp_for_Ni-58_(n,2n).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
289 changes: 289 additions & 0 deletions
289
src/DataLib/fendl32B_retrofit/fendl2_comparison/fendl_comparison.py
This file contains hidden or 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,289 @@ | ||
| # Import packages | ||
| import argparse | ||
| import matplotlib.pyplot as plt | ||
| import numpy as np | ||
| from pandas import read_csv | ||
| from ast import literal_eval | ||
| from pathlib import Path | ||
| import sys | ||
| sys.path.append('../groupr_tools.py') | ||
| from groupr_tools import elements | ||
|
|
||
| vitamin_J = np.array([ | ||
| 0.00001000, 0.10000000, 0.41399000, 0.53158000, 0.68256000, 0.87642000, | ||
| 1.12540000, 1.44500000, 1.85540000, 2.38240000, 3.05900000, 3.92790000, | ||
| 5.04350000, 6.47600000, 8.31530000, 10.6770000, 13.7100000, 17.6030000, | ||
| 22.6030000, 29.0230000, 37.2670000, 47.8510000, 61.4420000, 78.8930000, | ||
| 101.300000, 130.070000, 167.020000, 214.450000, 275.360000, 353.580000, | ||
| 454.000000, 582.950000, 748.520000, 961.120000, 1234.10000, 1584.60000, | ||
| 2034.70000, 2248.70000, 2485.20000, 2612.60000, 2746.50000, 3035.40000, | ||
| 3354.60000, 3707.40000, 4307.40000, 5530.80000, 7101.70000, 9118.80000, | ||
| 10595.0000, 11709.0000, 15034.0000, 19305.0000, 21875.0000, 23579.0000, | ||
| 24176.0000, 24788.0000, 26058.0000, 27000.0000, 28500.0000, 31828.0000, | ||
| 34307.0000, 40868.0000, 46309.0000, 52475.0000, 56562.0000, 67379.0000, | ||
| 72000.0000, 79500.0000, 82500.0000, 86517.0000, 98037.0000, 111090.000, | ||
| 116790.000, 122770.000, 129070.000, 135690.000, 142640.000, 149960.000, | ||
| 157640.000, 165730.000, 174220.000, 183160.000, 192550.000, 202420.000, | ||
| 212800.000, 223710.000, 235180.000, 247240.000, 273240.000, 287250.000, | ||
| 294520.000, 297200.000, 298500.000, 301970.000, 333730.000, 368830.000, | ||
| 387740.000, 407620.000, 450490.000, 497870.000, 523400.000, 550230.000, | ||
| 578440.000, 608100.000, 639280.000, 672060.000, 706510.000, 742740.000, | ||
| 780820.000, 820850.000, 862940.000, 907180.000, 961640.000, 1002600.00, | ||
| 1108000.00, 1164800.00, 1224600.00, 1287300.00, 1353400.00, 1422700.00, | ||
| 1495700.00, 1572400.00, 1653000.00, 1737700.00, 1826800.00, 1920500.00, | ||
| 2019000.00, 2122500.00, 2231300.00, 2306900.00, 2345700.00, 2365300.00, | ||
| 2385200.00, 2466000.00, 2592400.00, 2725300.00, 2865000.00, 3011900.00, | ||
| 3166400.00, 3328700.00, 3678800.00, 4065700.00, 4493300.00, 4723700.00, | ||
| 4965900.00, 5220500.00, 5488100.00, 5769500.00, 6065300.00, 6376300.00, | ||
| 6592400.00, 6703200.00, 7046900.00, 7408200.00, 7788000.00, 8187300.00, | ||
| 8607100.00, 9048400.00, 9512300.00, 10000000.0, 10513000.0, 11052000.0, | ||
| 11618000.0, 12214000.0, 12523000.0, 12840000.0, 13499000.0, 13840000.0, | ||
| 14191000.0, 14550000.0, 14918000.0, 15683000.0, 16487000.0, 16905000.0, | ||
| 17333000.0, 19640000.0 | ||
| ][::-1]) / 1e6 | ||
|
|
||
| def args(): | ||
| """" | ||
| Configure argparser for the FENDL3.2b/FENDL2.0 comparison script. | ||
|
|
||
| Arguments: | ||
| None | ||
|
|
||
| Returns: | ||
| argparse.Namespace: Argparse object that contains the user specified | ||
| arguments for executing the script. | ||
| """ | ||
|
|
||
| parser = argparse.ArgumentParser() | ||
|
|
||
| parser.add_argument( | ||
| '--element', '-e', required=True, nargs='?', | ||
| help='''Chemical symbol for the selected element to analyze.''' | ||
| ) | ||
| parser.add_argument( | ||
| '--mass_number', '-a', required=True, nargs='?', | ||
| help = '''Mass number for the selected isotope. If the target is an | ||
| isomer, type "m" after the mass number in the same string.''' | ||
| ) | ||
| parser.add_argument( | ||
| '--emitted_particles', '-p', required=True, nargs='?', | ||
| help='''String of the emission from the target reaction. | ||
| For example, for an (n,γ) reaction, type "gamma".''' | ||
| ) | ||
|
|
||
| return parser.parse_args() | ||
|
|
||
| def prepend_with_zeros(cross_sections): | ||
| """ | ||
| Include zeroes into the beginning of a list such that the total length of | ||
| of the list is 175, corresponding to the Vitamin-J group structure. | ||
|
|
||
| Arguments: | ||
| cross_sections (list): List of cross sections, of length less than or | ||
| equal to 175. | ||
|
|
||
| Returns: | ||
| cross_sections (list): Potentially modified list of cross sections, with | ||
| zeroes prepended to bring the length of the list to 175. | ||
| """ | ||
|
|
||
| current_length = len(cross_sections) | ||
| zeros_needed = 175 - current_length | ||
| cross_sections = [0] * zeros_needed + cross_sections | ||
|
|
||
| return cross_sections | ||
|
|
||
|
|
||
| def fendl3_cross_sections(gendf_data_csv, element, A, emitted_particles): | ||
| """ | ||
| Extracts the cross section data for a specific isotope and activation | ||
| reaction for FENDL3.2b activation data that was converted to a | ||
| Vitamin-J groupwise structure with a Vitamin-E weight function using the | ||
| NJOY GROUPR module. | ||
|
|
||
| Arguments: | ||
| gendf_data_csv (str): Path to a CSV containing the extracted cross | ||
| section data from a GENDF file produced by processing a TENDL 2017 | ||
| file with GROUPR. | ||
| element (str): Chemical symbol for the selected element. | ||
| A (str or int): Mass number for the selected isotope/isomer. | ||
| emitted_particles (str): Particle product(s) of a neutron activation, | ||
| written together in a single string. | ||
|
|
||
| Returns: | ||
| cross_sections (numpy.array): Array containing cross section values for | ||
| the 175 Vitamin-J energy groups. | ||
| """ | ||
|
|
||
| fendl3_df = read_csv(gendf_data_csv) | ||
|
|
||
| Z = elements[element] | ||
| M = 1 if 'm' in str(A).lower() else 0 | ||
| A = int(str(A).lower().split(' ')[0].split('m')[0]) | ||
| pkZA = (Z * 1000 + A) * 10 + M | ||
|
|
||
| single_isotope_data = fendl3_df[fendl3_df['Parent KZA'] == pkZA] | ||
| single_isotope_reaction = single_isotope_data[ | ||
| single_isotope_data['Emitted Particles'] == emitted_particles | ||
| ] | ||
| cross_sections = prepend_with_zeros(list( | ||
| single_isotope_reaction['Cross Sections'].apply(literal_eval) | ||
| )[0]) | ||
|
|
||
| return np.array(cross_sections) | ||
|
|
||
| def fendl2_cross_sections(element, A, emitted_particles, dir = '.'): | ||
| """ | ||
| Extracts the cross section data for a specific isotope and activation | ||
| reaction for groupwise FENDL2.0 activation data in a GENDF file. | ||
|
|
||
| Arguments: | ||
| element (str): Chemical symbol for the selected element. | ||
| A (str or int): Mass number for the selected isotope/isomer. | ||
| dir (str, optional): Path to the directory containing the GENDF file. | ||
| Defaults to the present working directory ('.'). | ||
|
|
||
| Returns: | ||
| cross_sections (numpy.array): Array containing cross section values for | ||
| the 175 Vitamin-J energy groups. | ||
| """ | ||
|
|
||
| dir = Path(dir) | ||
| gendf_data = list(dir.glob(f'*{element}*{A}*{emitted_particles}.gendf'))[0] | ||
|
|
||
| with open(gendf_data, 'r') as f: | ||
| gendf = f.read() | ||
| gendf_lines = gendf.split('\n')[3:] | ||
|
|
||
| cross_sections = [] | ||
| for line in gendf_lines: | ||
| values = line.split(' ') | ||
| for value in values: | ||
| if value: | ||
| cross_sections.append(float(value)) | ||
|
|
||
| return np.array(prepend_with_zeros(cross_sections)) | ||
|
|
||
| def replace_with_greek(emitted_particles): | ||
| """ | ||
| Replaces Anglicized Greek letters to the Greek alphabet. | ||
|
|
||
| Arguments: | ||
| emitted_particles (str): String of particle names which may or may not | ||
| contain Greek letters written out in English. | ||
|
|
||
| Returns: | ||
| emitted_particles (str): String of particle names wherein any particles | ||
| that contain a Greek letter are written in Greek. | ||
| """ | ||
|
|
||
| greek_dict = {'gamma': 'γ', 'alpha': 'α'} | ||
|
|
||
| for eng, grk in greek_dict.items(): | ||
| emitted_particles = emitted_particles.replace(eng, grk) | ||
|
|
||
| return emitted_particles | ||
|
|
||
| def calculate_stats(array1, array2): | ||
| """ | ||
| Calculate the mean and maximum percent differences of two numpy arrays. | ||
|
|
||
| Arguments: | ||
| array1 (numpy.array): A numpy array containing the cross section data | ||
| from one FENDL version. | ||
| array2 (numpy.array): A numpy array containing the cross section data | ||
| from a different FENDL version. | ||
|
|
||
| Returns: | ||
| mean_percent_diff (float): The calculated mean percent difference | ||
| between the two arrays. | ||
| max_percent_diff (float): The calculated maximum percent difference | ||
| between the two arrays. | ||
| """ | ||
|
|
||
| percent_diffs = np.array([ | ||
| (array1[i] - array2[i]) / array1[i] * 100 if array1[i] != 0 else 0.0 | ||
| for i in range(len(array1)) | ||
| ]) | ||
|
|
||
| mean_percent_diff = np.mean(np.abs(percent_diffs)) | ||
| max_percent_diff = np.max(np.abs(percent_diffs)) | ||
|
|
||
| return mean_percent_diff, max_percent_diff | ||
|
|
||
| def comp_plot(f2, f3, emitted_particles, mean_percent_diff, max_percent_diff): | ||
| """ | ||
| Create a comparative plot for the cross section data from FENDL3.2b and | ||
| FENDL2.0 for a specific isotope. | ||
|
|
||
| Arguments: | ||
| f2 (numpy.array): A numpy array containing the cross section data | ||
| from FENDL2.0. | ||
| f3 (numpy.array): A numpy array containing the cross section data | ||
| from FENDL3.2b. | ||
| emitted_particles (str): Particle product(s) of a neutron activation, | ||
| written together in a single string. | ||
| mean_percent_diff (float): The calculated mean percent difference | ||
| between the two arrays. | ||
| max_percent_diff (float): The calculated maximum percent difference | ||
| between the two arrays. | ||
|
|
||
| Returns: | ||
| None | ||
| """ | ||
|
|
||
| groups = range(175) | ||
| plt.figure(figsize=(15,8)) | ||
| plt.plot(groups, f3, label='GROUPR-processed FENDL3.2b', | ||
| alpha=0.5, color='b') | ||
| plt.plot(groups, f2, label='FENDL2.0', alpha=0.5, color = 'r') | ||
| plt.xlabel('Energy (MeV)', fontsize='medium') | ||
| plt.ylabel('Cross Section (b)', fontsize='medium') | ||
| plt.title( | ||
| ('Comparison of FENDL3.2b GROUPR-processed cross sections with ' | ||
| f'FENDL2.0 data \n for the {args().element}-{args().mass_number} ' | ||
| f'(n,{emitted_particles}) reaction with the 175 group Vitamin-J ' | ||
| 'structure \n and the Vitamin-E micro-flux weighting function'), | ||
| fontsize='x-large' | ||
| ) | ||
| plt.yscale('log') | ||
| xtick_indices = [0, 20, 40, 60, 80, 100, 120, 140, 160, 174] | ||
| xtick_labels = [f'{vitamin_J[i]:.2e}' for i in xtick_indices] | ||
| plt.xticks(xtick_indices, xtick_labels, rotation=45) | ||
| plt.gca().invert_xaxis() | ||
| plt.legend( | ||
| title=( | ||
| f'Mean percent difference: {mean_percent_diff:.2f}% \n' | ||
| f'Max percent difference: {max_percent_diff:.2f}%' | ||
| ), | ||
| fontsize='medium', | ||
| title_fontsize='medium', | ||
| ) | ||
| plt.grid() | ||
| plt.savefig( | ||
| ( | ||
| f'fendl_comp_for_{args().element}-{args().mass_number}_' | ||
| f'(n,{emitted_particles}).png') | ||
| ) | ||
|
|
||
| ############################################################################## | ||
|
|
||
| def fendl_comparison(): | ||
| """ | ||
| Main method when run as a command line script. | ||
| """ | ||
|
|
||
| emitted_particles = replace_with_greek(args().emitted_particles) | ||
| f2 = fendl2_cross_sections(args().element, args().mass_number, | ||
| emitted_particles) | ||
| f3 = fendl3_cross_sections('../cumulative_gendf_data.csv', | ||
| args().element, args().mass_number, | ||
| emitted_particles) | ||
|
|
||
| mean_percent_diff, max_percent_diff = calculate_stats(f2,f3) | ||
| comp_plot(f2, f3, emitted_particles, mean_percent_diff, max_percent_diff) | ||
|
|
||
| ############################################################################## | ||
|
|
||
| if __name__ == '__main__': | ||
| fendl_comparison() | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should append: