Python 获取healpy视图上特定值的坐标
是否可以从healpy-mollview图中找到hitmap特定值的坐标 例如: 如果我有一个平滑的hitmap,并且想要使用掩码:Python 获取healpy视图上特定值的坐标,python,coordinates,masking,healpy,Python,Coordinates,Masking,Healpy,是否可以从healpy-mollview图中找到hitmap特定值的坐标 例如: 如果我有一个平滑的hitmap,并且想要使用掩码: mask = (hitmap > 2.054) & (hitmap < 2.056) 然后,是否有可能通过使用遮罩找到与mollview plot中满足遮罩要求的像素对应的坐标(lon,lat) 非常感谢 最好的方法是: 这将为您提供地图中每个像素的所有坐标(l,b)列表。要仅获取遮罩中的遮罩,只需使用: glons_eff = glons[
mask = (hitmap > 2.054) & (hitmap < 2.056)
然后,是否有可能通过使用遮罩找到与mollview plot中满足遮罩要求的像素对应的坐标(lon,lat)
非常感谢 最好的方法是: 这将为您提供地图中每个像素的所有坐标(l,b)列表。要仅获取遮罩中的遮罩,只需使用:
glons_eff = glons[mask]
glats_eff = glats[mask]
非常感谢。这是将mollview绘图与另一个绘图重叠的好方法吗?例如,使用:hp.projplot(glons_eff,glats_eff,lonlat=True),我尝试使用healpy.projaxes.CartesianAxes.contour()绘制一个值为2.055(在掩码中的两个值之间)的轮廓,但这似乎对我不起作用……目前healpy中没有用于绘制轮廓的内置函数,您所指的函数在最新的healpy版本中不存在。
import healpy as hp
import numpy as hp
# Get the nside and number of pixels in your map
nside = hp.get_nside(mask)
npix = hp.nside2npix(nside)
# Use pix2ang to get the (l, b) coordinates for each pixel
glons, glats = hp.pix2ang(nside, np.arange(npix), lonlat=True)
glons_eff = glons[mask]
glats_eff = glats[mask]