Rudimentary overflow checker implemented

This commit is contained in:
Anne de Jong 2020-01-09 11:20:25 +01:00
parent 00bd30eb2a
commit 703fbf5031

View File

@ -315,6 +315,31 @@ class Measurement:
""" """
return self._sens return self._sens
def checkOverflow(self):
"""
Coarse check for overflow in measurement
Return:
True if overflow is possible, else False
"""
with self.file() as f:
for block in self.iterBlocks(f):
dtype = block.dtype
print(dtype)
if dtype.kind == 'i':
# if dtype in ['
# minvalue = np.iinfo(dtype).min
maxvalue = np.iinfo(dtype).max
if np.max(np.abs(block)) > maxvalue / 2:
return True
else:
# Cannot check for floating point values.
return False
return False
@sensitivity.setter @sensitivity.setter
def sensitivity(self, sens): def sensitivity(self, sens):
""" """