From 30bd9b93ae88bc07a3e8ab13eadedb255440a083 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Tue, 10 Sep 2024 19:30:31 +0200 Subject: [PATCH] Fix bug with reset_times --- src/spikeinterface/core/baserecording.py | 2 +- src/spikeinterface/core/tests/test_baserecording.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/spikeinterface/core/baserecording.py b/src/spikeinterface/core/baserecording.py index 3e5e43b528..f05d5b29dc 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")