#!/bin/csh -f #+ # fcsmov -- move a feature to a given position on the DEIMOS FCS image # # Purpose: # Given the starting pixel coordinates of an object on a # DEIMOS FCS image, and destination coordinates, # compute and apply the required motor move to reposition # the object as desired. # # Usage: # fcsmov [-n] x1 y1 x2 y2 # # Arguments: # -n = no move, only print the required shift # x1 = starting column location of object [pixels] # y1 = starting row location of object [pixels] # x2 = ending column location of object [pixels] # y2 = ending row location of object [pixels] # # Output: # # Exit values: # 0 = normal completion # 1 = wrong number of arguments # 2 = arguments not valid floating-point numbers # # Example: # 1) Move a feature at guider pixel (100,200) to pixel (300,400): # fcsmov 100 200 300 400 # # 2) Display the motor moves required to shift a target at # pixel (100,200) to the pixel (300,400) without moving the telecope: # fcsmov -n 100 200 300 400 #- # Modification history: # 2007-Jun-13 GDW Original version # 2007-Jun-15 MK Added CCD switch to account for # different coordinate systems # 2012-Jan-24 GDW Added check for fcsmode #----------------------------------------------------------------------- set cmd = `basename $0` #define constants #midx defines the midpt between CCD1 and CCD2 set midx = 1200 # check for no-move flag... if ( "$1" == "-n" ) then set string = "Required shift is" set move = 0 shift else set string = "Moving" set move = 1 endif # check args... if (${#argv} != 4) then echo "Usage: fcsmov [-n] x1 y1 x2 y2" exit 1 endif # verify floating-point values... is_float $* > /dev/null if ( $status ) then echo "ERROR: Arguments must be valid floating-point numbers" exit 2 endif # verify FCS is Off... set undesired = "Track" set fcsmode = `show -s deifcs -terse fcsmode` if ( $move && "$fcsmode" == "$undesired" ) then printf "[$cmd] ERROR: FCSMODE is currently set to '$fcsmode'.\n\tPlease stop FCS and try again.\n" exit 1 endif #determine the appropirate offset for the Y direction (dy) #If CCD1 is used (x1 <= midx) then the ydiff is a positive move #If CCD2 is used (x1 > midx) then the ydiff is a negative move if ($1 <= $midx) then set dy = `calc "$4 - $2"` set CCD = "CCD1" else set dy = `calc "$2 - $4"` set CCD = "CCD2" endif # used as an explaination to observers set dyout = `calc "$4 - $2"` #determine the appropriate offset for the x direction (dx) set dx = `calc "$3 - $1"` echo "$string $dx $dyout" if ( $move) then echo "Because x1 y1 are from $CCD" echo "Actual command issued is" echo " fcsxy $dx $dy" fcsmove $dx $dy endif