I am using pyds9 to automatically load the fits images (for astronomy-related purposes).
I am able to configure all the other settings like scale, color and zoom level. For each image what I want to do is draw a small circle in a particular location that highlights that region. By default this color is green. How do I change this color?
Also is there a way to change the thickness of this circle? I am having issues with visibility. The green color is not clearly visible for all cmap and scale combination. Something like red would be better.
I looked at the XPAset commands. There is a way to do it. But I can't figure out how to do it in pyds9. Here is the link for all the XPAset commands: http://ds9.si.edu/ref/xpa.html#regions
The xpaset command is :
*$xpaset -p ds9 regions command '{circle 100 100 20 # color=red}'*
How do I translate this xpaset command to pyds9's d.set()
method ??
I mean something like : d.set('regions','fk5; circle(100,100,20") # color=red')
Following is the code that I am using:
import ds9
# x is the RA and y is the DEC
# for describing the location of astronomical objects
x = 200.1324
y = 20.3441
# the four FITS images to be loaded
image_list = ['img1.fits.gz','img2.fits.gz','img3.fits.gz','img4.fits.gz']
#initializing a ds9 window
d = ds9.ds9(target='DS9:*', start=True, verify=True)
for i in range(len(image_list)):
d.set('frame ' + str(i+1))
d.set('file ' + image_list[i])
d.set('cmap bb')
d.set('cmap invert')
d.set('scale zscale')
d.set('scale linear')
d.set('regions','fk5; circle('+str(x)+','+str(y)+',20")')
# This previous line draws a green circle with center at (x,y)
# and radius of 20 arc-sec. But the color is by default green.
# I want to change this to lets say red. How do I do it ???
# arranging the 4 images in tile format
d.set('tile')
for i in range(len(image_list)):
d.set('frame ' + str(i+1))
d.set('zoom to fit')
d.set('saveimage png myimagename.png')
# time to remove all the images from the frames
# so that the some new set of images could be loaded
for i in range(len(image_list)):
d.set('frame delete')