我有从以下位置获得的天空区域的 4 个角的坐标 标题fits
带有astropy.wcs
的图像以及用于获取坐标的投影。
import astropy.wcs as wcs
import astropy.fits as fits
hdu=fits.open('filenmae.fits')
w=wcs.WCS(hdu[0].header)
print(w)
哪些输出:
[out]: WCS Keywords
Number of WCS axes: 2
CTYPE : 'RA---ZPN' 'DEC--ZPN'
CRVAL : 308.45901 41.424847
CRPIX : 6010.0186 -1881.9392
CD1_1 CD1_2 : 1.0754576e-07 -5.5698074e-05
CD2_1 CD2_2 : 5.5690351e-05 6.8120784e-08
NAXIS : 4119 4119
我从中得到了场地角落的坐标:
corners=w.calc_footprint()
print(corners)
[out]: [[308.318759 41.08966578]
[308.01327548 41.08869031]
[308.01293347 41.31890048]
[308.31905451 41.31954629]]
如何在尊重投影效果的同时检查随机坐标是否在由坐标坐标定义的区域内(如输出所示,使用的投影ZPN
(?
一般来说,如果您有一个可以通过 WCS 转换为天空坐标的局部坐标系(例如图像像素(,那么一种策略是将"随机坐标"转换为局部像素坐标,并在该平面直线坐标系中进行区域测试。