#%TITLE% TTMFIX.MAC
#%NAME%
# Special macro to fix 2theta to two times theta
#%DESCRIPTION%
# A simple macro set which uses pseudo motors to couple the 2th
# movement to the theta movement. If the user types ttmfix, 2th will
# be move twice the angle theta moves. The initial offset will be kept.
#
#%EXAMPLE%
#%PRE%
#fixttmsetup 2th th ( tells the macro which motors to use)
# th : 10 degrees
# 2th: 25 degrees
# fixttm (from now on 2th will be coupled to th)
# mv th 20
# wa
# th : 20 degrees (th moved 10 degrees)
# 2th: 45 degrees (2th moved 20 degrees)
# freettm (from now on, 2th can be move independently)
#%PRE%
# fixttmsetup tth-motor th-motor
#%UU% tth-motor th-motor
#%MDESC%
# defines a pseudo motor behaviour for motor tth
#%UU%
#%MDESC%
# used to fix the current position for tth. Moveing th now will
# move tth twice the angle
def fixttmsetup '
global TTMTTH TTMTH TTMFIX TTMOFFSET
TTMTTH = "$1"
TTMTH = "$2"
cdef("user_checkall","ttmfix_checkall $1 $2 ; ","$1",1)
# Bricolage for id10
# cdef("user_checkall","ttmfix_checkall ttm mono ; checkair ttm;","ttm",1)
'
def ttmfix_checkall '
if (TTMFIX) A[$1]=2*A[$2]+TTMOFFSET
'
#%UU%
#%MDESC%
# fixes the tth motor
def fixttm '
{
global TTMFIX TTMOFFSET
local mtth mth
TTMFIX=1
TTMOFFSET=A[motor_num(TTMTTH)]-2*A[motor_num(TTMTH)]
}
'
#%UU%
#%MDESC%
# frees the tth motor for movement again
def freettm '
global TTMFIX
TTMFIX=0
'
#%UU%
#%MDESC%
# like scanE but with fixed tth (the same as fixttm; scanE; freettm)
def scan_E '
cdef ("user_cleanup2","ttmcleanup; ","ttm",1)
fixttm
Escan $*
freettm
cdef ("user_cleanup2","ttmcleanup; ","ttm","delete")
'
#%UU%
#%MDESC%
# like moveE but with fixed tth (the same as fixttm; moveE; freettm)
def new_E '
cdef ("user_cleanup2","ttmcleanup; ","ttm",1)
fixttm
moveE $*
freettm
cdef ("user_cleanup2","ttmcleanup; ","ttm","delete")
'
#%MDESC%
# frees the ttm motor if ^c is hit
def ttmcleanup '
cdef ("user_cleanup2","ttmcleanup; ","ttm","delete")
freettm
'
#%MACROS%
#%IMACROS%
#%ATTENTION%
# If you use a standard geometrie together with a standard spec
# monochromator, the coupling of tth to the mono energy during
# energy scans is done inside spec. See help Escan at spec prompt.
#
#
#%DEPENDENCIES%
# The file fixttm.mac has to be read in !done by: startup script
# (this file needs: stchanges.mac)
#%AUTHOR%
# TTMFIX.MAC - JK 6.93
#%TOC%
|