Skip to content

Commit

Permalink
individualized the try excepts for the new keyerror catches
Browse files Browse the repository at this point in the history
  • Loading branch information
Flan committed Apr 26, 2016
1 parent c9e4b26 commit 15f8d8b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions pyne/origen22.py
Original file line number Diff line number Diff line change
Expand Up @@ -1509,19 +1509,29 @@ def xslibs(nucs=NUCS, xscache=None, nlb=(201, 202, 203), verbose=False):
t9[nlb[2]][field] = {}
# fill with data
for nuc in nucs:
if verbose:
print('computing {0}'.format(nucname.name(nuc)))
key = nucname.zzaaam(nuc)
try:
if verbose:
print('computing {0}'.format(nucname.name(nuc)))
key = nucname.zzaaam(nuc)
if nuc in ACTIVATION_PRODUCT_NUCS:
_compute_xslib(nuc, key, t9[nlb[0]], xscache)
except KeyError:
if verbose:
print('Key Error with ', key, ' in a computing activation product cross sections')
continue
try:
if nuc in ACTINIDE_AND_DAUGHTER_NUCS:
_compute_xslib(nuc, key, t9[nlb[1]], xscache)
except KeyError:
if verbose:
print('Key Error with ', key, ' in a computing actinide and daughter cross sections')
continue
try:
if nuc in FISSION_PRODUCT_NUCS:
_compute_xslib(nuc, key, t9[nlb[2]], xscache)
except KeyError:
if verbose:
print('Key Error with ', key, ' in a computing cross sections')
print('Key Error with ', key, ' in a computing fission product cross sections')
continue
xscache['E_g'] = old_group_struct
xscache['phi_g'] = old_flux
Expand Down
2 changes: 1 addition & 1 deletion pyne/xs/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def __setitem__(self, key, value):
self.clear()
self._cache['phi_g'] = None
for ds in self.data_sources:
ds.dst_group_struct = value
ds.dst_group_struct = value
elif (key == 'phi_g'):
value = value if value is None else np.asarray(value, dtype='f8')
cache_value = self._cache['phi_g']
Expand Down

0 comments on commit 15f8d8b

Please sign in to comment.