Simplified Universe equality operator per @paulromano suggestion

This commit is contained in:
Will Boyd 2017-05-12 08:29:01 -04:00
parent e3052fd315
commit 572000419d
2 changed files with 6 additions and 13 deletions

View file

@ -56,11 +56,11 @@ class Lattice(object):
return False
elif self.name != other.name:
return False
elif self.pitch != other.pitch:
elif np.any(self.pitch != other.pitch):
return False
elif self.outer != other.outer:
return False
elif self.universes != other.universes:
elif np.any(self.universes != other.universes):
return False
else:
return True
@ -533,7 +533,7 @@ class RectLattice(Lattice):
return False
elif self.shape != other.shape:
return False
elif self.lower_left != other.lower_left:
elif np.any(self.lower_left != other.lower_left):
return False
else:
return True

View file

@ -76,17 +76,10 @@ class Universe(object):
return False
elif self.name != other.name:
return False
elif len(self.cells) != len(other.cells):
elif dict.__eq__(self.cells, other.cells):
return False
# Check each cell
for cell_id in self.cells:
if cell_id not in other.cells:
return False
if self.cells[cell_id] != other.cells[cell_id]:
return False
return True
else:
return True
def __ne__(self, other):
return not self == other