diff --git a/openmc/data/reaction.py b/openmc/data/reaction.py index c5abc73c3..05b6b8d2d 100644 --- a/openmc/data/reaction.py +++ b/openmc/data/reaction.py @@ -894,10 +894,7 @@ class Reaction(EqualityMixin): Tgroup = group.create_group(T) if self.xs[T] is not None: dset = Tgroup.create_dataset('xs', data=self.xs[T].y) - if hasattr(self.xs[T], '_threshold_idx'): - threshold_idx = self.xs[T]._threshold_idx + 1 - else: - threshold_idx = 1 + threshold_idx = getattr(self.xs[T], '_threshold_idx', 0) dset.attrs['threshold_idx'] = threshold_idx for i, p in enumerate(self.products): pgroup = group.create_group('product_{}'.format(i)) @@ -939,7 +936,7 @@ class Reaction(EqualityMixin): 'at T={} because no corresponding energy grid ' 'exists.'.format(mt, T)) xs = Tgroup['xs'][()] - threshold_idx = Tgroup['xs'].attrs['threshold_idx'] - 1 + threshold_idx = Tgroup['xs'].attrs['threshold_idx'] tabulated_xs = Tabulated1D(energy[T][threshold_idx:], xs) tabulated_xs._threshold_idx = threshold_idx rx.xs[T] = tabulated_xs diff --git a/src/reaction.cpp b/src/reaction.cpp index 222822230..b733b2028 100644 --- a/src/reaction.cpp +++ b/src/reaction.cpp @@ -42,8 +42,6 @@ Reaction::Reaction(hid_t group, const std::vector& temperatures) // Get threshold index TemperatureXS xs; read_attribute(dset, "threshold_idx", xs.threshold); - // TODO: change HDF5 format so that threshold_idx is 0-based - --xs.threshold; // Read cross section values read_dataset(dset, xs.value);