From d6f0116916c571909bf6c16ebc139d61fb7933bb Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Tue, 19 Oct 2021 10:40:15 +0200 Subject: [PATCH] added sanity check when creating an xdr data frame --- sensospot_data/dynamic_range.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sensospot_data/dynamic_range.py b/sensospot_data/dynamic_range.py index 9a6119a..20adbb6 100644 --- a/sensospot_data/dynamic_range.py +++ b/sensospot_data/dynamic_range.py @@ -53,6 +53,12 @@ def _reduce_overflow(data_frame): for next_time in rest_times: mask = result_frame[CALC_SPOT_OVERFLOW] == True # noqa: E712 next_frame = split_frames[next_time].set_index(PROBE_MULTI_INDEX) + rf_index = set(result_frame.index) + nf_index = set(next_frame.index) + diff = rf_index - nf_index | nf_index - rf_index + if diff: + num = len(diff) + raise ValueError(f"XDR: Scan Data is incomplete, differs on {num} probes") result_frame.loc[mask] = next_frame.loc[mask] return result_frame.reset_index()