Refactor Python implementation of BAYESTAR adaptive grid as a reusable function
There is a Python implementation of the BAYESTAR adaptive grid algorithm in https://git.ligo.org/lscsoft/ligo.skymap/-/blob/v1.0.7/ligo/skymap/kde.py#L325-348.
Refactor it as a standalone function that takes as arguments:
- the initial nside value
- the number of rounds
- a callable that returns the (possible vector valued) pixel value for a given coordinate
- a callable that returns the sort key for a pixel value
and returns a multi-order map as an Astropy table.
The function might live in https://git.ligo.org/lscsoft/ligo.skymap/-/blob/main/ligo/skymap/moc.py.