From 9fffaa0c26bdcebb7d6ac852dac84397db51b372 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 23 Mar 2020 20:50:04 -0500 Subject: [PATCH] Bug fix for comparison of ParticleFilter objects --- openmc/filter.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/openmc/filter.py b/openmc/filter.py index 62afbdd6ec..f37a0a9d0e 100644 --- a/openmc/filter.py +++ b/openmc/filter.py @@ -671,6 +671,16 @@ class ParticleFilter(Filter): The number of filter bins """ + def __eq__(self, other): + if type(self) is not type(other): + return False + elif len(self.bins) != len(other.bins): + return False + else: + return np.all(self.bins == other.bins) + + __hash__ = Filter.__hash__ + @Filter.bins.setter def bins(self, bins): bins = np.atleast_1d(bins) @@ -1686,10 +1696,8 @@ class EnergyFunctionFilter(Filter): return False elif not all(self.energy == other.energy): return False - elif not all(self.y == other.y): - return False else: - return True + return all(self.y == other.y) def __gt__(self, other): if type(self) is not type(other):