Skip to content

Commit 84b672c

Browse files
authored
Merge pull request #1436 from samuelgarcia/fix_openephys_legacy
Protect against corrupted channels in legacy openephys.
2 parents 9c7eb51 + 784b3f9 commit 84b672c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

neo/rawio/openephysrawio.py

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

150+
channel_has_corrupted_timestamps = np.any(diff <= 0)
151+
if channel_has_corrupted_timestamps:
152+
# protect against corrupted timestamp in channel
153+
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.")
154+
150155
if seg_index == 0:
151156
# add in channel list
152157
if ch_name[:2].upper() == "CH":

0 commit comments

Comments
 (0)