circles_trans

Read a set of X,Y,Radius values. The X,Y are assumed to have origin at 0,0 and they are rotated through an angle of THETA degrees. A plate scale is then applied (usually X,Y are in arcseconds, and the plate scale is in arcsec/pixel). Finally, a value of Xo,Yo is added to place the rotation center at some Xo,Yo value (the pixel location of the rotation center in an image, for instance).


Example 1
% cat xyr.arc
# Xarcsec  Yarcsec  Radarcsec 
# data 
0.0  10.0  1.0
10.0  0.0  1.0 

% circles_trans.sh xyr.arc 5.0 1.35  0.0 0.0 
       1.177       13.449        1.350
      13.449       -1.177        1.350

% circles_trans.sh xyr.arc -5.0 1.35 0.0 0.0 
      -1.177       13.449        1.350
      13.449        1.177        1.350

% circles_trans.sh xyr.arc 5.0 1.35 20.0 50.0  
      21.177       63.449        1.350
      33.449       48.823        1.350
Hence, we see that a POSITIVE angle rotates the points clockwise (CW) and a NEGATIVE angle rotates the points counter-clockwise (CCW). Often, I use this routine to generate circle regions that I want to overplot on an image displayed with ds9. Here is how that might be done:
 

circles_trans.sh circles.xyr $pa $ps $xc $yc > c.pix
circles_file_ds9.py c.pix red 1 > fibers.reg
cat fibers.reg | xpaset ds9 regions -format ds9




Back to SCO CODES page