tdose_utilities.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:TDOSE 作者: kasperschmidt 项目源码 文件源码
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([])

# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号