Skip to content

Commit

Permalink
Merge pull request pyne#1333 from gonuke/fix_KAERI_parsing
Browse files Browse the repository at this point in the history
Fixes for nuc_data_make to work from scratch
  • Loading branch information
ahnaf-tahmid-chowdhury authored Feb 20, 2024
2 parents 2e7e4eb + e245a1d commit f06cfe7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Next Version

**Fix**
* Fix Type Mismatch Error in PyNE's ENSDF Processing Module (#1519)
* Fixes for nuc_data_make (#1333)
* new download location for KAERI data archive
* do not try to download missing (super heavy) data from KAERI
* update material_library writing interface

v0.7.8
======
Expand Down Expand Up @@ -160,7 +164,7 @@ v0.7.1
======

**New Capabilities**
* Adding unordered_map like API to MaterialLibrary pointing directly to the nested unordered_map
* Adding unordered_map like API to MaterialLibrary pointing directly to the nested unordered_map (#1330)

**Maintenance**

Expand Down
2 changes: 1 addition & 1 deletion pyne/dbgen/materials_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def parse_materials(mats, lines):
# Writes to file
def make_materials_compendium(nuc_data, matslib):
"""Adds materials compendium to nuc_data.h5."""
matslib.write_hdf5(nuc_data)
matslib.write_hdf5(nuc_data, datapath="/material_library/materials")


def make_matslib(fname):
Expand Down
37 changes: 18 additions & 19 deletions pyne/dbgen/simple_xs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ def grab_kaeri_simple_xs(build_dir=""):
build_dir : str
Major directory to place html files in. 'KAERI/' will be appended.
"""
zip_path = os.path.join(build_dir, "kaeri.zip")
zip_url = "http://data.pyne.io/kaeri.zip"
zip_path = os.path.join(build_dir, 'kaeri.zip')
zip_url = 'https://raw.githubusercontent.com/pyne/data/master/kaeri.zip'
if not os.path.exists(zip_path):
print(" grabbing {0} and placing it in {1}".format(zip_url, zip_path))
urllib.urlretrieve(zip_url, zip_path)
try:
zf = ZipFile(zip_path)
for name in zf.namelist():
if not os.path.exists(os.path.join(build_dir, name)):
print(" extracting {0} from {1}".format(name, zip_path))
zf.extract(name, build_dir)
finally:
zf.close()
try:
zf = ZipFile(zip_path)
for name in zf.namelist():
if not os.path.exists(os.path.join(build_dir, name)):
print(" extracting {0} from {1}".format(name, zip_path))
zf.extract(name, build_dir)
finally:
zf.close()

# Add kaeri to build_dir
build_dir = os.path.join(build_dir, "KAERI")
Expand All @@ -55,11 +55,9 @@ def grab_kaeri_simple_xs(build_dir=""):
all_nuclides = set()
for element in nucname.name_zz.keys():
htmlfile = element.upper() + ".html"
if htmlfile not in already_grabbed:
grab_kaeri_nuclide(element.upper(), build_dir)
all_nuclides = all_nuclides | parse_for_all_isotopes(
os.path.join(build_dir, htmlfile)
)
if htmlfile in already_grabbed:
all_nuclides = all_nuclides | parse_for_all_isotopes(os.path.join(build_dir,
htmlfile))

# Grab nuclide XS summary files
for nuc in sorted(all_nuclides):
Expand Down Expand Up @@ -165,10 +163,11 @@ def parse_simple_xs(build_dir=""):
# Grab and parse elemental summary files.
all_nuclides = set()
for element in nucname.name_zz.keys():
htmlfile = element.upper() + ".html"
all_nuclides = all_nuclides | parse_for_all_isotopes(
os.path.join(build_dir, htmlfile)
)
htmlfile = element.upper() + '.html'
# missing data for newer super-heavy elements
if os.path.exists(os.path.join(build_dir,htmlfile)):
all_nuclides = all_nuclides | parse_for_all_isotopes(os.path.join(build_dir,
htmlfile))
all_nuclides = sorted([nucname.id(nuc) for nuc in all_nuclides])
energy_tables = dict(
[
Expand Down

0 comments on commit f06cfe7

Please sign in to comment.