diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2020-09-01 18:13:06 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2020-09-01 18:13:06 +0200 |
commit | 68455010010960eceacffacfd75b57dddfa74f89 (patch) | |
tree | 0a1feaf17cbe0ccda2a8ab695ec4ed0a6352826b /bin | |
parent | a3c8589105bee5f1d1c49b1e365a978e58451b3e (diff) |
Handle invalid data
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/dlog-viewer | 8 |
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 |