Smart slicing of lazy processing
Currently lazy processing for functions with masks arguments is not done in an efficient fashion. For example, in LazyPixelatedSTEM.center_of_mass
the dask array is not cropped when the mask
argument is used.
Assuming 256 x 256 pixel detector, with mask
centred at (128, 128) with a radius of 20 (108 - 148), and 16 x 16 diffraction image chunks. In this case, there is no need to load the full diffraction image into memory, but rather im[16*6:16*10, 16*6:16*10]
(i.e. im[96:160, 96:160]
). Currently this can be done manually, however it would be much better if this was handled automatically by the lazy utility functions.
For a large dataset, this can reduce the processing time from 11 minutes to about 1 minute.