Move fission Q file to openmc/data and make sure it's accessible from

openmc-get-nndc-data
This commit is contained in:
Paul Romano 2016-10-13 07:09:50 -05:00
parent 7e2d171803
commit 5ab6160c2a
3 changed files with 17 additions and 21 deletions

View file

@ -13,6 +13,8 @@ import argparse
from six.moves import input
from six.moves.urllib.request import urlopen
import openmc.data
description = """
Download ENDF/B-VII.1 ACE data from NNDC and convert it to an HDF5 library for
@ -20,6 +22,7 @@ use with OpenMC.
"""
class CustomFormatter(argparse.ArgumentDefaultsHelpFormatter,
argparse.RawDescriptionHelpFormatter):
pass
@ -75,7 +78,8 @@ for f in files:
if not chunk: break
fh.write(chunk)
downloaded += len(chunk)
status = '{0:10} [{1:3.2f}%]'.format(downloaded, downloaded * 100. / file_size)
status = '{0:10} [{1:3.2f}%]'.format(
downloaded, downloaded * 100. / file_size)
print(status + chr(8)*len(status), end='')
print('')
filesComplete.append(f)
@ -109,7 +113,7 @@ for f in files:
for filename in glob.glob('nndc/293.6K/ENDF-B-VII.1-neutron-293.6K/*'):
shutil.move(filename, 'nndc/293.6K/')
#===============================================================================
# ==============================================================================
# EDIT GRAPHITE ZAID (6012 to 6000)
print('Changing graphite ZAID from 6012 to 6000')
@ -137,24 +141,16 @@ if not response or response.lower().startswith('y'):
os.remove(f)
# ==============================================================================
# PROMPT USER TO GENERATE HDF5 LIBRARY
# GENERATE HDF5 LIBRARY
# Ask user to convert
if not args.batch:
response = input('Generate HDF5 library? ([y]/n) ')
else:
response = 'y'
# get a list of all ACE files
ace_files = sorted(glob.glob(os.path.join('nndc', '**', '*.ace*')))
# Convert files if requested
if not response or response.lower().startswith('y'):
# get a list of all ACE files
ace_files = sorted(glob.glob(os.path.join('nndc', '**', '*.ace*')))
# Get path to fission energy release data
data_dir = os.path.dirname(sys.modules['openmc.data'].__file__)
fer_file = os.path.join(data_dir, 'fission_Q_data_endfb71.h5')
# Ensure 'import openmc.data' works in the openmc-ace-to-xml script
cwd = os.getcwd()
env = os.environ.copy()
env['PYTHONPATH'] = os.path.join(cwd, '..')
subprocess.call(['../scripts/openmc-ace-to-hdf5', '-d', 'nndc_hdf5',
'--fission_energy_release', 'fission_Q_data_endfb71.h5']
+ ace_files, env=env)
pwd = os.path.dirname(os.path.realpath(__file__))
ace2hdf5 = os.path.join(pwd, 'openmc-ace-to-hdf5')
subprocess.call([ace2hdf5, '-d', 'nndc_hdf5', '--fission_energy_release',
fer_file] + ace_files)

View file

@ -50,7 +50,7 @@ if have_setuptools:
# Data files
'package_data': {
'openmc.data': ['mass.mas12']
'openmc.data': ['mass.mas12', 'fission_Q_data_endfb71.h5']
},
})