circles_file_ds9.py

Read a file with lines of (x,y,radius) values (all in pixel units) and generate a ds9 regions file using a user-specified color and line width.

 

% circles_file_ds9.py --help
usage: circles_file_ds9.py [-h] [-v] arg1 arg2 arg3

positional arguments:
  arg1           XYR file name (lines have x,y,radius in pixels)
  arg2           color
  arg3           line_width

optional arguments:
  -h, --help     show this help message and exit
  -v, --verbose  Verbose responses
This routine can be embedded easily in various scripts for overplotting on images with ds9. One of my early applications of this was to paint a dot where the center of the VIRUS IHMP is located on to of an image. Here is an example to portion of a script (in this case the bash script called "mark_ihmp") that does this:
 
Here is the part of the script "mark_ihmp" we are discussing. 
#==========================================================================
# Always mark the IHMP center -   Sep2015
# prep the file to feed to the region generator
printf "$xc $yc 5\n" > ihmp_center.circle
circles_file_ds9.py ihmp_center.circle red 4 > ihmp-center.reg
# display the regions file
cat ihmp-center.reg | xpaset ds9 regions -format ds9
#==========================================================================

I could run all of this manually with command line calls 
like the following (presuming the image is already opened 
and displayed in a ds9 window): 

% echo "1000.0 390.0 5" > any_file_name  
% circles_file_ds9.py any_file_name red 4 > ihmp-center.reg 
% cat ihmp-center.reg | xpaset ds9 regions -format ds9 




Back to SCO CODES page