From 209baf6c36f53a7c86f3440f18e66d2e90225675 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Mon, 26 Jun 2023 14:03:13 +0100 Subject: [PATCH 1/2] added endf 8 --- convert.py | 18 +++++++++++++++--- download.py | 8 ++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/convert.py b/convert.py index 4ff69b1..87301c0 100644 --- a/convert.py +++ b/convert.py @@ -15,12 +15,23 @@ index_filename='TENDL-2019_index.json', indent=None ) +odj.cross_section_h5_files_to_json_files( + filenames = list(pathlib.Path('ENDFB-8.0-NNDC').glob('*.h5')), + output_dir = 'ENDFB-8.0-NNDC_json', + library='ENDFB-8.0-NNDC', + index_filename='ENDFB-8.0-NNDC_index.json', + indent=None +) +with open('TENDL-2019_json/TENDL-2019_index.json') as f: + data_tendl_2019 = json.load(f) -f = open('TENDL-2019_json/TENDL-2019_index.json') -data = json.load(f) -df = pd.json_normalize(data) +with open('ENDFB-8.0-NNDC_json/ENDFB-8.0-NNDC_index.json') as f: + data_endf_8_nndc = json.load(f) + +data = data_tendl_2019 + data_endf_8_nndc +df = pd.json_normalize(data) for col in df.columns: df[col] = df[col].astype(str) @@ -28,3 +39,4 @@ df.to_hdf(h5File, "/data/d1") os.system('rm -rf TENDL-2019') +os.system('rm -rf ENDFB-8.0-NNDC') diff --git a/download.py b/download.py index a4bc419..6295d40 100644 --- a/download.py +++ b/download.py @@ -2,10 +2,14 @@ import openmc_data_downloader as odd -odd.just_in_time_library_generator( +odd.download_cross_section_data( libraries='TENDL-2019', elements='all', destination='TENDL-2019' ) - +odd.download_cross_section_data( + libraries='ENDFB-8.0-NNDC', + elements='all', + destination='ENDFB-8.0-NNDC', +) From d85eb1c2d3e47f12cc7d330b8ea215b3d46b5b96 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Mon, 26 Jun 2023 14:29:47 +0100 Subject: [PATCH 2/2] adding endf --- Dockerfile | 4 ++-- convert.py | 30 ++++++++++++++---------------- download.py | 22 +++++++++++++--------- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/Dockerfile b/Dockerfile index 60b94e8..a3f95de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,10 +12,10 @@ FROM continuumio/miniconda3:4.9.2 as h5_base RUN conda install -c conda-forge openmc -RUN pip install openmc_data_downloader>=0.5.4 - RUN pip install openmc_data_to_json +RUN pip install openmc_data_downloader + # needed for hdf5 writting of the index file RUN pip install tables diff --git a/convert.py b/convert.py index 87301c0..226f21f 100644 --- a/convert.py +++ b/convert.py @@ -1,5 +1,3 @@ - - import pandas as pd import json import os @@ -9,24 +7,24 @@ odj.cross_section_h5_files_to_json_files( - filenames = list(pathlib.Path('TENDL-2019').glob('*.h5')), - output_dir = 'TENDL-2019_json', - library='TENDL-2019', - index_filename='TENDL-2019_index.json', - indent=None + filenames=list(pathlib.Path("TENDL-2019").glob("*.h5")), + output_dir="TENDL-2019_json", + library="TENDL-2019", + index_filename="TENDL-2019_index.json", + indent=None, ) odj.cross_section_h5_files_to_json_files( - filenames = list(pathlib.Path('ENDFB-8.0-NNDC').glob('*.h5')), - output_dir = 'ENDFB-8.0-NNDC_json', - library='ENDFB-8.0-NNDC', - index_filename='ENDFB-8.0-NNDC_index.json', - indent=None + filenames=list(pathlib.Path("ENDFB-8.0-NNDC").glob("*.h5")), + output_dir="ENDFB-8.0-NNDC_json", + library="ENDFB-8.0-NNDC", + index_filename="ENDFB-8.0-NNDC_index.json", + indent=None, ) -with open('TENDL-2019_json/TENDL-2019_index.json') as f: +with open("TENDL-2019_json/TENDL-2019_index.json") as f: data_tendl_2019 = json.load(f) -with open('ENDFB-8.0-NNDC_json/ENDFB-8.0-NNDC_index.json') as f: +with open("ENDFB-8.0-NNDC_json/ENDFB-8.0-NNDC_index.json") as f: data_endf_8_nndc = json.load(f) data = data_tendl_2019 + data_endf_8_nndc @@ -38,5 +36,5 @@ h5File = "all_indexes.h5" df.to_hdf(h5File, "/data/d1") -os.system('rm -rf TENDL-2019') -os.system('rm -rf ENDFB-8.0-NNDC') +os.system("rm -rf TENDL-2019") +os.system("rm -rf ENDFB-8.0-NNDC") diff --git a/download.py b/download.py index 6295d40..70e1d8b 100644 --- a/download.py +++ b/download.py @@ -1,15 +1,19 @@ - +import openmc import openmc_data_downloader as odd -odd.download_cross_section_data( - libraries='TENDL-2019', - elements='all', - destination='TENDL-2019' +mat = openmc.Material() +for isotope in odd.ALL_ISOTOPE_OPTIONS: + mat.add_nuclide(isotope, 1) +mats = openmc.Materials([mat]) + +mats.download_cross_section_data( + libraries=["ENDFB-8.0-NNDC"], + destination="ENDFB-8.0-NNDC", ) -odd.download_cross_section_data( - libraries='ENDFB-8.0-NNDC', - elements='all', - destination='ENDFB-8.0-NNDC', +mats.download_cross_section_data( + libraries=["TENDL-2019"], + destination="TENDL-2019" ) +