【发布时间】:2019-08-02 05:06:29
【问题描述】:
我需要获取 matplotlib 投影的转换后的 x,y 像素值。特别是这是一个天文世界坐标系转换,来自 fit 数据文件。数据文件提供了一个提供投影信息的标题,但我知道没有人在不知道我没有的信息的情况下直接使用它。这是当前代码:
image_detection = fits.open("hst_12311_08_wfc3_uvis_total_drz.fits")['SCI'].data
wlist = fits.open("hst_12311_08_wfc3_uvis_total_drz.fits")['SCI']
w = wcs.WCS(wlist.header)
mean, median, std = sigma_clipped_stats(image_detection, sigma=3.0)
iraffind = IRAFStarFinder(fwhm=3.0, threshold=5*std, exclude_border=True)
sources = iraffind(image_detection - median)
positions = (sources['xcentroid'], sources['ycentroid'])
apertures = CircularAperture(positions, r = 4.0)
fig = plt.figure(figsize=(8,8))
ax = fig.add_subplot(111, projection = w)
ax.imshow(transform(image_detection), cmap='gray_r', origin='lower')
# ax.colorbar()
apertures.plot(color='blue', lw=1.5, alpha=0.5)
plt.savefig("apertures.pdf")
ax.xlabel('Right Ascension')
ax.ylabel('Declination')
plt.show()
我所追求的是那些以 x,y 给出的位置值,转换为世界坐标,由投影绘制。我检查了 WCS 上的 astropy 文档,不清楚如何获得某些值,例如与原点有关的值。使用的 fit 文件可从 Hubble Legacy Archive 中免费获得,但任何 x,y 数据在技术上都应该是合适的。 fit 标头包含上述转换的所有值,尽管我不完全理解它们的用法。我认为这有点远,但如果你能提供帮助,谢谢。
【问题讨论】:
-
您希望将 FITS 图像中的 x,y 映射到 RA,Dec 还是绘图坐标中的 x,y 映射到 RA,Dec ?
-
我正在寻找 x,y 转换后的数据,即 RA,Dec. 中的 x,y 值是什么。我不确定这与绘图坐标数据不同,因为它们按像素排列并且应该是相同的。
标签: python matplotlib projection astropy