#%TITLE% moke_scans.mac
#$Revision: 1.4 $
#%NAME% Scan macros for the MOKE setup
#%DESCRIPTION%
# Scan macros for the MOKE setup
#
# MOKE : Magneto Optical Kerr Effect
#
# Multi-zone (hysteresis) scan (4 zones)
#
#
#%END%
#%UU% curr_max low-res high-res count_time"
#%MDESC% scan the moke. Arguments are:%BR%
#%PRE%
# first : the value of the positive and negative maximum current to go to.
# Use a negative value to start moving negative first!
# second : the number of intervals to use on the second and fourth movement.
# third : the number of intervals to use on the first and third movement.
# fourth : the counting time.
def mokescan '{
local z4_p1 z4_p2 z4_p3 z4_p4 z4_p5
local z4_n1 z4_n2 z4_n3 z4_n4
local z4_mne z4_min z4_max z4_aux
if ($# != 4) {
print "Usage : $0 curr_max low-res high-res count_time"
exit
}
local curr1, lowres, highres, ctime
curr1 = $1
highres = $2
lowres = $3
ctime = $4
z4_mne = curr
z4_p1 = 0
z4_p2 = curr1
z4_p3 = 0
z4_p4 = curr1 * -1
z4_p5 = 0
z4_n1 = highres
z4_n2 = lowres
z4_n3 = highres
z4_n4 = lowres
_check0 "$1"
if ((z4_n1 == 0 )||(z4_n2 == 0)||(z4_n3 == 0)||(z4_n4 == 0)) {
p "Number of intervals <= 0! Can`t do that!"
exit
}
z4_min = 99999999
z4_max = -99999999
if (z4_p1 > z4_max)
z4_max = z4_p1
if (z4_p1 < z4_min)
z4_min = z4_p1
if (z4_p2 > z4_max)
z4_max = z4_p2
if (z4_p2 < z4_min)
z4_min = z4_p2
if (z4_p3 > z4_max)
z4_max = z4_p3
if (z4_p3 < z4_min)
z4_min = z4_p3
if (z4_p4 > z4_max)
z4_max = z4_p4
if (z4_p4 < z4_min)
z4_min = z4_p4
if (z4_p5 > z4_max)
z4_max = z4_p5
if (z4_p4 < z4_min)
z4_min = z4_p5
_bad_lim = 0
_chk_lim z4_mne z4_min
_chk_lim z4_mne z4_max
if (_bad_lim)
exit
HEADING = sprintf("mokescan %s %s %s %s", "$1", "$2", "$3", "$4")
_cols = 1 + _hkl_col
X_L = cnt_name(lsgm)
Y_L = cnt_name(adc)
_sx = z4_min ; _fx = z4_max
_n1 = z4_n1 + z4_n2 + z4_n3 + z4_n4 +1
FPRNT=PPRNT=VPRNT=""
FPRNT=sprintf("%s%s ",FPRNT,motor_name(z4_mne))
PPRNT=sprintf("%s%8.8s ",PPRNT,motor_name(z4_mne))
VPRNT=sprintf("%s%9.9s ",VPRNT,motor_name(z4_mne))
FPRNT=sprintf("%s%s ",FPRNT,_hkl_sym1)
scan_head
PFMT=sprintf("%%s%%8.%df ",UP)
VFMT=sprintf("%%s%%9.%df ",UP)
_c1=0
cdef("cleanup_once", "dscan_cleanup curr 0;", "dscan")
NPTS = 0
z4_aux = (z4_p2 - z4_p1)/z4_n1
__moke_scan_on z4_mne z4_p1 z4_p2 z4_n1 ctime z4_aux
z4_aux = (z4_p3 - z4_p2)/z4_n2
__moke_scan_on z4_mne z4_p2 z4_p3 z4_n2 ctime z4_aux
z4_aux = (z4_p4 - z4_p3)/z4_n3
__moke_scan_on z4_mne z4_p3 z4_p4 z4_n3 ctime z4_aux
z4_aux = (z4_p5 - z4_p4)/z4_n4
z4_n4++
__moke_scan_on z4_mne z4_p4 z4_p5 z4_n4 ctime z4_aux
}
'
#%UU% curr1 low-res high-res curr2 resol count_time
#%MDESC% scan the moke. Arguments are:%BR%
#%PRE%
# first : the value of the positive and negative current for the inner zone.
# Use a negative value to start moving negative first!
# second : the number of intervals to use for movement from 0 to +-curr1.
# third : the number of intervals to use for movement from +-curr1 to 0.
# fourth : the value of the positive and negative current for the outer zone.
# fifth : the number of intervals to use for movement from curr1 to curr2.
# sixth : the counting time.
def mokescan2 '{
local z8_p1 z8_p2 z8_p3 z8_p4 z8_p5 z8_p6 z8_p7 z8_p8 z8_p9
local z8_n1 z8_n2 z8_n3 z8_n4 z8_n5 z8_n6 z8_n7 z8_n8
local z8_mne z8_min z8_max z8_aux
if ($# != 6) {
print "Usage : $0 curr1 low-res high-res curr2 resol count_time"
exit
}
local curr1, lowres, highres, curr2, resol, ctime
curr1 = $1
highres = $2
lowres = $3
curr2 = $4
resol = $5
ctime = $6
# make sure the current signs are consistent.
if (fabs(curr1) != curr1 + 0) {
curr2 = fabs(curr2) * -1
} else {
curr2 = fabs(curr2)
}
z8_mne = curr
z8_p1 = 0
z8_p2 = curr1
z8_p3 = curr2
z8_p4 = curr1
z8_p5 = 0
z8_p6 = -curr1
z8_p7 = -curr2
z8_p8 = -curr1
z8_end = 0
z8_n1 = highres
z8_n2 = resol
z8_n3 = resol
z8_n4 = lowres
z8_n5 = highres
z8_n6 = resol
z8_n7 = resol
z8_n8 = lowres
_check0 "$1"
if ((highres == 0)||(lowres == 0)||(resol == 0)) {
print "One number of intervals is 0! Can`t do that!"
exit
}
z8_min = 99999999
z8_max = -99999999
if (z8_p1 > z8_max)
z8_max = z8_p1
if (z8_p1 < z8_min)
z8_min = z8_p1
if (z8_p2 > z8_max)
z8_max = z8_p2
if (z8_p2 < z8_min)
z8_min = z8_p2
if (z8_p3 > z8_max)
z8_max = z8_p3
if (z8_p3 < z8_min)
z8_min = z8_p3
if (z8_p4 > z8_max)
z8_max = z8_p4
if (z8_p4 < z8_min)
z8_min = z8_p4
if (z8_p5 > z8_max)
z8_max = z8_p5
if (z8_p4 < z8_min)
z8_min = z8_p5
_bad_lim = 0
_chk_lim z8_mne z8_min
_chk_lim z8_mne z8_max
if (_bad_lim) {
exit
}
HEADING = sprintf("mokescan %s %s %s %s %s %s", "$1", "$2", "$3", "$4",\
"$5", "$6")
_cols = 1 + _hkl_col
X_L = cnt_name(lsgm)
Y_L = cnt_name(adc)
_sx = z8_min ; _fx = z8_max
_n1 = 1 + z8_n1 + z8_n2 + z8_n3 + z8_n4 + z8_n5 + z8_n6 + z8_n7 + z8_n8
FPRNT=PPRNT=VPRNT=""
FPRNT=sprintf("%s%s ",FPRNT,motor_name(z8_mne))
PPRNT=sprintf("%s%8.8s ",PPRNT,motor_name(z8_mne))
VPRNT=sprintf("%s%9.9s ",VPRNT,motor_name(z8_mne))
FPRNT=sprintf("%s%s ",FPRNT,_hkl_sym1)
scan_head
PFMT=sprintf("%%s%%8.%df ",UP)
VFMT=sprintf("%%s%%9.%df ",UP)
_c1=0
cdef("cleanup_once", "dscan_cleanup curr 0;", "dscan")
NPTS = 0
z8_aux = (z8_p2 - z8_p1)/z8_n1
__moke_scan_on z8_mne z8_p1 z8_p2 z8_n1 ctime z8_aux
z8_aux = (z8_p3 - z8_p2)/z8_n2
__moke_scan_on z8_mne z8_p2 z8_p3 z8_n2 ctime z8_aux
z8_aux = (z8_p4 - z8_p3)/z8_n3
__moke_scan_on z8_mne z8_p3 z8_p4 z8_n3 ctime z8_aux
z8_aux = (z8_p5 - z8_p4)/z8_n4
__moke_scan_on z8_mne z8_p4 z8_p5 z8_n4 ctime z8_aux
z8_aux = (z8_p6 - z8_p5)/z8_n5
__moke_scan_on z8_mne z8_p5 z8_p6 z8_n5 ctime z8_aux
z8_aux = (z8_p7 - z8_p6)/z8_n6
__moke_scan_on z8_mne z8_p6 z8_p7 z8_n6 ctime z8_aux
z8_aux = (z8_p8 - z8_p7)/z8_n7
__moke_scan_on z8_mne z8_p7 z8_p7 z8_n7 ctime z8_aux
z8_aux = (z8_p9 - z8_p8)/z8_n8
z8_n8++
__moke_scan_on z8_mne z8_p8 z8_p9 z8_n8 ctime z8_aux
}
'
#%IU%
#%MDESC% internal macro for MOKE
def __moke_scan_on '{
local z4_n
_m[0] = $1; _s[0] = $2; _f[0] = $3
_n1 = $4; _ctime = $5
_d[0] = $6
_nm = 1
_n = 0
for (; _n < _n1; _n++, NPTS++) {
local i
for (i=0;i<_nm;i++)
A[_m[i]] = _s[i] + _n * _d[i]
scan_move
FPRNT=PPRNT=VPRNT=""
for (i=0;i<_nm;i++) {
FPRNT=sprintf("%s%.8g ",FPRNT,A[_m[i]])
PPRNT=sprintf(PFMT,PPRNT,A[_m[i]])
VPRNT=sprintf(VFMT,VPRNT,A[_m[i]])
}
FPRNT=sprintf("%s%s ",FPRNT,_hkl_val)
scan_loop
scan_data(NPTS,A[_m[0]])
scan_plot
}
scan_tail
}
'
#%MACROS%
#%IMACROS%
#%END%
#%BUGS% Bugs ? What bugs ??
#%AUTHOR%
#Holger (BLISS) for ID18. Derived from a z3escan of Gilles.
#%TOC%
|