Skip to content

Commit edc502d

Browse files
authored
Merge pull request #163 from alejoe91/small-fixes
Do not remove resampled templates if not resampled
2 parents 0fec201 + 8dc8453 commit edc502d

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/MEArec/default_params/templates_params.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ offset: 0 # plane offset (um) for MEA
1919
xlim: [10,80] # limits ( low high ) for neuron locations in the x-axis (depth)
2020
ylim: null # limits ( low high ) for neuron locations in the y-axis
2121
zlim: null # limits ( low high ) for neuron locations in the z-axis
22-
x_distr: 'uniform' # distribution of x locsations ('uniform' | 'beta')
22+
x_distr: 'uniform' # distribution of x locations ('uniform' | 'beta')
2323
beta_distr_params: [1.5, 5] # parameters for beta distribution of x locations (depth)
2424
min_amp: 30 # minimum amplitude for detection
2525
check_eap_shape: True # if True, EAPs with negative peaks smaller than positive peaks are discarded

src/MEArec/generators/recordinggenerator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ def generate_recordings(
218218
self._is_tmp_folder_local = False
219219
else:
220220
self.tmp_folder = Path(self.tmp_folder)
221+
self.tmp_folder.mkdir(exist_ok=True, parents=True)
221222
self._is_tmp_folder_local = True
222223
else:
223224
self._is_tmp_folder_local = False
@@ -686,7 +687,7 @@ def generate_recordings(
686687
tmp_templates_rs = self.tmp_folder / (tmp_prefix + "templates_resample.raw")
687688
tmp_templates_jit = self.tmp_folder / (tmp_prefix + "templates_jitter.raw")
688689
self._to_remove_on_delete.extend(
689-
[tmp_path_0, tmp_path_1, tmp_templates_pad, tmp_templates_rs, tmp_templates_jit]
690+
[tmp_path_0, tmp_path_1, tmp_templates_pad, tmp_templates_jit]
690691
)
691692
else:
692693
recordings = np.zeros((n_samples, n_elec), dtype=dtype)
@@ -947,6 +948,9 @@ def generate_recordings(
947948
pad_samples = [int((pp * fs.rescale("kHz")).magnitude) for pp in pad_len]
948949
if verbose_1:
949950
print("Elapsed resample time:", time.time() - t_rs)
951+
self._to_remove_on_delete.extend(
952+
[tmp_templates_rs]
953+
)
950954
else:
951955
templates_rs = templates_pad
952956

0 commit comments

Comments
 (0)