Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not remove resampled templates if not resampled #163

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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