diff --git a/pyne/origen22.py b/pyne/origen22.py index b4df375f3a..e0f8ef95be 100644 --- a/pyne/origen22.py +++ b/pyne/origen22.py @@ -1509,15 +1509,28 @@ 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) - if nuc in ACTIVATION_PRODUCT_NUCS: - _compute_xslib(nuc, key, t9[nlb[0]], xscache) - if nuc in ACTINIDE_AND_DAUGHTER_NUCS: - _compute_xslib(nuc, key, t9[nlb[1]], xscache) - if nuc in FISSION_PRODUCT_NUCS: - _compute_xslib(nuc, key, t9[nlb[2]], xscache) + 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) + if nuc in ACTINIDE_AND_DAUGHTER_NUCS: + _compute_xslib(nuc, key, t9[nlb[1]], xscache) + if nuc in FISSION_PRODUCT_NUCS: + _compute_xslib(nuc, key, t9[nlb[2]], xscache) + except KeyError: + print('Key Error with ', key, ' in a computing cross sections') + continue + #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) + #if nuc in ACTINIDE_AND_DAUGHTER_NUCS: + # _compute_xslib(nuc, key, t9[nlb[1]], xscache) + #if nuc in FISSION_PRODUCT_NUCS: + # _compute_xslib(nuc, key, t9[nlb[2]], xscache) xscache['E_g'] = old_group_struct xscache['phi_g'] = old_flux return t9 diff --git a/pyne/xs/cache.py b/pyne/xs/cache.py index 8748aecc64..c1e54ded42 100644 --- a/pyne/xs/cache.py +++ b/pyne/xs/cache.py @@ -114,9 +114,9 @@ def __getitem__(self, key): xsdata = ds.discretize(**kw) if xsdata is not None: self._cache[key] = xsdata - break - else: - self._cache[key] = [0] + break + else: + raise KeyError # Return the value requested return self._cache[key] @@ -131,8 +131,8 @@ def __setitem__(self, key, value): return self.clear() self._cache['phi_g'] = None - #for ds in self.data_sources: - # ds.dst_group_struct = value + for ds in self.data_sources: + 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']