diff --git a/py_bombcell/bombcell/default_parameters.py b/py_bombcell/bombcell/default_parameters.py index 345d3eb..0fab9ca 100644 --- a/py_bombcell/bombcell/default_parameters.py +++ b/py_bombcell/bombcell/default_parameters.py @@ -43,6 +43,7 @@ def get_default_parameters( "saveAsTSV": True, # save outputs as a .tsv file, useful for using phy after bombcell "unit_type_for_phy": True, # save a unit_type .tsv file for phy "ephysKilosortPath": str(kilosort_path), # path to the KiloSort directory + "joblib_backend_preference": "processes", # 'processes' OR 'threads ## Duplicate spike parameters "removeDuplicateSpikes": False, diff --git a/py_bombcell/bombcell/extract_raw_waveforms.py b/py_bombcell/bombcell/extract_raw_waveforms.py index 719f345..aba67fa 100644 --- a/py_bombcell/bombcell/extract_raw_waveforms.py +++ b/py_bombcell/bombcell/extract_raw_waveforms.py @@ -524,7 +524,12 @@ def extract_raw_waveforms( all_spikes_idxs[i, : len(clus_spike_times[i])] = clus_spike_times[i] all_spikes_idxs[i, len(clus_spike_times[i]) :] = np.nan - all_waveforms = Parallel(n_jobs=-1, verbose=10, mmap_mode="r", max_nbytes=None)( + try: + prefer = param["joblib_backend_preference"] + except KeyError: + param["joblib_backend_preference"] = "processes" + prefer = param["joblib_backend_preference"] + all_waveforms = Parallel(n_jobs=-1, verbose=10, mmap_mode="r", max_nbytes=None, prefer=prefer)( delayed(process_a_unit)( raw_data, spike_width,