From dc3a026056d6b9b89117f9550500ddba099edb3d Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Fri, 20 Sep 2024 21:00:05 +0200 Subject: [PATCH 1/2] Set run_info to None for load_waveforms --- .../core/waveforms_extractor_backwards_compatibility.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/spikeinterface/core/waveforms_extractor_backwards_compatibility.py b/src/spikeinterface/core/waveforms_extractor_backwards_compatibility.py index a50a56bf85..5c7584ecd8 100644 --- a/src/spikeinterface/core/waveforms_extractor_backwards_compatibility.py +++ b/src/spikeinterface/core/waveforms_extractor_backwards_compatibility.py @@ -536,6 +536,7 @@ def _read_old_waveforms_extractor_binary(folder, sorting): ext = ComputeRandomSpikes(sorting_analyzer) ext.params = dict() ext.data = dict(random_spikes_indices=random_spikes_indices) + ext.run_info = None sorting_analyzer.extensions["random_spikes"] = ext ext = ComputeWaveforms(sorting_analyzer) @@ -545,6 +546,7 @@ def _read_old_waveforms_extractor_binary(folder, sorting): dtype=params["dtype"], ) ext.data["waveforms"] = waveforms + ext.run_info = None sorting_analyzer.extensions["waveforms"] = ext # templates saved dense @@ -559,6 +561,7 @@ def _read_old_waveforms_extractor_binary(folder, sorting): ext.params = dict(ms_before=params["ms_before"], ms_after=params["ms_after"], operators=list(templates.keys())) for mode, arr in templates.items(): ext.data[mode] = arr + ext.run_info = None sorting_analyzer.extensions["templates"] = ext for old_name, new_name in old_extension_to_new_class_map.items(): @@ -631,6 +634,7 @@ def _read_old_waveforms_extractor_binary(folder, sorting): ext.set_params(**updated_params, save=False) if ext.need_backward_compatibility_on_load: ext._handle_backward_compatibility_on_load() + ext.run_info = None sorting_analyzer.extensions[new_name] = ext From 778b77343cefd2295396c2f5097a9859946fb4db Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Mon, 23 Sep 2024 09:51:54 +0200 Subject: [PATCH 2/2] 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