Rudimentary overflow checker implemented
This commit is contained in:
parent
00bd30eb2a
commit
703fbf5031
@ -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):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user