Reputation: 41
I have a cosmic microwave background map that I am reading with healpy
. I am interested in extracting the pixel strips at +10 degrees latitude in the northern hemisphere and -10 degree latitude in the southern hemisphere. I could easily extract the pixels from +10 degree north using hp.ang2pix()
function. But in the southern hemisphere I am finding it difficult to define the angle, because theta varies from 0 to pi.
Should I rotate the coordinate system of the sphere by pi radians in order to extract the pixel from 10 degree southern hemisphere?
I am using the following program to extract pixel strip from northern hemisphere:
import numpy as np
import healpy as hp
fname = 'COM_CMB_IQU-070-fgsub-sevem-field-Pol_1024_R2.01_full.fits'
tmap = hp.read_map(fname)
nside = hp.get_nside(tmap)
x = hp.ang2pix(nside, np.deg2rad(10) , [0, 2*3.14])
print(x)
Upvotes: 1
Views: 223
Reputation: 3877
You can do the following, using a width eps
, to define your ring of constant latitude:
import healpy as hp
import numpy as np
nside = 128
npix = hp.nside2npix(nside)
x = np.arange(npix)
# All in degrees
glon, glat = hp.pix2ang(nside, np.arange(npix), lonlat=True)
eps = 0.5
# Set up the mask
mask = (glat < 10. + eps) & (glat > 10. - eps)
mask |= (glat > -10. - eps) & (glat < -10. + eps)
hp.mollview(x*mask)
That gives me the following:
Upvotes: 0