#%TITLE% REGIONSCAN.MAC
#%NAME%
# Extended ascan: variable points density regions.
#%DESCRIPTION%
# %B%rscan%B% allows users to define various measurement density regions among the scanned area; each region is assigned its particular size and intervals number.
#%EXAMPLE%
#%DL% rscan motor 1 2 30 3 10 2
#%DT% Does an absolute scan (ascan), with 30 intervals between motor positions 1 and 2, and 10 between 2 and 3, the integration time being 2 seconds.
#%XDL%
#%END%
#%UU% <start end_roi1> <intervals_roi1> [end_roi2 intervals_roi2] ... <time>
#%MDESC% Extended %B%ascan%B% command. You can define as many ROIs as you want.
def rscan '{
global RS_ARGV RS_ARGNO
array RS_STEPS [4096]
RS_ARGNO = split("$*",RS_ARGV)
if (((RS_ARGNO-5)/2) != int((RS_ARGNO-5)/2)) {
print "Usage: rscan motor start end_1 intervals_1 [end_2 intervals_2] [...] sec"
exit
}
HEADING = sprintf("$0 $*")
_region_profile_ascan
_rscan
}'
#%IU%
#%MDESC% Calculates the scan profile step by step.
def _region_profile_ascan '{
local si i intervals
intervals = 0
if ((_m[0] = motor_num(RS_ARGV [0]))<0) {
print "Invalid motor name: " _m[0]
exit
}
_nm = 1
_s[0] = RS_ARGV [1]
_f[0] = RS_ARGV [RS_ARGNO-3]
_ctime = RS_ARGV [RS_ARGNO-1]
RS_STEPS [0] = _s[0]
for (si=0,i=2 ; i<(RS_ARGNO-1) ; i+=2) {
local sno ssz
sno = int(RS_ARGV[i+1])
if (sno <= 0) {
print "Number of Intervals <= 0:",sno
exit
}
intervals += sno
ssz = (RS_ARGV[i] - RS_STEPS[si])/sno
for (;si<intervals;si++) RS_STEPS[si+1] = RS_STEPS[si] + ssz;
}
_n1 = intervals
}'
#%IU%
#%MDESC% Does the scan.
def _rscan '{
local i
for (i=0;i<_nm;i++) {
_bad_lim = 0
_chk_lim _m[i] _s[i]
_chk_lim _m[i] _f[i]
if (_bad_lim) exit;
_d[i] = (_f[i] - _s[i]) / _n1
}
}
_n1++
_cols=_nm+_hkl_col
X_L = motor_name(_m[0])
Y_L = cnt_name(DET)
_sx = _s[0]*UN; _fx = _f[0]*UN
_stype = 1|(_nm<<8)
FPRNT=PPRNT=VPRNT=""
{
local i
for (i=0;i<_nm;i++) {
FPRNT=sprintf("%s%s ",FPRNT,motor_name(_m[i]))
PPRNT=sprintf("%s%8.8s ",PPRNT,motor_name(_m[i]))
VPRNT=sprintf("%s%9.9s ",VPRNT,motor_name(_m[i]))
}
}
FPRNT=sprintf("%s%s ",FPRNT,_hkl_sym1)
scan_head
PFMT=sprintf("%%s%%8.%df ",UP)
VFMT=sprintf("%%s%%9.%df ",UP)
def _scan_on \'
for (; NPTS < _n1; NPTS++) {
local i
for (i=0;i<_nm;i++)
A[_m[i]] = RS_STEPS [NPTS]
scan_move
FPRNT=PPRNT=VPRNT=""
for (i=0;i<_nm;i++) {
FPRNT=sprintf("%s%.8g ",FPRNT,A[_m[i]]*UN)
PPRNT=sprintf(PFMT,PPRNT,A[_m[i]]*UN)
VPRNT=sprintf(VFMT,VPRNT,A[_m[i]]*UN)
}
FPRNT=sprintf("%s%s ",FPRNT,_hkl_val)
scan_loop
data_nput(PL_G, NPTS, A[_m[0]]*UN, S[DET])
scan_plot
}
scan_tail
\'
_scan_on
'
#%MACROS%
#%IMACROS%
#%DEPENDENCIES%
#%PRE%
# - The file %B%regionscan.mac%B% has to be read in
#%PRE%
#%AUTHOR%
# REGIONSCAN.MAC - Marie-Claire LAGIER - 96/9/27
#%TOC%
|