我需要得到matplotlib投影的转换后的x,y像素值。特别是这是一个来自fits数据文件的astropy世界坐标系转换。数据文件提供了一个提供投影信息的头文件,但是我知道没有人在不知道我没有的信息的情况下直接使用它。以下是当前代码:
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文档,不清楚某些值是如何获得的,比如那些与原点有关的值。使用的fits文件可以从哈勃遗留档案免费获得,尽管任何x,y数据在技术上都应该是合适的。fits头包含前面提到的转换的所有值,但是我不完全理解它们的用法。我想这有点遥不可及,但如果你能帮忙,谢谢你。在
一旦有了},例如
WCS
对象,就可以使用两种方法从x、y->;RA、Dec或相反的方法进行转换。它们分别是w.all_pix2world()
和{这将产生输出(允许舍入…)
^{pr2}$其中RA,Dec是以度为单位的。 最好使用}多项式)来应用所有的变换(通常哈勃仪器就是这样)
all_pix2world
而不是wcs_pix2world
来应用所有的变换(核心WCS从像素到RA的变换,CDi_j
矩阵和CRPIXi/CRVALi
以及任何{相关问题 更多 >
编程相关推荐