ds9regget.sh
Updated: Nov07,2019

This OTW code serves as a general reader of ds9 region files. The user specified what is desired from what file, and the result is written to standard out. The results can be directed to files for further processing in a script. The examples below were run in the TEST_DATA directory: /Test_Data_for_Codes/T_runs/ds9+xpa/ex1. For completeness, I show the input file (ds9.reg) that was used as input. By changing the input arguments we get a variety of different lists from this file.

 
% ds9regget.sh ds9.reg any any  
   477.99    523.99    129.00     28.00     73.95   ellipse    red        {a.test.ellipse}..............
   673.00    470.00     40.00     20.00      0.00   ellipse    green      ..............................
   486.00    559.50     20.00   circle     green      {NGC7793}.....................
   287.99    444.49     45.68   circle     cyan       ..............................
   698.00    770.00    514.00    607.00   ellipse    magenta    {sky_box_#23}.................
   259.00    333.00    435.00    478.00   ellipse    blue       ..............................
   571.99    752.99    319.99    370.99   ellipse    blue       {Here.is.a.blue.box}..........
   226.99    635.99    656.01    579.99   line       black      {a.black.ine.is.here}.........

% ds9regget.sh ds9.reg circle any
   486.00    559.50     20.00   circle     green      {NGC7793}.....................
   287.99    444.49     45.68   circle     cyan       ..............................

% ds9regget.sh ds9.reg line black
   226.99    635.99    656.01    579.99   line       black      {a.black.ine.is.here}.........

% ds9regget.sh ds9.reg box any
   698.00    770.00    514.00    607.00   ellipse    magenta    {sky_box_#23}.................
   259.00    333.00    435.00    478.00   ellipse    blue       ..............................
   571.99    752.99    319.99    370.99   ellipse    blue       {Here.is.a.blue.box}..........

% ds9regget.sh ds9.reg text red 
   606.71    320.00   text       red        {CaII_K}......................
  1504.64    320.00   text       red        {Fe4383_L}....................
   942.16    320.00   text       red        {H_delta}.....................

% cat ds9.reg 
# Region file format: DS9 version 4.1
# Filename: a.fits
global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1
image
ellipse(477.994,523.9932,129,28,73.945576) # color=red text={a test ellipse}
ellipse(673,470,40,20,0)
circle(486,559.5,20) text={NGC7793}
circle(287.98943,444.49128,45.676056) # color=cyan
box(734,560.5,72,93,0) # color=magenta text={sky_box_#23}
box(296,456.5,74,43,0) # color=blue
box(662.48975,345.49333,181,51,360) # color=blue text={Here is a blue box}
line(226.99034,635.98906,656.00689,579.99345) # line=0 0 color=black text={a black ine is here}
# text(1504.64,320) textangle=90 color=red font="helvetica 16 normal roman" text={Fe4383_L}
# text(674.7,320) textangle=90 color=cyan font="helvetica 16 normal roman" text={CaII_H}
# text(942.16,320) textangle=90 color=red font="helvetica 16 normal roman" text={H_delta}





Back to SCO CODES page