import healpy as hp
import numpy as np
lonlat=True
switches ang2vec
from requiring colatitude \(\theta\) and longitude \(\phi\) in radians to longitude and latitude in degrees (notice that also the order changes)
# in degrees
= 60
lon = 30
lat = hp.ang2vec(lon, lat, lonlat=True) vec
= 256
nside = hp.query_disc(nside, vec, radius=np.radians(20))
large_disc = hp.query_disc(nside, vec, radius=np.radians(8))
small_disc = hp.query_disc(nside, vec, radius=np.radians(2)) tiny_disc
query_disc
returns a list of pixels, by default in RING ordering, let’s check their length:
list(map(len, [large_disc, small_disc, tiny_disc]))
[23715, 3829, 237]
Create a map and plot it in Mollweide projection
= np.zeros(hp.nside2npix(nside)) m
= 1
m[large_disc] = 2
m[small_disc] = 3 m[tiny_disc]
hp.mollview(m) hp.graticule()
0.0 180.0 -180.0 180.0
The interval between parallels is 30 deg -0.00'.
The interval between meridians is 30 deg -0.00'.