Skip to content

Commit

Permalink
Merge pull request #163 from alejoe91/small-fixes
Browse files Browse the repository at this point in the history
Do not remove resampled templates if not resampled
  • Loading branch information
alejoe91 authored Sep 22, 2023
2 parents 0fec201 + 8dc8453 commit edc502d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/MEArec/default_params/templates_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/MEArec/generators/recordinggenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit edc502d

Please sign in to comment.