B612-Asteroid-Institute / precovery

Fast precovery of small body observations at scale
BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

Add higher nside HEALpixel IDs to PrecoveryCandidate #24

Closed moeyensj closed 2 years ago

moeyensj commented 2 years ago

PrecoveryCandidate HEALpixel IDs are currently set to the HEALpixel ID of the HealpixFrame. If we decide to re-index the observations to a higher nside parameter then Healpixel IDs from previous versions will not match the new ones. The solution is to return Healpixel IDs with an nside parameter significantly higher than the nside parameters with which we would ever consider indexing the observations. At this point matching Healpixel IDs from a higher nside parameter to a lower nside parameter is a simple rshift.

For example,

import healpy as hp

k = 15
nside_15 = 2**k
nside_17 = 2**(k + 2)

id_15 = hp.ang2pix(nside_15, 0, 0, nest=True, lonlat=True)
id_17 = hp.ang2pix(nside_17, 0, 0, nest=True, lonlat=True)

print("id (k=15): ", id_15)
print("id (k=17): ", id_17)
print("id (k=17) >> 2 >> 2:", id_17 >> 2 >> 2)

Which returns:

id (k=15):  5100273664
id (k=17):  81604378624
id (k=17) >> 2 >> 2: 5100273664