diff --git a/neo/rawio/openephysrawio.py b/neo/rawio/openephysrawio.py index 38824d4f7..3d4b781d3 100644 --- a/neo/rawio/openephysrawio.py +++ b/neo/rawio/openephysrawio.py @@ -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":