#%TITLE% LIN2TH.MAC
#%NAME%
# Sets up a 2th motor in angle for a linear translation stage.
#%CATEGORY% Positioning
#%DESCRIPTION%
# A very simple macro set to define an angular 2th motor for a linear
# translation stage. The linear tth real motor and the tth angular
# pseudo motor can be moved and read by the user.
# The detector mounted on the translation stage is mecanically coupled
# to the source to keep the radial distance constant all the time.
# The calibration can be simply done with an energy dependent detector and
# the bragg law. You can not set the angular motor, but you have to
# set the values for the real motor (lin tth).
#
#%EXAMPLE%
#%DL%
#%DT% tlsetup 987.07 "twot" "lintwot" %DD%
# The distance source-detector is set to 987.07 mm. The angular tth
# motor is called twot and the linear motor lintwot.
#%DT% mv twot 20 %DD%
# The linear stage is moved so the reflected angle will be 20 degrees.
#%XDL%
#%SETUP%
# The linear tth motor must be configuered as a real motor. The
# angular tth motor must be configured with spec's configuration
# editor and its controller type set to NONE.
#%END%
def tl_getangles '
A[$1]=asin(A[$2]/TL_LEN)*180/PI
TL_OLDPOS[$1]=A[$1]
TL_OLDPOS[$2]=A[$2]
'
def tl_moveall '
if (TL_OLDPOS[$2] != A[$2]) {
A[$1]=sin(A[$2]/180*PI)*TL_LEN
}
'
#%UU% [distance det-sample] [tth-angle-mne] [tth-lin-mne]
#%MDESC%
# configures the lin tth motor. The radial distance is constant in
# this setup and given as the first parameter.
# tthlin = sin(tth)*distance
def tlsetup '
global TL_LEN TL_TWOT TL_TWOTLIN TL_OLDPOS
if (!$#) {
TL_LEN = getval ("Radial distance detector - sample",TL_LEN)
TL_TWOT = getval ("Two Theta angle motor mnemonic",TL_TWOT)
TL_TWOTLIN = getval ("Two Theta linear motor mnemonic",TL_TWOTLIN)
}
else {
TL_LEN = $1
TL_TWOT = "$2"
TL_TWOTLIN = "$3"
}
{
pstring = sprintf("%s none none tl_getangles none none none none %s",TL_TWOT,TL_TWOTLIN)
pseudosdef pstring
pstring = sprintf("%s tl_moveall none none none none none none %s",TL_TWOTLIN,TL_TWOT)
pseudosdef pstring
}
'
#%MACROS%
#%IMACROS%
#%ATTENTION%
#%UL%
#%LI% The only configuration parameter is the distance. No offset is included
#%LI% This configuration parameter is normally loaded each time from
# the idxxsetup.mac. You have to modify it there.
#%LI% You can not set values for pseudo motors (tth) with set or set_dial
#%XUL%
#%DEPENDENCIES%
# - The file lin2th has to be read in !done by: startup script
# (this file needs: pseudo.mac stchanges.mac)
#%AUTHOR%
# LIN2TH.MAC - JK 2.94
#%TOC%
|