-
Notifications
You must be signed in to change notification settings - Fork 1
/
limasimulator.mac
120 lines (101 loc) · 4.39 KB
/
limasimulator.mac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#%NAME%
# Specific macros for Lima Simulator detector
#%CATEGORY% Detection, Ccd
#%LOG%
#
def limasimulatorsetup(ccdname) '{
# --- common control init
_limapar_controlinit(ccdname, 0)
# --- parameter definition
_limapar_addconfig(ccdname, "fill_type",LP_RW|LP_LIST,1)
_limapar_addconfig(ccdname, "grow_factor", LP_RW, 1, "double")
_limapar_addconfig(ccdname, "rotation_axis",LP_RW|LP_LIST,1)
_limapar_addconfig(ccdname, "diffraction_pos", LP_RW, 2, "double")
_limapar_addconfig(ccdname, "diffraction_speed", LP_RW, 2, "double")
_limapar_addconfig(ccdname, "rotation_angle", LP_RW, 1, "double")
_limapar_addconfig(ccdname, "rotation_speed", LP_RW, 1, "double")
_limapar_addtext(ccdname, "fill_type", "Image filling type")
_limapar_addtext(ccdname, "grow_factor", "Intensity grow factor in scan")
_limapar_addtext(ccdname, "rotation_axis", "Peak rotation axis")
_limapar_addtext(ccdname, "diffraction_pos", "Peak position for diffraction")
_limapar_addtext(ccdname, "diffraction_speed", "Peak speed for diffraction")
_limapar_addtext(ccdname, "rotation_angle", "Peak rotation angle (deg)")
_limapar_addtext(ccdname, "rotation_speed", "Peak rotation speed (deg/frm)")
# --- callback macro on parameter set
#_limapar_addconfig_cb(ccdname, "_limasimulator_setpar")
# --- parameter description
}'
lima_addlimatype("Simulator", "limasimulatorsetup", "limasimulatormenu")
def _limasimulator_setpar(ccdname, parname, value) '{
_lima_trace ccdname; printf("CB on <%s>\n", parname)
if (parname == "config_name") {
#need to inform SPEC about possible image type change
local unit
unit = LIMA_DEV[ccdname]["unit"]
sleep(1)
# need to call twice "resize" otherwise spec does update
# the image_par() parameters (row_end,row_beg,col_end,col_beg)
image_par(unit, "resize")
image_par(unit, "resize")
ccd_createarray unit
}
}'
def limasimulatormenu(ccdname) '{
local items[] parname aux_str
local nl option
option= 1
items["fill_type"] = ""
items["grow_factor"] = ""
items["rotation_axis"] = ""
items["diffraction_pos"] = ""
items["diffraction_speed"] = ""
items["rotation_angle"] = ""
items["rotation_speed"] = ""
while (option) {
for (parname in items) {
items[parname]= _limapar_get(ccdname, parname)
if ((parname == "diffraction_pos") || (parname == "diffraction_speed"))
items[parname]= sprintf("[%s, %s]", LIMA_VALS[0], LIMA_VALS[1])
}
nl= _limamenu_printtitle(ccdname, "Configuration", "config")
tty_move(0, nl++, "(1) Configuration :")
_limamenu_printitem(ccdname, "fill_type", items["fill_type"], nl++, 11)
_limamenu_printitem(ccdname, "grow_factor", items["grow_factor"], nl++, 12)
_limamenu_printitem(ccdname, "rotation_axis", \
items["rotation_axis"], nl++, 13)
_limamenu_printitem(ccdname, "diffraction_pos", \
items["diffraction_pos"], nl++, 14)
_limamenu_printitem(ccdname, "diffraction_speed", \
items["diffraction_speed"], nl++, 15)
_limamenu_printitem(ccdname, "rotation_angle", \
items["rotation_angle"], nl++, 16)
_limamenu_printitem(ccdname, "rotation_speed", \
items["rotation_speed"], nl++, 17)
++nl
option= getval("\n\n\tOption ---> ", 0)
printf("\n\n")
if((option==1) || (option==11))
_limapar_ask(ccdname, "fill_type",items["fill_type"])
if((option==1) || (option==12))
_limapar_ask(ccdname, "grow_factor",items["grow_factor"])
if((option==1) || (option==13))
_limapar_ask(ccdname, "rotation_axis",items["rotation_axis"])
if((option==1) || (option==14) || (option==15)) {
parname = (option==14) ? "diffraction_pos" : "diffraction_speed"
aux_str = sprintf("Diffraction peak %%s %s", (option==14) ? "pos" : \
"speed")
_limapar_get(ccdname, parname, -1)
LIMA_VALS[0] = getval(sprintf(aux_str, "X"), LIMA_VALS[0])
LIMA_VALS[1] = getval(sprintf(aux_str, "Y"), LIMA_VALS[1])
_limapar_set(ccdname, parname, LIMA_VALS, -1)
}
if((option==1) || (option==16))
_limapar_ask(ccdname, "rotation_angle",items["rotation_angle"])
if((option==1) || (option==17))
_limapar_ask(ccdname, "rotation_speed",items["rotation_speed"])
}
}'
#%MACROS%
#%IMACROS%
#%TOC%
#%AUTHOR% A.Homs