spherematch is a small library of spherical matching routines. There are two parts to the library. The first part is based on healpix and has some handy memory-saving features that can be useful.
- Transparent wrapping of lon/lat to x/y/z conversions.
- Default settings for cKDTree for best performance when matching lists of objects within a few arcseconds.
- Self-matching of objects into clusters with clever sorting to ensure consistent outputs regardless of input order.
- Can be used as a context manager for no-hassle memory cleanup.
When using this matcher code for
DM-33279, I am able to match all the isolated stars from HSC RC2 tract 9813 (117 visits) in 6 bands in 27 seconds on lsst-devl03, with peak memory usage of 9.7Gb. For DC2 deep tract 4431 (1186 visits) I can match 6 bands in 55 seconds, with peak memory usage of just under 15Gb.
Note that the relevant code is less than 450 lines of python + tests. Therefore, it would be possible to simply copy this code into the science pipelines ("vendor" the code), which is what I had considered. However, there are considerable advantages to using the version from conda-forge which is being maintained by a team that is active in DESC.