From ef9ecfd963af70061cd107c1e5bbd6be5b143e99 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Thu, 23 Nov 2023 16:07:01 +0100 Subject: [PATCH] Disable writing templates modes npy in read-only mode --- src/spikeinterface/core/waveform_extractor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/spikeinterface/core/waveform_extractor.py b/src/spikeinterface/core/waveform_extractor.py index 1218a7f281..0135047d67 100644 --- a/src/spikeinterface/core/waveform_extractor.py +++ b/src/spikeinterface/core/waveform_extractor.py @@ -1199,7 +1199,7 @@ def precompute_templates(self, modes=("average", "std", "median", "percentile"), The results is cached in memory as a 3d ndarray (nunits, nsamples, nchans) and also saved as an npy file in the folder to avoid recomputation each time. """ - # TODO : run this in parralel + # TODO : run this in parallel unit_ids = self.unit_ids num_chans = self.get_num_channels() @@ -1237,7 +1237,7 @@ def precompute_templates(self, modes=("average", "std", "median", "percentile"), for mode in modes: templates = self._template_cache[mode_names[mode]] - if self.folder is not None: + if self.folder is not None and not self.is_read_only(): template_file = self.folder / f"templates_{mode_names[mode]}.npy" np.save(template_file, templates)