From 8dc84531a6dfedd9f506f480233cc4cf38ad1971 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Fri, 22 Sep 2023 15:02:22 +0200 Subject: [PATCH] Do not remove resampled templates if not resampled --- src/MEArec/default_params/templates_params.yaml | 2 +- src/MEArec/generators/recordinggenerator.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/MEArec/default_params/templates_params.yaml b/src/MEArec/default_params/templates_params.yaml index 55a2842..e81a9fa 100644 --- a/src/MEArec/default_params/templates_params.yaml +++ b/src/MEArec/default_params/templates_params.yaml @@ -19,7 +19,7 @@ offset: 0 # plane offset (um) for MEA xlim: [10,80] # limits ( low high ) for neuron locations in the x-axis (depth) ylim: null # limits ( low high ) for neuron locations in the y-axis zlim: null # limits ( low high ) for neuron locations in the z-axis -x_distr: 'uniform' # distribution of x locsations ('uniform' | 'beta') +x_distr: 'uniform' # distribution of x locations ('uniform' | 'beta') beta_distr_params: [1.5, 5] # parameters for beta distribution of x locations (depth) min_amp: 30 # minimum amplitude for detection check_eap_shape: True # if True, EAPs with negative peaks smaller than positive peaks are discarded diff --git a/src/MEArec/generators/recordinggenerator.py b/src/MEArec/generators/recordinggenerator.py index f3d5de4..c1525bd 100644 --- a/src/MEArec/generators/recordinggenerator.py +++ b/src/MEArec/generators/recordinggenerator.py @@ -218,6 +218,7 @@ def generate_recordings( self._is_tmp_folder_local = False else: self.tmp_folder = Path(self.tmp_folder) + self.tmp_folder.mkdir(exist_ok=True, parents=True) self._is_tmp_folder_local = True else: self._is_tmp_folder_local = False @@ -686,7 +687,7 @@ def generate_recordings( tmp_templates_rs = self.tmp_folder / (tmp_prefix + "templates_resample.raw") tmp_templates_jit = self.tmp_folder / (tmp_prefix + "templates_jitter.raw") self._to_remove_on_delete.extend( - [tmp_path_0, tmp_path_1, tmp_templates_pad, tmp_templates_rs, tmp_templates_jit] + [tmp_path_0, tmp_path_1, tmp_templates_pad, tmp_templates_jit] ) else: recordings = np.zeros((n_samples, n_elec), dtype=dtype) @@ -947,6 +948,9 @@ def generate_recordings( pad_samples = [int((pp * fs.rescale("kHz")).magnitude) for pp in pad_len] if verbose_1: print("Elapsed resample time:", time.time() - t_rs) + self._to_remove_on_delete.extend( + [tmp_templates_rs] + ) else: templates_rs = templates_pad