From daed5f1c976725efc02576f034974b5cfb737bdf Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Fri, 6 Sep 2024 17:45:16 +0200 Subject: [PATCH 1/2] Fix time handling test memory --- src/spikeinterface/core/tests/test_time_handling.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/spikeinterface/core/tests/test_time_handling.py b/src/spikeinterface/core/tests/test_time_handling.py index 1b570091be..52afd9d216 100644 --- a/src/spikeinterface/core/tests/test_time_handling.py +++ b/src/spikeinterface/core/tests/test_time_handling.py @@ -49,19 +49,14 @@ def _get_time_vector_recording(self, raw_recording): spaced timeseries data. Return the original recording, recoridng with time vectors added and list including the added time vectors. """ - times_recording = copy.deepcopy(raw_recording) + times_recording = raw_recording.clone() all_time_vectors = [] for segment_index in range(raw_recording.get_num_segments()): t_start = segment_index + 1 * 100 + t_stop = t_start + raw_recording.get_duration(segment_index) + segment_index + 1 - some_small_increasing_numbers = np.arange(times_recording.get_num_samples(segment_index)) * ( - 1 / times_recording.get_sampling_frequency() - ) - - offsets = np.cumsum(some_small_increasing_numbers) - time_vector = t_start + times_recording.get_times(segment_index) + offsets - + time_vector = np.linspace(t_start, t_stop, raw_recording.get_num_samples(segment_index)) all_time_vectors.append(time_vector) times_recording.set_times(times=time_vector, segment_index=segment_index) @@ -285,6 +280,7 @@ def test_sorting_analyzer_get_durations_from_recording(self, time_vector_recordi """ _, times_recording, _ = time_vector_recording + durations = [times_recording.get_duration(s) for s in range(times_recording.get_num_segments())] sorting = si.generate_sorting( durations=[times_recording.get_duration(s) for s in range(times_recording.get_num_segments())] ) From f032b1bd73b55e4f338c02764ae7d639f1c77438 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Fri, 6 Sep 2024 17:49:16 +0200 Subject: [PATCH 2/2] Update src/spikeinterface/core/tests/test_time_handling.py --- src/spikeinterface/core/tests/test_time_handling.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/spikeinterface/core/tests/test_time_handling.py b/src/spikeinterface/core/tests/test_time_handling.py index 52afd9d216..a129316ee7 100644 --- a/src/spikeinterface/core/tests/test_time_handling.py +++ b/src/spikeinterface/core/tests/test_time_handling.py @@ -280,7 +280,6 @@ def test_sorting_analyzer_get_durations_from_recording(self, time_vector_recordi """ _, times_recording, _ = time_vector_recording - durations = [times_recording.get_duration(s) for s in range(times_recording.get_num_segments())] sorting = si.generate_sorting( durations=[times_recording.get_duration(s) for s in range(times_recording.get_num_segments())] )