cta-observatory / ctapipe

Low-level data processing pipeline software for CTAO or similar arrays of Imaging Atmospheric Cherenkov Telescopes
https://ctapipe.readthedocs.org
BSD 3-Clause "New" or "Revised" License
63 stars 266 forks source link

Hillas parameterization on sliced data now slower than it should be #686

Closed kosack closed 5 years ago

kosack commented 6 years ago

This is just a reminder to look into why slicing is now causing a large overhead in calculating hillas params (it's probably something simple). Note that in this case, the mask and therefore sliced data only contains about 10 pixels, while the camera has several 1000. So normally, looping over the masked image would be much faster, and not 2x slower. It's likely due to some overhead introduced when the CameraGeometry is sliced. In the old implementation , we did not pass the CameraGeometry directly, only the pix_x and pix_y vectors, so the slicing was simpler.

mask = tailcuts_clean(camera, image, picture_thresh=10, boundary_thresh=5)
cleaned = image.copy()
cleaned[~mask] = 0

%timeit hillas_parameters(camera, cleaned)
%timeit hillas_parameters(camera[mask], image[mask])
488 µs ± 12.2 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
866 µs ± 17.1 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
maxnoe commented 5 years ago

These numbers don't fit the ones reported recently by @watsonjj here: #969, so it seems this issue was solved. If not, please reopen.