1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
Description: Avoid division by zero on single-CPU systems
Author: Santiago Vila <sanvila@debian.org>
Last-Update: 2025-03-22
--- a/dipy/reconst/multi_voxel.py
+++ b/dipy/reconst/multi_voxel.py
@@ -100,7 +100,7 @@
if weights_is_array:
weights_to_fit = weights[np.where(mask)]
single_voxel_with_self = partial(single_voxel_fit, self)
- n_jobs = kwargs.get("n_jobs", multiprocessing.cpu_count() - 1)
+ n_jobs = kwargs.get("n_jobs", max(multiprocessing.cpu_count() - 1, 1))
vox_per_chunk = kwargs.get(
"vox_per_chunk", np.max([data_to_fit.shape[0] // n_jobs, 1])
)
|