added __eq__ to the nuclear data classes and also enabled openmc.data.ThermalScattering.from_hdf5 to use either a group or filename like Neutron can.

This commit is contained in:
Adam Nelson 2016-08-11 19:11:10 -04:00
parent 4edede450e
commit e8ebc74b4f
10 changed files with 289 additions and 3 deletions

View file

@ -65,6 +65,18 @@ class Tabulated1D(object):
self.x = np.asarray(x)
self.y = np.asarray(y)
def __eq__(self, other):
if not isinstance(other, type(self)):
return NotImplemented
else:
eqval = True
if (not np.array_equal(self.x, other.x) or
not np.array_equal(self.y, other.y) or
not np.array_equal(self.breakpoints, other.breakpoints) or
not np.array_equal(self.interpolation, other.interpolation)):
eqval = False
return eqval
def __call__(self, x):
# Check if input is array or scalar
if isinstance(x, Iterable):