From 3b39a0507dc9737e61458e24ca3f61d651cee83c Mon Sep 17 00:00:00 2001 From: Pierre Yger Date: Fri, 22 Nov 2024 10:28:14 +0100 Subject: [PATCH] job_kwargs propagated everywhere --- .../sorters/internal/spyking_circus2.py | 13 +++++++------ .../clustering/clustering_tools.py | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/spikeinterface/sorters/internal/spyking_circus2.py b/src/spikeinterface/sorters/internal/spyking_circus2.py index c55a152d10..cdfbde5e45 100644 --- a/src/spikeinterface/sorters/internal/spyking_circus2.py +++ b/src/spikeinterface/sorters/internal/spyking_circus2.py @@ -350,7 +350,7 @@ def _run_from_folder(cls, sorter_output_folder, params, verbose): sorting.save(folder=curation_folder) # np.save(fitting_folder / "amplitudes", guessed_amplitudes) - sorting = final_cleaning_circus(recording_w, sorting, templates, **merging_params) + sorting = final_cleaning_circus(recording_w, sorting, templates, merging_params, **job_kwargs) if verbose: print(f"Final merging, keeping {len(sorting.unit_ids)} units") @@ -410,16 +410,17 @@ def divide_recording(recording, seed=None, **job_kwargs): return recording_slices -def final_cleaning_circus(recording, sorting, templates, **merging_kwargs): +def final_cleaning_circus(recording, sorting, templates, merging_kwargs, **job_kwargs): from spikeinterface.core.sorting_tools import apply_merges_to_sorting - sa = create_sorting_analyzer_with_templates(sorting, recording, templates) - sa.compute("unit_locations", method="monopolar_triangulation") + + sa.compute("unit_locations", method="monopolar_triangulation", **job_kwargs) similarity_kwargs = merging_kwargs.pop("similarity_kwargs", {}) - sa.compute("template_similarity", **similarity_kwargs) + sa.compute("template_similarity", **similarity_kwargs, **job_kwargs) correlograms_kwargs = merging_kwargs.pop("correlograms_kwargs", {}) - sa.compute("correlograms", **correlograms_kwargs) + sa.compute("correlograms", **correlograms_kwargs, **job_kwargs) + auto_merge_kwargs = merging_kwargs.pop("auto_merge", {}) merges = get_potential_auto_merge(sa, resolve_graph=True, **auto_merge_kwargs) sorting = apply_merges_to_sorting(sa.sorting, merges) diff --git a/src/spikeinterface/sortingcomponents/clustering/clustering_tools.py b/src/spikeinterface/sortingcomponents/clustering/clustering_tools.py index 08a1384333..b33ede8c7d 100644 --- a/src/spikeinterface/sortingcomponents/clustering/clustering_tools.py +++ b/src/spikeinterface/sortingcomponents/clustering/clustering_tools.py @@ -570,7 +570,7 @@ def detect_mixtures(templates, method_kwargs={}, job_kwargs={}, tmp_folder=None, ) else: recording = NumpyRecording(zdata, sampling_frequency=fs) - recording = SharedMemoryRecording.from_recording(recording) + recording = SharedMemoryRecording.from_recording(recording, **job_kwargs) recording = recording.set_probe(templates.probe) recording.annotate(is_filtered=True)