make3FGLxml.py 文件源码

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

项目:flaapluc 作者: jlenain 项目源码 文件源码
def BuildRegion(sL,Sources):
    myreg=open(sL.regFile,'w')#note that this will overwrite previous region files of the same name
    myreg.write('# Region File format: DS9 version ?')#I don't actually know, but I think it's one of the later ones, need to verify
    myreg.write('\n# Created by make3FGLxml.py')
    myreg.write('\nglobal font="roman 10 normal" move =0')
    for k in Sources.keys():
        src=Sources[k]
        #get color based on if the source is free or not
        color=('green' if src['free'] else 'magenta')
        if src['E']:#if the source is extended, always have the point be a "big" box
            myreg.write('\nJ2000;point(%.3f,%.3f) # point = box 18 color = %s text={%s}'%(src['ra'],src['dec'],color,k))
        else:#if the source is a point source, choose the point type based on spectral model
            ptype=('cross' if src['stype']=='PLSuperExpCutoff' else 'diamond' if src['stype']=='LogParabola' else 'circle')
            myreg.write('\nJ2000;point(%.3f,%.3f) # point = %s 15 color = %s text={%s}'%(src['ra'],src['dec'],ptype,color,k))
    myreg.close()
    return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号