#! /bin/csh -f # # complete beamline calibration and tune-up # # # put beamline into a well-known state cryojet.com sample 10.0 cryojet.com shroud 10.0 divergence.com 2 0.35 wave.com 11111 scintillator.com out diode.com out backlight.com out attenuator.com Al out attenuator.com Se out attenuator.com Cu out light.com 1 100% light.com 2 0% phi.com 0 pinlength.com 18 cover.com on distance.com 600 stage.com down autoscale.com if($status) then set BAD = `autoscale.com | tail -1` goto exit endif # make sure M1 is set right? #tune_M1.com wave.com Cu tune_rock.com # run the monochromator calibration mono_calib.com Cu if($ status) then set BAD = "problem calibrating monochromator." goto exit endif realign: realign.com nofinish if($ status) then set BAD = "problem aligning microscope." goto exit endif ( killall animate ) >& /dev/null ( killall gnuplot_x11 ) >& /dev/null # focus the microscope? center.com faceon.com 10 phi.com by 90 set centered = `sample.com | awk '{print $5,$6}'` focus.com set focused = `sample.com | awk '{print $5,$6}'` set diff = `echo $centered $focused | awk '{printf "%d", 1000*sqrt(($1-$3)^2+($2-$4)^2)}'` echo "microscope is $diff um out-of-focus" if($diff > 30) then # this is going to be annoying sample.com to $centered phi.com by -90 cat << EOF please adjust the microscope so that the part of the wire that is in the crosshairs is in focus. Press "Enter" when you have done this. EOF echo -n "->" set in = ( $< ) goto realign endif direct_beam: # find the direct beam direct_beam.com 200mm if($ status) then set BAD = "problem finding beam center." goto exit endif leak_check: # now check the beamstop sample.com 0 0.4 snapshot.com /data/${USER}/bs_0_001.img 0.1s osc=1 600mm # check for overloads set overloads = `adsc2pgm /data/${USER}/bs_0_001.img | awk '/intensity scale set to/{print ($NF < 1)}'` if("$overloads" != 0) then set BAD = "beamstop out of position" goto exit endif beamstop: snapshot.com /data/${USER}/bs_0_001.img 10s osc=1 600mm find_backstop.com /data/${USER}/bs_0_001.img | tee backstop.log if (! $status) then set delta = `awk '/off-center/{print $3/2,$4/2}' backstop.log` set dist = `echo $delta | awk '{printf "%d", sqrt($1^2+$2^2)*1000}'` if ( $dist < 20 ) goto fluorescence display marked.png & echo "shall we make this move? [Yes]" echo -n "->" set in = ( $< ) if ("$in" =~ [Nn*]) goto finish beamstop.com $delta goto beamstop endif fluorescence: # check that the fluorescence scan works stage.com down echo "\n\n\n\n\n\n\n\n\n\n" echo "please mount the Selenium reference (right next to YAG jig)" echo "press when you have done this." echo -n "->" set in = ( $< ) echo "Centering..." autocenter.com |& awk '{printf "."}' echo "" echo "\n\n\n\n\n\n\n\n\n\n" echo "please do the fluorescence scan in BLU-ICE" echo "press when you have done this." echo -n "->" set in = ( $< ) finish: stage.com down sample.com to 0 0 1 echo "please put the YAG jig back into its holder." echo "you may now commence collecting data." exit: if ($?BAD) then cat << EOF Automatic alignment failed... $BAD call 9-928-5556 EOF endif exit