# # %W% %G% CSS # # "Spec" Release %R% # # Copyright (c) 1999 # by Certified Scientific Software. # All rights reserved. # Copyrighted as an unpublished work. # ######################################################################### # # # Additional APS CMC-CAT surf spectrometer macros: # The order in mA[] determines the order in which the motors are # displayed. _assign_mA assigns the remaining motors to mA as ordered # in the config file rdef _assign '{ mA[0]=chi mA[1]=ih mA[2]=sh mA[3]=oh mA[4]=tth mA[5]=stth mA[6]=sth mA[7]=phi mA[8]=ir mA[9]=or _numgeo = 5 _assign_mA 10 }' _assign # A macro called by "wh", "ca" and "ci" to display important # geometry quantities. def _var ' printf("\nH = %.5g K = %.5g L = %.5g\n", H, K, L) printf("ALPHA = %.5g BETA = %.5g", ALPHA, BETA) printf(" LAMBDA = %g\n\n", LAMBDA) _mot 10 ' # _hkl_lim does limit checking using "_chk_lim" for motors used # in general HKL scan. rdef hkl_lim ' _chk_lim chi A[chi] _chk_lim ih A[ih] _chk_lim ir A[ir] _chk_lim sh A[sh] _chk_lim dth A[th] _chk_lim oh A[oh] _chk_lim or A[or] _chk_lim tth A[tth] _chk_lim phi A[phi] _chk_lim sth A[sth] _chk_lim sth A[stth] ' # inverse of `ca' - calculate HKL from angles rdef ci ' if ($# != 4) { print "Usage: ci chi or sth stth" exit } { A[chi] = $1; A[or] = $2; A[sth] = $3; A[stth] = $4; } calcHKL onp printf("\nCalculated HKL:\n") _var offp ' rdef wab 'uwm chi ih ir sh oh or' rdef wth 'uwm phi th tth sth stth' # beta scan rdef bscan ' if ($# != 4) { print "Usage: bscan beta_start beta_finish intervals time" exit } abscan ALPHA ALPHA $1 $2 $3 $4 ' # sample height scan (tracks detector position) rdef shscan ' if ($# != 3) { print "Usage: shscan halfwidth intervals time" exit } d2scan sh -($1) $1 oh -2*($1) 2*($1) $2 $3 ' # list additional geometry parameters def _pa ' printf(" qtau = %.5g\n\n",g_qtau) printf(" Eta = %.5g\n\n",g_Eta) printf("Distances (in mm):\n") printf(" Crystal to input rotation axis = %g\n", g_l1) printf(" Crystal to sample center = %g\n", g_l2) printf(" Sample to output rotation axis = %g\n", g_l3) printf("Sample-table tracking: "); printf(g_trck? "on.\n":"off.\n") printf("Flight path mode: ") printf(g_fpmode? "%g mm from axis.\n":"concentric.\n", g_fpht) ' def _startgeo ' setlengths settrack setfp ' def setlengths ' if ($# == 3) { _1 = $1; _2 = $2; _3 = $3 } else if ($# == 0) { print "\nEnter lengths (in mm):" _1 = getval(" Crystal to input rotation axis", g_l1) _2 = getval(" Crystal to sample center", g_l2) _3 = getval(" Sample to output rotation axis", g_l3) } else { print "Usage: setlengths or setlengths l1 l2 l3" exit } gpset _1 g_l1 gpset _2 g_l2 gpset _3 g_l3 printf("\n") g_qtau = getval(" qtau", g_qtau) g_Eta = getval(" Eta", g_Eta) ' def settrack ' if ($# == 1) { _1 = $1 } else if ($# == 0) { _1 = yesno("\nTrack sample table", g_trck) } else { print "Usage: settrack [1|0]" exit } gpset _1 g_trck ' def setfp ' if ($# == 1 || $# == 2) { _1 = $1 _2 = $2 } else if ($# == 0) { _1 = yesno("\nUse offset flight-path mode", g_fpmode) if (_1) _2 = getval(" Flight path height wrt axis", g_fpht) } else { print "Usage: setfp [1 [height]]|[0]" exit } gpset _1 g_fpmode if (g_fpmode && ($# == 2 || $# == 0)) { gpset _2 g_fpht } ' def _savegeo ' printf("g_l1=%g\n",g_l1) printf("g_l2=%g\n",g_l2) printf("g_l3=%g\n",g_l3) printf("g_qtau=%g\n",g_qtau) printf("g_Eta=%g\n",g_Eta) printf("g_trck=%g\n",g_trck) printf("g_fpmode=%g\n",g_fpmode) printf("g_fpht=%g\n",g_fpht) ' # These are the default choices. def g_l1 'G[5]' # distance crystal to input arm elevator def g_l2 'G[6]' # distance crystal to sample center def g_l3 'G[7]' # dist. sample center to output elevator def g_qtau 'G[8]' # monochromator reciprocal lattice vector def g_Eta 'G[9]' # upward beam tilt (radians) def g_trck 'G[10]' # sample table tracking def g_fpmode 'G[11]' # flight path mode (0=concentric) def g_fpht 'G[12]' # flight path height above or axis def defpar ' g_l1 = 558.8 # CHECK distance crystal to input arm elevator g_l2 = 1238.25 # distance crystal to sample center g_l3 = 685.8 # distance sample center to output elevator g_Eta = 0.006 # upward beam tilt (radians) g_trck = 1 # track sample side g_fpmode = 0 # concentric flight path g_fpht = 80 # flight path height above or axis ' if ((whatis("G[8]")>>16)&0x0800) { # test for unset lattice constants g_qtau=1.923633 } if ((whatis("G[5]")>>16)&0x0800) { # test for unset lengths printf("Warning: Using default lengths.\n") # Set lengths defpar } # end