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
评论列表
文章目录