mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
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:
parent
4edede450e
commit
e8ebc74b4f
10 changed files with 289 additions and 3 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue