【发布时间】:2016-06-13 22:39:31
【问题描述】:
我正在使用healpy.query_polygon 来查找对应于矩形FOV 的像素索引。但是,返回的索引与我的输入不匹配 - 在 healpy 空间中创建一个比 FOV 大约 100 倍的多边形(或返回约 14000 像素而不是预期的约 30 像素)。
query_disc 函数按我的预期工作,但是,这不是我想要使用的函数。
对应的输出: Top(disc), bottom (polygon)
对于 hp.query_disc:
disc_center = astropy.coordinates.spherical_to_cartesian(1, np.deg2rad(47.3901), np.deg2rad(319.6428))
#(<Quantity 0.5158909828269898>, <Quantity -0.4383926760027675>, <Quantity 0.7359812195055898>)
radius = 0.06208
qd = hp.query_disc(128,disc_center,radius)
#plotting
for ind in range(len(prob)):
if ind in qd:
prob[ind] = 1
else:
prob[ind] = 0
对于 hp.query_polygon:
ra_poly, dec_poly = (array([ 48.51458308, 48.51458308, 46.20781856, 46.20781856]), array([ 317.00403838, 322.28167591, 317.11703852, 322.16867577]))
xyzpoly = astropy.coordinates.spherical_to_cartesian(1, np.deg2rad(dec_poly), np.deg2rad(ra_poly))
#xyzpoly = array([[ 0.48450204, 0.52400015, 0.50709248, 0.5465906 ],
[-0.45174162, -0.40526109, -0.47093848, -0.42445795],
[ 0.74912435, 0.74912435, 0.72185467, 0.72185467]])
qp = hp.query_polygon(128,xyzpoly)
#plotting
for ind in range(len(prob)):
if ind in qp:
prob[ind] = 1
else:
prob[ind] = 0
谁能解释这种差异?总的来说,我没有看到任何错误,除非顶点被错误地实现到函数中。
【问题讨论】:
-
如果您不混淆 RA 和 dec,它可能会有所帮助;复制粘贴第二个代码块的前两行会导致错误(虽然很容易修复)。请在发布时验证您的示例代码,以避免混淆。