Skip to content

Commit 1936239

Browse files
committed
Protect against corrupted channels in legacy openephys.
1 parent 8ec58f7 commit 1936239

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

neo/rawio/openephysrawio.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ def _parse_header(self):
141141
np.median(diff) == RECORD_SIZE
142142
), f"This file has a non valid data block size for channel {chan_id}, this case cannot be handled"
143143

144+
diff = np.diff(data_chan["timestamp"])
145+
channel_has_corrupted_timestamps = np.any(diff <= 0)
146+
if channel_has_corrupted_timestamps:
147+
# protect against corrupted timestamp in channel
148+
raise ValueError(f"{ch_name} has corrputed timestamps, this channels need to be moved away from the folder")
149+
144150
if seg_index == 0:
145151
# add in channel list
146152
if ch_name[:2].upper() == "CH":

0 commit comments

Comments
 (0)