#! /bin/csh -f # # adjust the goniometer for a particular pin length # # # goto Setup Help: cat << EOF usage: pinlength.com 18mm where: 18mm is the length of your pin see the touch screen for details EOF exit 9 Setup: if(! $?beamline) then # default to beamline this computer belongs to setenv beamline `beamline.com` if($status) then echo "ERROR: $beamline" exit 9 endif endif # pin length when "z" motor is 0 set zero = 18.2 if("$beamline" == 1231) set zero = 26.2 # interpret the command line set pinlength = "" foreach arg ( $* ) if( "$arg" =~ [0-9]*) then set test = `echo $arg | awk '{l=$1+0} l>5 && l<30{print l}'` if("$test" != "") set pinlength = $test endif end if ("$pinlength" == "") goto report set z = `echo $pinlength $zero | awk '{print $2-$1}'` set newz = `sample.com to 0 0 $z | awk '{print $7}'` set newpinlength = `echo $z $zero | awk '{print $2-$1}'` set toofar = `echo $pinlength $newpinlength | awk '{print (($1-$2)^2 > 0.1)}'` if ("$toofar") then set BAD = "goniometer did not move" goto exit endif report: set z = `sample.com | awk 'NF==7{print $7}' | tail -1` set pinlength = `echo $z $zero | awk 'NF==2{printf "%.1f", $2-$1}'` if ("$pinlength" != "") then echo "goniometer is set for $pinlength mm pins" else set BAD = "unable to read pin length" goto exit endif exit: if ($?BAD) then echo "ERROR: $BAD" exit 9 endif