Skip to content

Commit

Permalink
Protect against corrupted channels in legacy openephys.
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgarcia committed Mar 17, 2024
1 parent 8ec58f7 commit 1936239
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions neo/rawio/openephysrawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ def _parse_header(self):
np.median(diff) == RECORD_SIZE
), f"This file has a non valid data block size for channel {chan_id}, this case cannot be handled"

diff = np.diff(data_chan["timestamp"])
channel_has_corrupted_timestamps = np.any(diff <= 0)
if channel_has_corrupted_timestamps:
# protect against corrupted timestamp in channel
raise ValueError(f"{ch_name} has corrputed timestamps, this channels need to be moved away from the folder")

if seg_index == 0:
# add in channel list
if ch_name[:2].upper() == "CH":
Expand Down

0 comments on commit 1936239

Please sign in to comment.