Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect against corrupted channels in legacy openephys. #1436

Merged
merged 2 commits into from
May 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"])
alejoe91 marked this conversation as resolved.
Show resolved Hide resolved
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")
alejoe91 marked this conversation as resolved.
Show resolved Hide resolved

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