Some tinkering with using multiple processes to read voxels.
Source code in navis/transforms/h5reg.py
726
727
728
729
730
731
732
733
734 | def read_points_threaded(voxels, filepath, level, dir, threads=5):
"""Some tinkering with using multiple processes to read voxels."""
splits = np.array_split(voxels, threads)
with concurrent.futures.ProcessPoolExecutor(max_workers=threads) as executor:
chunks = [(arr, filepath, level, dir) for arr in splits]
futures = executor.map(_read_points, chunks)
offset = np.vstack(list(futures))
return offset
|