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 all commits
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
5 changes: 5 additions & 0 deletions neo/rawio/openephysrawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ 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"

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 timestamps with zero values or negative differences between consecutive timestamps, this file ({continuous_filename}) with corrupted timestamps needs to be moved away from the folder.")

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