mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
feat: hash method for Obs objects added.
This commit is contained in:
parent
f908b6328d
commit
b2d5263ea3
2 changed files with 19 additions and 0 deletions
|
@ -684,6 +684,12 @@ class Obs:
|
|||
else:
|
||||
return '{:.0f}({:2.0f})'.format(self.value, self._dvalue)
|
||||
|
||||
def __hash__(self):
|
||||
return hash((np.array([self.value]).astype(np.float32)[0],
|
||||
tuple([o.astype(np.float32).data.tobytes() for o in self.deltas.values()]),
|
||||
tuple(np.array([o.errsq() for o in self.covobs.values()]).astype(np.float32).data.tobytes()),
|
||||
tuple(self.names)))
|
||||
|
||||
# Overload comparisons
|
||||
def __lt__(self, other):
|
||||
return self.value < other
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue