#!/bin/csh -f #+ # by3 -- acquire images in 3-pos pattern in DETECTOR coords w/ random dither # # Purpose: # Acquire a sequence of images using 3-positions in y # plus an optional random offset. # # Usage: # by3 dy [dx] # # Arguments: # dy = size of the step in the "y" direction [arcsec] # dx = size of the random dither in x [arcsec, default=0] # # Output: # # Restrictions: # # Exit values: # 0 = normal completion # 1 = wrong number of arguments # 2 = arguments are not valid numbers # # Example: # 1) Acquire 3 images using 1-arcsec steps in y: # by3 1 # Images are acquired at: (0.00,0.00), (0.00,1.00), (0.00,-1.00) # # 2) Acquire 3 images using 10-arcsec steps in y: # by3 10 # Images are acquired at: (0.00,0.00), (0.00,10.00), (0.00,-10.00) # # 2) Acquire 3 images using 10-arcsec steps in y with # random 5 arcsec dither: # by3 10 5 # Images are acquired at: (-1.58,0.00), (-2.54,10.00), (2.76,-10.00) # #- # Modification history: # 2003-Apr-28 GDW Original version #----------------------------------------------------------------------- set buf = $0 set cmd = $buf:t set usage = "Usage: $cmd dy [dx]" set dx = 0 set debug = 0 set foo = "" # define the array of offsets... set yoff = ( 0 1 -1) # parse flags... while ( $#argv > 0 ) # check for debug... if ( "$1" == "-debug" ) then set debug = 1 shift printf "DEBUG MODE ENABLED\n" set foo = "echo" # set to "echo" for testing purposes continue endif # no flags found; so quit processing flags... break end # verify args... if ( $#argv < 1 || $#argv > 2 ) then printf "$usage\n" exit 1 endif # grab arguments... if ( $#argv >= 1 ) then set dy = $1 shift endif if ( $#argv >= 1 ) then set dx = $1 shift endif # verify float-ation... is_float $dx > /dev/null if ( $status ) then echo "ERROR -- dx must be a valid number" exit 2 endif is_float $dy > /dev/null if ( $status ) then echo "ERROR -- dy must be a valid number" exit 2 endif # save starting location... $foo markbase onintr last @ i = 1 @ n = $#yoff while ( $i <= $n ) # generate random number... set r = `rand` set xx = `calc "$dx*(2.*($r-0.5))"` # compute new position... set yy = `calc "$dy*$yoff[$i]"` # move to appropriate location in absolute coordinate system... $foo mxy -abs $xx $yy # print message... printf "----------------------------------------\n" printf "Position $i at (%.2f,%.2f)\n" $xx $yy printf "----------------------------------------\n" # take image... $foo goi # increment... @ i++ end last: $foo gotobase printf "Done.\n" $foo bells 3