diff --git a/src/spikeinterface/core/baserecording.py b/src/spikeinterface/core/baserecording.py index 82f2ae1890..082afd880b 100644 --- a/src/spikeinterface/core/baserecording.py +++ b/src/spikeinterface/core/baserecording.py @@ -503,8 +503,8 @@ def reset_times(self): segment's sampling frequency is set to the recording's sampling frequency. """ for segment_index in range(self.get_num_segments()): + rs = self._recording_segments[segment_index] if self.has_time_vector(segment_index): - rs = self._recording_segments[segment_index] rs.time_vector = None rs.t_start = None rs.sampling_frequency = self.sampling_frequency diff --git a/src/spikeinterface/core/tests/test_baserecording.py b/src/spikeinterface/core/tests/test_baserecording.py index 9c354510ac..6b60efe2b6 100644 --- a/src/spikeinterface/core/tests/test_baserecording.py +++ b/src/spikeinterface/core/tests/test_baserecording.py @@ -298,6 +298,9 @@ def test_BaseRecording(create_cache_folder): assert time_info["time_vector"] is None assert time_info["sampling_frequency"] == rec.sampling_frequency + # resetting time again should be ok + rec.reset_times() + # test 3d probe rec_3d = generate_recording(ndim=3, num_channels=30) locations_3d = rec_3d.get_property("location")