Modify Results.from_hdf5 to support for files w/o depletion time

Needed because ./tests/regression_tests/deplete/test_reference.h5
does not contain this dataset. Now, a check is performed
to see if "depletion file" is present in the root of the hdf5 file.
Otherwise, the proc_time is set to the array of nans
This commit is contained in:
Andrew Johnson 2019-06-21 14:09:34 -05:00
parent df07ecbcfa
commit bd0a9a18e4
No known key found for this signature in database
GPG key ID: 253418E91B7F6FEB

View file

@ -347,18 +347,18 @@ class Results(object):
eigenvalues_dset = handle["/eigenvalues"]
time_dset = handle["/time"]
power_dset = handle["/power"]
proc_time_dset = handle["/depletion time"]
results.data = number_dset[step, :, :, :]
results.k = eigenvalues_dset[step, :]
results.time = time_dset[step, :]
results.power = power_dset[step, :]
# depletion time data has one fewer index, corresponding
# to one fewer calculation stage
if step < proc_time_dset.shape[0]:
results.proc_time = proc_time_dset[step, :]
else:
if "depletion time" in handle:
proc_time_dset = handle["/depletion time"]
if step < proc_time_dset.shape[0]:
results.proc_time = proc_time_dset[step, :]
if results.proc_time is None:
results.proc_time = np.array([np.nan])
# Reconstruct dictionaries