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 4ff69b1..226f21f 100644 --- a/convert.py +++ b/convert.py @@ -1,5 +1,3 @@ - - import pandas as pd import json import os @@ -9,22 +7,34 @@ 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, ) +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) h5File = "all_indexes.h5" df.to_hdf(h5File, "/data/d1") -os.system('rm -rf TENDL-2019') +os.system("rm -rf TENDL-2019") +os.system("rm -rf ENDFB-8.0-NNDC") diff --git a/download.py b/download.py index a4bc419..70e1d8b 100644 --- a/download.py +++ b/download.py @@ -1,11 +1,19 @@ - +import openmc import openmc_data_downloader as odd -odd.just_in_time_library_generator( - 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", ) +mats.download_cross_section_data( + libraries=["TENDL-2019"], + destination="TENDL-2019" +)