summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2020-09-01 18:13:06 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2020-09-01 18:13:06 +0200
commit68455010010960eceacffacfd75b57dddfa74f89 (patch)
tree0a1feaf17cbe0ccda2a8ab695ec4ed0a6352826b
parenta3c8589105bee5f1d1c49b1e365a978e58451b3e (diff)
Handle invalid data
-rwxr-xr-xbin/dlog-viewer8
1 files changed, 7 insertions, 1 deletions
diff --git a/bin/dlog-viewer b/bin/dlog-viewer
index f567772..24657b2 100755
--- a/bin/dlog-viewer
+++ b/bin/dlog-viewer
@@ -108,7 +108,13 @@ class DLog:
channel_offset = 0
measurement_offset = 0
for value in iterator:
- self.data[channel_offset, measurement_offset] = value[0]
+ if value[0] < -1e6 or value[0] > 1e6:
+ print(
+ f"Invalid data value {value[0]} at channel {channel_offset}, measurement {measurement_offset}. Replacing with 0."
+ )
+ self.data[channel_offset, measurement_offset] = 0
+ else:
+ self.data[channel_offset, measurement_offset] = value[0]
if channel_offset + 1 == num_channels:
channel_offset = 0
measurement_offset += 1