From 703fbf50315e21923933c440c8eaf44c9ee2d3ef Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE" Date: Thu, 9 Jan 2020 11:20:25 +0100 Subject: [PATCH] Rudimentary overflow checker implemented --- lasp/lasp_measurement.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lasp/lasp_measurement.py b/lasp/lasp_measurement.py index 22c220d..96d8c36 100644 --- a/lasp/lasp_measurement.py +++ b/lasp/lasp_measurement.py @@ -315,6 +315,31 @@ class Measurement: """ 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 def sensitivity(self, sens): """