From 778b77343cefd2295396c2f5097a9859946fb4db Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Mon, 23 Sep 2024 09:51:54 +0200 Subject: [PATCH] Fix bug in saving zarr recordings --- src/spikeinterface/core/baserecording.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/spikeinterface/core/baserecording.py b/src/spikeinterface/core/baserecording.py index e44ed9b948..d0b6ab0092 100644 --- a/src/spikeinterface/core/baserecording.py +++ b/src/spikeinterface/core/baserecording.py @@ -608,11 +608,11 @@ def _save(self, format="binary", verbose: bool = False, **save_kwargs): probegroup = self.get_probegroup() cached.set_probegroup(probegroup) - time_vectors = self._get_time_vectors() - if time_vectors is not None: - for segment_index, time_vector in enumerate(time_vectors): - if time_vector is not None: - cached.set_times(time_vector, segment_index=segment_index) + for segment_index in range(self.get_num_segments()): + if self.has_time_vector(segment_index): + # the use of get_times is preferred since timestamps are converted to array + time_vector = self.get_times(segment_index=segment_index) + cached.set_times(time_vector, segment_index=segment_index) return cached