在针对少数特定源的测光项目时,有时会需要绘制源的Finding Chart图,我们一般使用aplpy。首先找一张fits图像到http://nova.astrometry.net/upload做定标,获取WCS。
import aplpy gc = aplpy.FITSFigure('fits_filename') gc.show_grayscale(invert=True) # 使用invert是白底,False为黑底 # 需要使用颜色时 gc.show_colorscale(cmap='***') # 比较简单的标注target和ref时使用pyplot即可,坐标使用pixel坐标 plt.scatter(x,y,c='',edgecolor='cyan',s=30)
当然,aplpy包自身也带了一些标记和zoom手段:
# 将图像以目标源为中心进行缩放,需要注意三个参数都是以度为单位的 gc.recenter(x, y, radius) # 标记target及ref等,coords_frame是可选参数,world or pixel,选择world坐标时前三个参数单位都为度 gc.show_circles(x, y, radius, coords_frame, color)
# 添加文字注释,relative用来标注是否使用WCS或是其他坐标
gc.add_label(x,y,text,size,relative)
# 添加colorbar
gc.add_colorbar()
# 设置坐标ticks
gc.set_xaxis_coord_type('scalar':标量坐标,‘longitude’ or ‘latitude’:角度坐标)
# 保存,dpi设置太高比较慢
gc.save(filename,dpi,format='eps' or 'png' or ...)
参考链接:https://aplpy.readthedocs.io/en/stable/fitsfigure/quickstart.html