def create_simpleDS9region(outputfile,ralist,declist,color='red',circlesize=0.5,textlist=None,clobber=False):
"""
Generate a basic DS9 region file with circles around a list of coordinates
--- INPUT ---
outputfile Path and name of file to store reigion file to
ralist List of R.A. to position circles at
declist List of Dec. to position circles at
color Color of circles
size Size of circles (radius in arcsec)
text Text string for each circle
clobber Overwrite existing files?
"""
if not clobber:
if os.path.isfile(outputfile):
sys.exit('File already exists and clobber = False --> ABORTING')
fout = open(outputfile,'w')
fout.write("# Region file format: DS9 version 4.1 \nfk5\n")
for rr, ra in enumerate(ralist):
string = 'circle('+str(ra)+','+str(declist[rr])+','+str(circlesize)+'") # color='+color+' width=3 '
if textlist is not None:
string = string+' font="times 10 bold roman" text={'+textlist[rr]+'}'
fout.write(string+' \n')
fout.close()
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
评论列表
文章目录