From 15f8d8bf160f75b0fbaf12bbecaf84d35f90b22e Mon Sep 17 00:00:00 2001 From: Flan Date: Tue, 26 Apr 2016 16:33:37 -0500 Subject: [PATCH] individualized the try excepts for the new keyerror catches --- pyne/origen22.py | 18 ++++++++++++++---- pyne/xs/cache.py | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/pyne/origen22.py b/pyne/origen22.py index 147d4ad5ae..5a108c0f0d 100644 --- a/pyne/origen22.py +++ b/pyne/origen22.py @@ -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 diff --git a/pyne/xs/cache.py b/pyne/xs/cache.py index c1e54ded42..9fd4bc547d 100644 --- a/pyne/xs/cache.py +++ b/pyne/xs/cache.py @@ -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']