#%TITLE% MINIDIFF_FOCUS.MAC
#%NAME%
# Macros to handle the focus only by using the sample motors on the gonio.
#
#%CATEGORY% MX
#
#%DESCRIPTION% This is a macro motor which can change the focus without moving the
# phi x translation. It is important to maintain a reference to the focal plane for the
# reliability of the autocentring functions, so the phi x translation can be held at a reference position.
# The user would still like to focus on the sample and so this macro makes it possible.
# A focus motor should be configured in SPEC.
#
#%LOG%
#$Log: minidiff_focus.mac,v $
#Revision 1.1 2008/08/12 13:53:19 rey
#Initial revision
#
#%END%
#%UU% (mnum, type, par1, par2)
#%MDESC%
def focus_config(mnum, type, par1, par2) '{
p "focus_config " mnum " " type " " par1 " " par2
return "focus"
}'
#%IU% (mnum, mode)
#%MDESC%
def focus_calc(mnum, mode) '{
global OLD_FOCUS
local DegToRad phiRad
motmne = motor_mne(mnum)
if (mode != "..") {
DegToRad = 3.14159/180
phiRad = A[phi]*DegToRad
if (mode == 0) {
if (FOCUS_DEBUG) print "set focus (" motmne ")"
A[focus] = A[sampx]*cos(phiRad) + A[sampy]*sin(phiRad)
} else {
if (FOCUS_DEBUG) print "Set sampx/sampy " motmne
if ((A[phi]+90)%180 != 0) {
A[sampx] = A[focus]*cos(phiRad)
} else {
A[sampx] = 0
}
if (phiRad%180 != 0) {
A[sampy] = A[focus]*sin(phiRad)
} else {
A[sampy] = 0
}
}
if (FOCUS_DEBUG)
print "focus " A[focus] " sampx " A[sampx] " sampy " A[sampy]
}
}'
|