Skip to content

Commit

Permalink
Merge pull request #2251 from alejoe91/fix-read-only
Browse files Browse the repository at this point in the history
Disable writing templates modes npy in read-only mode
  • Loading branch information
samuelgarcia authored Nov 24, 2023
2 parents a4e201c + 7879aa5 commit d269898
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/spikeinterface/core/waveform_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit d269898

Please sign in to comment.