def gen_overview_plot_image(ax,imagefile,imgext=0,cubelayer=1,title='Img Title?',fontsize=6,lthick=2,alpha=0.5,
cmap='coolwarm'):
"""
Plotting commands for image (cube layer) overview plotting
--- INPUT ---
cubelayer If the content of the file is a cube, provide the cube layer to plot. If
cubelayer = 'fmax' the layer with most flux is plotted
"""
ax.set_title(title,fontsize=fontsize)
if os.path.isfile(imagefile):
imgdata = pyfits.open(imagefile)[imgext].data
if len(imgdata.shape) == 3: # it is a cube
imgdata = imgdata[cubelayer,:,:]
ax.imshow(imgdata, interpolation='None',cmap=cmap,aspect='equal', origin='lower')
ax.set_xlabel('x-pixel')
ax.set_ylabel('y-pixel ')
ax.set_xticks([])
ax.set_yticks([])
else:
textstr = 'No image\nfound'
ax.text(1.0,22,textstr,horizontalalignment='center',verticalalignment='center',fontsize=fontsize)
ax.set_ylim([28,16])
ax.plot([0.0,2.0],[28,16],'r--',lw=lthick)
ax.plot([2.0,0.0],[28,16],'r--',lw=lthick)
ax.set_xlabel(' ')
ax.set_ylabel(' ')
ax.set_xticks([])
ax.set_yticks([])
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
评论列表
文章目录