From a46994f5ea58e4359ef0a514bae9cd96dc2bf5f8 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 4 Oct 2023 13:43:48 +0200 Subject: [PATCH 1/3] waveform extactor reload --- src/spikeinterface/core/waveform_extractor.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/spikeinterface/core/waveform_extractor.py b/src/spikeinterface/core/waveform_extractor.py index 2710ff1338..6d9e5d41e3 100644 --- a/src/spikeinterface/core/waveform_extractor.py +++ b/src/spikeinterface/core/waveform_extractor.py @@ -175,7 +175,13 @@ def load_from_folder( rec_attributes = None if sorting is None: - sorting = load_extractor(folder / "sorting.json", base_folder=folder) + if (folder / "sorting.json").exists(): + sorting = load_extractor(folder / "sorting.json", base_folder=folder) + elif (folder / "sorting.pickle").exists(): + sorting = load_extractor(folder / "sorting.pickle") + else: + raise FileNotFoundError("load_waveforms() impossible to find the sorting object (json or pickle)") + # the sparsity is the sparsity of the saved/cached waveforms arrays sparsity_file = folder / "sparsity.json" From 87a9dc964d59530267ed5be8b297a08b35427b75 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 4 Oct 2023 15:36:07 +0200 Subject: [PATCH 2/3] yep --- src/spikeinterface/core/generate.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/spikeinterface/core/generate.py b/src/spikeinterface/core/generate.py index 06a5ec96ec..9d656db977 100644 --- a/src/spikeinterface/core/generate.py +++ b/src/spikeinterface/core/generate.py @@ -1405,6 +1405,7 @@ def generate_ground_truth_recording( assert sorting.sampling_frequency == sampling_frequency num_spikes = sorting.to_spike_vector().size + if probe is None: probe = generate_linear_probe(num_elec=num_channels) probe.set_device_channel_indices(np.arange(num_channels)) From 0c97fc46adfb8c19683285ab77338ea9e103ac25 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:37:30 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/spikeinterface/core/generate.py | 1 - src/spikeinterface/core/waveform_extractor.py | 1 - 2 files changed, 2 deletions(-) diff --git a/src/spikeinterface/core/generate.py b/src/spikeinterface/core/generate.py index 9d656db977..06a5ec96ec 100644 --- a/src/spikeinterface/core/generate.py +++ b/src/spikeinterface/core/generate.py @@ -1405,7 +1405,6 @@ def generate_ground_truth_recording( assert sorting.sampling_frequency == sampling_frequency num_spikes = sorting.to_spike_vector().size - if probe is None: probe = generate_linear_probe(num_elec=num_channels) probe.set_device_channel_indices(np.arange(num_channels)) diff --git a/src/spikeinterface/core/waveform_extractor.py b/src/spikeinterface/core/waveform_extractor.py index 6d9e5d41e3..576a0a1a58 100644 --- a/src/spikeinterface/core/waveform_extractor.py +++ b/src/spikeinterface/core/waveform_extractor.py @@ -182,7 +182,6 @@ def load_from_folder( else: raise FileNotFoundError("load_waveforms() impossible to find the sorting object (json or pickle)") - # the sparsity is the sparsity of the saved/cached waveforms arrays sparsity_file = folder / "sparsity.json" if sparsity_file.is_file():