napari-process-points-and-surfaces icon indicating copy to clipboard operation
napari-process-points-and-surfaces copied to clipboard

Parallelize sphere-fitted curvature computation

Open haesleinhuepf opened this issue 2 years ago • 1 comments

It should be possible to parallelize the computation of the sphere-fitted curvature by parallelizing this for loop:

https://github.com/haesleinhuepf/napari-process-points-and-surfaces/blob/a6c9113b4860917cbf6beb2b6c535e9ecced1d25/napari_process_points_and_surfaces/_quantification.py#L239

Hints:

  • https://haesleinhuepf.github.io/BioImageAnalysisNotebooks/03_advanced_python/parallelization.html#parallelization-using-joblib-parallel
  • https://www.dominodatalab.com/blog/dask-step-by-step-tutorial

haesleinhuepf avatar Feb 04 '23 10:02 haesleinhuepf

Hi @haesleinhuepf ,

I played around with this in another context and I think joblib parallelization could do the trick. The syntax is also quick simple:

from joblib import Parallel, delayed

list_of_results = Parallel(n_jobs=-1)(delayed(function_to_parallelize)(arg for arg in list_of_arguments))

will try to put it in a PR.

jo-mueller avatar Mar 06 '23 07:03 jo-mueller