1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | |
---|
3 | // |
---|
4 | // |
---|
5 | // mockup of the panel for VCALC |
---|
6 | // |
---|
7 | // -- all is housed in the folder: |
---|
8 | // NewDataFolder/O root:Packages:NIST:VSANS:VCALC |
---|
9 | // |
---|
10 | // -- Put all of the constants to define the instrument plus all of the VCALC stuff |
---|
11 | // |
---|
12 | // anticipating that at the same level as VCALC will be all of the reduction folders |
---|
13 | // in a similar way as for SANS reduction |
---|
14 | // |
---|
15 | // |
---|
16 | |
---|
17 | |
---|
18 | Macro VCALC_Panel() |
---|
19 | DoWindow/F VCALC |
---|
20 | if(V_flag==0) |
---|
21 | |
---|
22 | //initialize space = folders, parameters, instrument constants, etc. |
---|
23 | V_Initialize_Space() |
---|
24 | |
---|
25 | //open the panel |
---|
26 | DrawVCALC_Panel() |
---|
27 | |
---|
28 | // two graphs with the ray-tracing side/top views |
---|
29 | SetupSideView() |
---|
30 | SetupTopView() |
---|
31 | |
---|
32 | // a front view of the panels |
---|
33 | FrontView_1x() |
---|
34 | |
---|
35 | // TODO: fake a "click" on the front SDD to force (almost)everything to update |
---|
36 | // including the I(q) graph |
---|
37 | FakeFrontMiddleSDDClick() |
---|
38 | |
---|
39 | endif |
---|
40 | End |
---|
41 | |
---|
42 | Function FakeFrontMiddleSDDClick() |
---|
43 | |
---|
44 | STRUCT WMSetVariableAction sva |
---|
45 | sva.eventCode = 3 |
---|
46 | // sva.dval = 0.3 |
---|
47 | |
---|
48 | V_BDet_SDD_SetVarProc(sva) |
---|
49 | V_MDet_SDD_SetVarProc(sva) |
---|
50 | V_FDet_SDD_SetVarProc(sva) |
---|
51 | |
---|
52 | return(0) |
---|
53 | end |
---|
54 | |
---|
55 | |
---|
56 | Proc DrawVCALC_Panel() |
---|
57 | PauseUpdate; Silent 1 // building window... |
---|
58 | NewPanel /W=(34,44,1274,699)/N=VCALC/K=1 |
---|
59 | ModifyPanel cbRGB=(49151,60031,65535) |
---|
60 | // ShowTools/A |
---|
61 | SetDrawLayer UserBack |
---|
62 | |
---|
63 | // always visible stuff, not on any tab |
---|
64 | |
---|
65 | GroupBox group0,pos={10,10},size={444,180},title="Setup" |
---|
66 | TabControl Vtab,labelBack=(45000,61000,58000),pos={14,215},size={430,426},tabLabel(0)="Collim" |
---|
67 | TabControl Vtab,tabLabel(1)="Sample",tabLabel(2)="Front Det",tabLabel(3)="Mid Det" |
---|
68 | TabControl Vtab,tabLabel(4)="Back Det",tabLabel(5)="Simul",value= 0,proc=VCALCTabProc |
---|
69 | GroupBox group1,pos={460,10},size={762,635},title="Detector Panel Positions + Data" |
---|
70 | |
---|
71 | PopupMenu popup_a,pos={50,40},size={142,20},title="Presets" |
---|
72 | PopupMenu popup_a,mode=1,popvalue="Low Q",value= root:Packages:NIST:VSANS:VCALC:gPresetPopStr |
---|
73 | |
---|
74 | PopupMenu popup_b,pos={690,310},size={142,20},title="Binning type" |
---|
75 | PopupMenu popup_b,mode=1,popvalue="One",value= root:Packages:NIST:VSANS:VCALC:gBinTypeStr |
---|
76 | |
---|
77 | SetVariable setVar_a,pos={476,26},size={120,15},title="axis degrees",proc=FrontView_Range_SetVarProc |
---|
78 | SetVariable setVar_a,limits={0.3,30,0.2},value=_NUM:20 |
---|
79 | |
---|
80 | // for panels (in degrees) |
---|
81 | Display/W=(476,45,757,303)/HOST=# root:Packages:NIST:VSANS:VCALC:fv_degY vs root:Packages:NIST:VSANS:VCALC:fv_degX |
---|
82 | RenameWindow #,FrontView |
---|
83 | ModifyGraph mode=2 // mode = 2 = dots |
---|
84 | ModifyGraph marker=19 |
---|
85 | ModifyGraph rgb=(0,0,0) |
---|
86 | ModifyGraph tick=2,mirror=1 |
---|
87 | Label left "degrees" |
---|
88 | Label bottom "degrees" |
---|
89 | SetActiveSubwindow ## |
---|
90 | |
---|
91 | |
---|
92 | // for side view |
---|
93 | Display/W=(842,25,1200,170)/HOST=# root:Packages:NIST:VSANS:VCALC:fv_degY vs root:Packages:NIST:VSANS:VCALC:fv_degX |
---|
94 | RenameWindow #,SideView |
---|
95 | ModifyGraph mode=2 // mode = 2 = dots |
---|
96 | ModifyGraph marker=19 |
---|
97 | ModifyGraph rgb=(0,0,0) |
---|
98 | ModifyGraph tick=2,mirror=1 |
---|
99 | Label left "Vertical position (mm)" |
---|
100 | Label bottom "SDD (m)" |
---|
101 | SetActiveSubwindow ## |
---|
102 | |
---|
103 | // for top view |
---|
104 | Display/W=(842,180,1200,325)/HOST=# root:Packages:NIST:VSANS:VCALC:fv_degY vs root:Packages:NIST:VSANS:VCALC:fv_degX |
---|
105 | RenameWindow #,TopView |
---|
106 | ModifyGraph mode=2 // mode = 2 = dots |
---|
107 | ModifyGraph marker=19 |
---|
108 | ModifyGraph rgb=(0,0,0) |
---|
109 | ModifyGraph tick=2,mirror=1 |
---|
110 | Label left "Horizontal position (mm)" |
---|
111 | Label bottom "SDD (m)" |
---|
112 | SetActiveSubwindow ## |
---|
113 | |
---|
114 | // for panels (as 2D Q) |
---|
115 | Display/W=(475,332,814,631)/HOST=# root:Packages:NIST:VSANS:VCALC:fv_degY vs root:Packages:NIST:VSANS:VCALC:fv_degX |
---|
116 | RenameWindow #,Panels_Q |
---|
117 | ModifyGraph mode=2 // mode = 2 = dots |
---|
118 | ModifyGraph tick=2,mirror=1,grid=2,standoff=0 |
---|
119 | ModifyGraph width={Aspect,1},height={Aspect,1},gbRGB=(56797,56797,56797) |
---|
120 | SetAxis left -0.2,0.2 |
---|
121 | SetAxis bottom -0.2,0.2 |
---|
122 | Label left "Qy" |
---|
123 | Label bottom "Qx" |
---|
124 | SetActiveSubwindow ## |
---|
125 | |
---|
126 | SetVariable setVar_b,pos={476,314},size={120,15},title="axis Q",proc=Front2DQ_Range_SetVarProc |
---|
127 | SetVariable setVar_b,limits={0.02,1,0.02},value=_NUM:0.3 |
---|
128 | CheckBox check_0a title="Log?",size={60,20},pos={619,313},proc=Front2DQ_Log_CheckProc |
---|
129 | |
---|
130 | // for averaged I(Q) |
---|
131 | Display/W=(842,334,1204,629)/HOST=# //root:Packages:NIST:VCALC:fv_degY vs root:Packages:NIST:VSANS:VCALC:fv_degX |
---|
132 | RenameWindow #,Panels_IQ |
---|
133 | // ModifyGraph mode=2 // mode = 2 = dots |
---|
134 | ModifyGraph tick=2,mirror=1,grid=2 |
---|
135 | // Label left "Intensity" |
---|
136 | // Label bottom "Q" |
---|
137 | SetActiveSubwindow ## |
---|
138 | |
---|
139 | |
---|
140 | |
---|
141 | // all controls are named VCALCCtrl_NA where N is the tab number and A is the letter denoting |
---|
142 | |
---|
143 | |
---|
144 | // tab(0), collimation - initially visible |
---|
145 | Slider VCALCCtrl_0a,pos={223,324},size={200,45},limits={0,10,1},value= 1,vert= 0 |
---|
146 | SetVariable VCALCCtrl_0b,pos={25,294},size={120,15},title="wavelength" |
---|
147 | SetVariable VCALCCtrl_0b,limits={4,20,1},value=_NUM:8,proc=V_Lambda_SetVarProc |
---|
148 | PopupMenu VCALCCtrl_0c,pos={26,257},size={150,20},title="monochromator" |
---|
149 | PopupMenu VCALCCtrl_0c,mode=1,popvalue="Velocity Selector",value= root:Packages:NIST:VSANS:VCALC:gMonochromatorType |
---|
150 | PopupMenu VCALCCtrl_0d,pos={26,321},size={115,20},title="delta lambda" |
---|
151 | PopupMenu VCALCCtrl_0d,mode=1,popvalue="0.10",value= root:Packages:NIST:VSANS:VCALC:gDeltaLambda |
---|
152 | PopupMenu VCALCCtrl_0e,pos={291,262},size={132,20},title="source shape" |
---|
153 | PopupMenu VCALCCtrl_0e,mode=1,popvalue="circular",value= root:Packages:NIST:VSANS:VCALC:gSourceShape |
---|
154 | PopupMenu VCALCCtrl_0f,pos={283,293},size={141,20},title="source aperture" |
---|
155 | PopupMenu VCALCCtrl_0f,mode=1,popvalue="1.0 cm",value= root:Packages:NIST:VSANS:VCALC:gSourceDiam |
---|
156 | |
---|
157 | |
---|
158 | // tab(1) - Sample conditions, initially not visible |
---|
159 | PopupMenu VCALCCtrl_1a,pos={38,270},size={142,20},title="table location",disable=1 |
---|
160 | PopupMenu VCALCCtrl_1a,mode=1,popvalue="Changer",value= root:Packages:NIST:VSANS:VCALC:gTableLocation |
---|
161 | PopupMenu VCALCCtrl_1b,pos={270,270},size={115,20},title="Aperture Shape",disable=1 |
---|
162 | PopupMenu VCALCCtrl_1b,mode=1,popvalue="circular",value= root:Packages:NIST:VSANS:VCALC:gSampleApertureShape |
---|
163 | PopupMenu VCALCCtrl_1c,pos={270,330},size={132,20},title="Aperture Size (cm)",disable=1 |
---|
164 | PopupMenu VCALCCtrl_1c,mode=1,popvalue="0.5",value= root:Packages:NIST:VSANS:VCALC:gSampleApertureDiam |
---|
165 | |
---|
166 | |
---|
167 | // tab(2) - Front detector panels, initially not visible |
---|
168 | SetVariable VCALCCtrl_2a,pos={30,260},size={150,15},title="L/R Separation (mm)",proc=V_FDet_LR_SetVarProc |
---|
169 | SetVariable VCALCCtrl_2a,limits={0,400,1},disable=1,value=_NUM:100 |
---|
170 | SetVariable VCALCCtrl_2b,pos={30,290},size={150,15},title="T/B Separation (mm)",proc=V_FDet_LR_SetVarProc |
---|
171 | SetVariable VCALCCtrl_2b,limits={0,400,1},disable=1,value=_NUM:100 |
---|
172 | SetVariable VCALCCtrl_2c,pos={205,290},size={150,15},title="Lateral Offset (mm)" |
---|
173 | SetVariable VCALCCtrl_2c,limits={0,200,0.1},disable=1,value=_NUM:0 |
---|
174 | SetVariable VCALCCtrl_2d,pos={205,260},size={230,15},title="Sample to Detector Distance (m)",proc=V_FDet_SDD_SetVarProc |
---|
175 | SetVariable VCALCCtrl_2d,limits={1,8,0.1},disable=1 ,value=_NUM:1.5 |
---|
176 | |
---|
177 | |
---|
178 | // tab(3) - Middle detector panels, initially not visible |
---|
179 | SetVariable VCALCCtrl_3a,pos={30,260},size={150,15},title="L/R Separation (mm)",proc=V_MDet_LR_SetVarProc |
---|
180 | SetVariable VCALCCtrl_3a,limits={0,400,1},disable=1,value=_NUM:120 |
---|
181 | SetVariable VCALCCtrl_3b,pos={30,290},size={150,15},title="T/B Separation (mm)",proc=V_MDet_LR_SetVarProc |
---|
182 | SetVariable VCALCCtrl_3b,limits={0,400,1},disable=1,value=_NUM:120 |
---|
183 | SetVariable VCALCCtrl_3c,pos={205,290},size={150,15},title="Lateral Offset (mm)" |
---|
184 | SetVariable VCALCCtrl_3c,limits={0,200,0.1},disable=1,value=_NUM:0 |
---|
185 | SetVariable VCALCCtrl_3d,pos={205,260},size={230,15},title="Sample to Detector Distance (m)",proc=V_MDet_SDD_SetVarProc |
---|
186 | SetVariable VCALCCtrl_3d,limits={8,20,0.1},disable=1,value=_NUM:10 |
---|
187 | |
---|
188 | // tab(4) - Back detector panel |
---|
189 | SetVariable VCALCCtrl_4a,pos={188,290},size={150,15},title="Lateral Offset (mm)" |
---|
190 | SetVariable VCALCCtrl_4a,limits={0,200,0.1},disable=1,value=_NUM:0 |
---|
191 | SetVariable VCALCCtrl_4b,pos={188,260},size={230,15},title="Sample to Detector Distance (m)",proc=V_BDet_SDD_SetVarProc |
---|
192 | SetVariable VCALCCtrl_4b,limits={20,25,0.1},disable=1,value=_NUM:22 |
---|
193 | PopupMenu VCALCCtrl_4c,pos={40,260},size={180,20},title="Detector type",disable=1 |
---|
194 | PopupMenu VCALCCtrl_4c,mode=1,popvalue="2D",value= root:Packages:NIST:VSANS:VCALC:gBackDetType |
---|
195 | |
---|
196 | // tab(5) - Simulation setup |
---|
197 | SetVariable VCALCCtrl_5a,pos={40,290},size={200,15},title="Neutrons on Sample (imon)" |
---|
198 | SetVariable VCALCCtrl_5a,limits={1e7,1e15,1e7},disable=1,value=_NUM:1e10 |
---|
199 | PopupMenu VCALCCtrl_5b,pos={40,260},size={180,20},title="Model Function",disable=1 |
---|
200 | PopupMenu VCALCCtrl_5b,mode=1,popvalue="Debye",value= root:Packages:NIST:VSANS:VCALC:gModelFunctionType |
---|
201 | |
---|
202 | End |
---|
203 | |
---|
204 | |
---|
205 | // function to control the drawing of controls in the TabControl on the main panel |
---|
206 | // Naming scheme for the controls MUST be strictly adhered to... else controls will |
---|
207 | // appear in odd places... |
---|
208 | // all controls are named VCALCCtrl_NA where N is the tab number and A is the letter denoting |
---|
209 | // the controls position on that particular tab. |
---|
210 | // in this way, they will always be drawn correctly.. |
---|
211 | // |
---|
212 | // |
---|
213 | // -- this will need to be modified to allow for the graph to be drawn of the detector bank positions |
---|
214 | // if that is individual to each tab - or if it's always visible - that's still to be decided. |
---|
215 | // |
---|
216 | // |
---|
217 | Function VCALCTabProc(name,tab) |
---|
218 | String name |
---|
219 | Variable tab |
---|
220 | |
---|
221 | // Print "name,number",name,tab |
---|
222 | String ctrlList = ControlNameList("",";"),item="",nameStr="" |
---|
223 | Variable num = ItemsinList(ctrlList,";"),ii,onTab |
---|
224 | for(ii=0;ii<num;ii+=1) |
---|
225 | //items all start w/"VCALCCtrl_", 10 characters |
---|
226 | item=StringFromList(ii, ctrlList ,";") |
---|
227 | nameStr=item[0,9] |
---|
228 | if(cmpstr(nameStr,"VCALCCtrl_")==0) |
---|
229 | onTab = str2num(item[10]) //[10] is a number |
---|
230 | ControlInfo $item |
---|
231 | switch(abs(V_flag)) |
---|
232 | case 1: |
---|
233 | Button $item,disable=(tab!=onTab) |
---|
234 | break |
---|
235 | case 2: |
---|
236 | CheckBox $item,disable=(tab!=onTab) |
---|
237 | break |
---|
238 | case 3: |
---|
239 | PopupMenu $item,disable=(tab!=onTab) |
---|
240 | break |
---|
241 | case 4: |
---|
242 | ValDisplay $item,disable=(tab!=onTab) |
---|
243 | break |
---|
244 | case 5: |
---|
245 | SetVariable $item,disable=(tab!=onTab) |
---|
246 | break |
---|
247 | case 7: |
---|
248 | Slider $item,disable=(tab!=onTab) |
---|
249 | break |
---|
250 | case 9: |
---|
251 | GroupBox $item,disable=(tab!=onTab) |
---|
252 | break |
---|
253 | case 10: |
---|
254 | TitleBox $item,disable=(tab!=onTab) |
---|
255 | break |
---|
256 | // add more items to the switch if different control types are used |
---|
257 | endswitch |
---|
258 | endif |
---|
259 | endfor |
---|
260 | |
---|
261 | |
---|
262 | |
---|
263 | return(0) |
---|
264 | End |
---|
265 | |
---|
266 | Function Front2DQ_Log_CheckProc(cba) : CheckBoxControl |
---|
267 | STRUCT WMCheckboxAction &cba |
---|
268 | |
---|
269 | switch( cba.eventCode ) |
---|
270 | case 2: // mouse up |
---|
271 | Variable checked = cba.checked |
---|
272 | |
---|
273 | Execute "FrontPanels_AsQ()" |
---|
274 | Execute "MiddlePanels_AsQ()" |
---|
275 | Execute "BackPanels_AsQ()" |
---|
276 | break |
---|
277 | case -1: // control being killed |
---|
278 | break |
---|
279 | endswitch |
---|
280 | |
---|
281 | return 0 |
---|
282 | End |
---|
283 | |
---|
284 | |
---|
285 | |
---|
286 | // setVar for the wavelength |
---|
287 | // |
---|
288 | Function V_Lambda_SetVarProc(sva) : SetVariableControl |
---|
289 | STRUCT WMSetVariableAction &sva |
---|
290 | |
---|
291 | switch( sva.eventCode ) |
---|
292 | case 1: // mouse up |
---|
293 | case 2: // Enter key |
---|
294 | case 3: // Live update |
---|
295 | Variable dval = sva.dval |
---|
296 | String sval = sva.sval |
---|
297 | |
---|
298 | // don't need to recalculate the views, but need to recalculate the detectors |
---|
299 | fPlotBackPanels() |
---|
300 | fPlotMiddlePanels() |
---|
301 | fPlotFrontPanels() |
---|
302 | |
---|
303 | break |
---|
304 | case -1: // control being killed |
---|
305 | break |
---|
306 | endswitch |
---|
307 | |
---|
308 | return 0 |
---|
309 | End |
---|
310 | |
---|
311 | |
---|
312 | // setVar for the range (in degrees) for the FrontView plot of the detectors |
---|
313 | // |
---|
314 | Function FrontView_Range_SetVarProc(sva) : SetVariableControl |
---|
315 | STRUCT WMSetVariableAction &sva |
---|
316 | |
---|
317 | switch( sva.eventCode ) |
---|
318 | case 1: // mouse up |
---|
319 | case 2: // Enter key |
---|
320 | case 3: // Live update |
---|
321 | Variable dval = sva.dval |
---|
322 | String sval = sva.sval |
---|
323 | |
---|
324 | FrontView_1x() |
---|
325 | |
---|
326 | break |
---|
327 | case -1: // control being killed |
---|
328 | break |
---|
329 | endswitch |
---|
330 | |
---|
331 | return 0 |
---|
332 | End |
---|
333 | |
---|
334 | // setVar for the range (in Q) for the FrontView plot of the detectors |
---|
335 | // |
---|
336 | // TODO: this assumes that everything (the data) is already updated - this only updates the plot range |
---|
337 | Function Front2DQ_Range_SetVarProc(sva) : SetVariableControl |
---|
338 | STRUCT WMSetVariableAction &sva |
---|
339 | |
---|
340 | switch( sva.eventCode ) |
---|
341 | case 1: // mouse up |
---|
342 | case 2: // Enter key |
---|
343 | case 3: // Live update |
---|
344 | Variable dval = sva.dval |
---|
345 | String sval = sva.sval |
---|
346 | |
---|
347 | SetAxis/W=VCALC#Panels_Q left -dval,dval |
---|
348 | SetAxis/W=VCALC#Panels_Q bottom -dval,dval |
---|
349 | |
---|
350 | // FrontPanels_AsQ() |
---|
351 | |
---|
352 | break |
---|
353 | case -1: // control being killed |
---|
354 | break |
---|
355 | endswitch |
---|
356 | |
---|
357 | return 0 |
---|
358 | End |
---|
359 | |
---|
360 | // SDD for the Front detector. triggers a recalculation |
---|
361 | // of the intensity and a redraw of the banks |
---|
362 | // |
---|
363 | Function V_FDet_SDD_SetVarProc(sva) : SetVariableControl |
---|
364 | STRUCT WMSetVariableAction &sva |
---|
365 | |
---|
366 | switch( sva.eventCode ) |
---|
367 | case 1: // mouse up |
---|
368 | case 2: // Enter key |
---|
369 | case 3: // Live update |
---|
370 | Variable dval = sva.dval |
---|
371 | String sval = sva.sval |
---|
372 | |
---|
373 | // Variable LR_sep,TB_sep |
---|
374 | // // don't know if LR or TB called, so get the explicit values |
---|
375 | // // |
---|
376 | // ControlInfo VCALCCtrl_2a |
---|
377 | // LR_sep = V_Value |
---|
378 | // ControlInfo VCALCCtrl_2b |
---|
379 | // TB_sep = V_Value |
---|
380 | // |
---|
381 | // UpdateFrontDetector(LR_sep,TB_sep) |
---|
382 | |
---|
383 | UpdateSideView() |
---|
384 | UpdateTopView() |
---|
385 | FrontView_1x() |
---|
386 | |
---|
387 | fPlotFrontPanels() |
---|
388 | |
---|
389 | break |
---|
390 | case -1: // control being killed |
---|
391 | break |
---|
392 | endswitch |
---|
393 | |
---|
394 | return 0 |
---|
395 | End |
---|
396 | |
---|
397 | // SDD for the Middle detector. triggers a recalculation |
---|
398 | // of the intensity and a redraw of the banks |
---|
399 | // |
---|
400 | Function V_MDet_SDD_SetVarProc(sva) : SetVariableControl |
---|
401 | STRUCT WMSetVariableAction &sva |
---|
402 | |
---|
403 | switch( sva.eventCode ) |
---|
404 | case 1: // mouse up |
---|
405 | case 2: // Enter key |
---|
406 | case 3: // Live update |
---|
407 | Variable dval = sva.dval |
---|
408 | String sval = sva.sval |
---|
409 | |
---|
410 | // Variable LR_sep,TB_sep |
---|
411 | // // don't know if LR or TB called, so get the explicit values |
---|
412 | // // |
---|
413 | // ControlInfo VCALCCtrl_2a |
---|
414 | // LR_sep = V_Value |
---|
415 | // ControlInfo VCALCCtrl_2b |
---|
416 | // TB_sep = V_Value |
---|
417 | // |
---|
418 | // UpdateFrontDetector(LR_sep,TB_sep) |
---|
419 | |
---|
420 | UpdateSideView() |
---|
421 | UpdateTopView() |
---|
422 | FrontView_1x() |
---|
423 | |
---|
424 | fPlotMiddlePanels() |
---|
425 | |
---|
426 | break |
---|
427 | case -1: // control being killed |
---|
428 | break |
---|
429 | endswitch |
---|
430 | |
---|
431 | return 0 |
---|
432 | End |
---|
433 | |
---|
434 | // SDD for the Back detector. triggers a recalculation |
---|
435 | // of the intensity and a redraw of the banks |
---|
436 | // |
---|
437 | Function V_BDet_SDD_SetVarProc(sva) : SetVariableControl |
---|
438 | STRUCT WMSetVariableAction &sva |
---|
439 | |
---|
440 | switch( sva.eventCode ) |
---|
441 | case 1: // mouse up |
---|
442 | case 2: // Enter key |
---|
443 | case 3: // Live update |
---|
444 | Variable dval = sva.dval |
---|
445 | String sval = sva.sval |
---|
446 | |
---|
447 | // Variable LR_sep,TB_sep |
---|
448 | // // don't know if LR or TB called, so get the explicit values |
---|
449 | // // |
---|
450 | // ControlInfo VCALCCtrl_2a |
---|
451 | // LR_sep = V_Value |
---|
452 | // ControlInfo VCALCCtrl_2b |
---|
453 | // TB_sep = V_Value |
---|
454 | // |
---|
455 | // UpdateFrontDetector(LR_sep,TB_sep) |
---|
456 | |
---|
457 | UpdateSideView() |
---|
458 | UpdateTopView() |
---|
459 | FrontView_1x() |
---|
460 | |
---|
461 | fPlotBackPanels() |
---|
462 | |
---|
463 | break |
---|
464 | case -1: // control being killed |
---|
465 | break |
---|
466 | endswitch |
---|
467 | |
---|
468 | return 0 |
---|
469 | End |
---|
470 | |
---|
471 | // separation, either LR or TB of the front detector. triggers a recalculation |
---|
472 | // of the intensity and a redraw of the banks |
---|
473 | // |
---|
474 | Function V_FDet_LR_SetVarProc(sva) : SetVariableControl |
---|
475 | STRUCT WMSetVariableAction &sva |
---|
476 | |
---|
477 | switch( sva.eventCode ) |
---|
478 | case 1: // mouse up |
---|
479 | case 2: // Enter key |
---|
480 | case 3: // Live update |
---|
481 | Variable dval = sva.dval |
---|
482 | String sval = sva.sval |
---|
483 | |
---|
484 | Variable LR_sep,TB_sep |
---|
485 | // don't know if LR or TB called, so get the explicit values |
---|
486 | // |
---|
487 | ControlInfo VCALCCtrl_2a |
---|
488 | LR_sep = V_Value |
---|
489 | ControlInfo VCALCCtrl_2b |
---|
490 | TB_sep = V_Value |
---|
491 | |
---|
492 | // UpdateFrontDetector(LR_sep,TB_sep) |
---|
493 | |
---|
494 | UpdateSideView() |
---|
495 | UpdateTopView() |
---|
496 | FrontView_1x() |
---|
497 | |
---|
498 | fPlotFrontPanels() |
---|
499 | |
---|
500 | break |
---|
501 | case -1: // control being killed |
---|
502 | break |
---|
503 | endswitch |
---|
504 | |
---|
505 | return 0 |
---|
506 | End |
---|
507 | |
---|
508 | |
---|
509 | // separation, either LR or TB of the middle detector. triggers a recalculation |
---|
510 | // of the intensity and a redraw of the banks |
---|
511 | // |
---|
512 | Function V_MDet_LR_SetVarProc(sva) : SetVariableControl |
---|
513 | STRUCT WMSetVariableAction &sva |
---|
514 | |
---|
515 | switch( sva.eventCode ) |
---|
516 | case 1: // mouse up |
---|
517 | case 2: // Enter key |
---|
518 | case 3: // Live update |
---|
519 | Variable dval = sva.dval |
---|
520 | String sval = sva.sval |
---|
521 | |
---|
522 | Variable LR_sep,TB_sep |
---|
523 | // don't know if LR or TB called, so get the explicit values |
---|
524 | // |
---|
525 | ControlInfo VCALCCtrl_3a |
---|
526 | LR_sep = V_Value |
---|
527 | ControlInfo VCALCCtrl_3b |
---|
528 | TB_sep = V_Value |
---|
529 | |
---|
530 | // UpdateMiddleDetector(LR_sep,TB_sep) |
---|
531 | |
---|
532 | UpdateSideView() |
---|
533 | UpdateTopView() |
---|
534 | FrontView_1x() |
---|
535 | |
---|
536 | fPlotMiddlePanels() |
---|
537 | |
---|
538 | break |
---|
539 | case -1: // control being killed |
---|
540 | break |
---|
541 | endswitch |
---|
542 | |
---|
543 | return 0 |
---|
544 | End |
---|
545 | |
---|
546 | |
---|
547 | |
---|
548 | |
---|
549 | // this all needs to be fixed and updated - it is all pertinent to SANS (SASCALC) |
---|
550 | // and not yet specific to VSANS |
---|
551 | // |
---|
552 | // -- all of the simulation stuff will need to be re-thought |
---|
553 | // -- all of the integersRead, data, etc. will need to be re-thought... |
---|
554 | // -- but the space needs to be allocated. |
---|
555 | // -- parameters and constants need to be defined in their own space |
---|
556 | // |
---|
557 | // |
---|
558 | Proc V_Initialize_Space() |
---|
559 | // |
---|
560 | NewDataFolder/O root:Packages |
---|
561 | NewDataFolder/O root:Packages:NIST |
---|
562 | NewDataFolder/O root:Packages:NIST:VSANS |
---|
563 | NewDataFolder/O root:Packages:NIST:VSANS:VCALC |
---|
564 | NewDataFolder/O root:Packages:NIST:VSANS:VCALC:Front |
---|
565 | NewDataFolder/O root:Packages:NIST:VSANS:VCALC:Middle |
---|
566 | NewDataFolder/O root:Packages:NIST:VSANS:VCALC:Back |
---|
567 | |
---|
568 | |
---|
569 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
570 | |
---|
571 | Make/O/D/N=2 fpx1,fpy1,mpx1,mpy1 // for display of the detector panels |
---|
572 | Make/O/D/N=2 fv_degX,fv_degY |
---|
573 | |
---|
574 | // to fill in: |
---|
575 | // values for always-visible items |
---|
576 | String/G gPresetPopStr = "Low Q;High Q;Converging Pinholes;Narrow Slit Aperture;Converging Slits;White Beam;Polarizer;" |
---|
577 | String/G gBinTypeStr = "One;Two;Four;Slit Mode;" |
---|
578 | |
---|
579 | ///// FRONT DETECTOR BANKS |
---|
580 | // dimensions for the detector banks (then get them in the drawing functions) |
---|
581 | Variable/G gFront_LR_w = 384 //front bank, nominal LR panel width (mm) |
---|
582 | Variable/G gFront_LR_h = 1000 |
---|
583 | Variable/G gFront_TB_w = 500 |
---|
584 | Variable/G gFront_TB_h = 384 |
---|
585 | |
---|
586 | // SDD offset of T/B (decide on units??) |
---|
587 | Variable/G gFront_SDDOffset = 300 // (mm) |
---|
588 | |
---|
589 | // detector resolution (xy for each bank!) |
---|
590 | Variable/G gFront_L_pixelX = 0.8 // (cm) these tubes are vertical |
---|
591 | Variable/G gFront_L_pixelY = 0.4 // (cm) |
---|
592 | Variable/G gFront_R_pixelX = 0.8 // (cm) |
---|
593 | Variable/G gFront_R_pixelY = 0.4 // (cm) |
---|
594 | |
---|
595 | Variable/G gFront_T_pixelX = 0.4 // (cm) these tubes are horizontal |
---|
596 | Variable/G gFront_T_pixelY = 0.8 // (cm) |
---|
597 | Variable/G gFront_B_pixelX = 0.4 // (cm) |
---|
598 | Variable/G gFront_B_pixelY = 0.8 // (cm) |
---|
599 | |
---|
600 | // number of pixels in each bank (this can be modified at acquisition time, so it must be adjustable here) |
---|
601 | // allocate the detector arrays (+2D Q) |
---|
602 | |
---|
603 | |
---|
604 | ///// MIDDLE DETECTOR BANKS |
---|
605 | Variable/G gMiddle_LR_w = 384 //middle bank, nominal LR panel width (mm) |
---|
606 | Variable/G gMiddle_LR_h = 1000 |
---|
607 | Variable/G gMiddle_TB_w = 500 |
---|
608 | Variable/G gMiddle_TB_h = 384 |
---|
609 | // SDD offset of T/B (decide on units??) |
---|
610 | Variable/G gMiddle_SDDOffset = 300 // (mm) |
---|
611 | |
---|
612 | // detector resolution (xy for each bank!) |
---|
613 | Variable/G gMiddle_L_pixelX = 0.8 // (cm) these tubes are vertical |
---|
614 | Variable/G gMiddle_L_pixelY = 0.4 // (cm) |
---|
615 | Variable/G gMiddle_R_pixelX = 0.8 // (cm) |
---|
616 | Variable/G gMiddle_R_pixelY = 0.4 // (cm) |
---|
617 | |
---|
618 | Variable/G gMiddle_T_pixelX = 0.4 // (cm) these tubes are horizontal |
---|
619 | Variable/G gMiddle_T_pixelY = 0.8 // (cm) |
---|
620 | Variable/G gMiddle_B_pixelX = 0.4 // (cm) |
---|
621 | Variable/G gMiddle_B_pixelY = 0.8 // (cm) |
---|
622 | |
---|
623 | |
---|
624 | |
---|
625 | //// BACK DETECTOR |
---|
626 | Variable/G gBack_w = 320 //w and h for the back detector, (mm) |
---|
627 | Variable/G gBack_h = 320 |
---|
628 | Variable/G gBack_pixelX = 0.1 // 1mm resolution (units of cm here) |
---|
629 | Variable/G gBack_pixelY = 0.1 |
---|
630 | |
---|
631 | |
---|
632 | // Generate all of the waves used for the detector and the q values |
---|
633 | // |
---|
634 | // TODO: the detector dimensions need to be properly defined here... |
---|
635 | // FRONT |
---|
636 | SetDataFolder root:Packages:NIST:VSANS:VCALC:Front |
---|
637 | |
---|
638 | Make/O/D/N=(48,256) det_FL,det_FR |
---|
639 | Make/O/D/N=(128,48) det_FT,det_FB |
---|
640 | Duplicate/O det_FL qTot_FL,qx_FL,qy_FL,qz_FL |
---|
641 | Duplicate/O det_FR qTot_FR,qx_FR,qy_FR,qz_FR |
---|
642 | Duplicate/O det_FT qTot_FT,qx_FT,qy_FT,qz_FT |
---|
643 | Duplicate/O det_FB qTot_FB,qx_FB,qy_FB,qz_FB |
---|
644 | |
---|
645 | //MIDDLE |
---|
646 | // TODO: the detector dimensions need to be properly defined here... |
---|
647 | SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle |
---|
648 | |
---|
649 | Make/O/D/N=(48,256) det_ML,det_MR |
---|
650 | Make/O/D/N=(128,48) det_MT,det_MB |
---|
651 | Duplicate/O det_ML qTot_ML,qx_ML,qy_ML,qz_ML |
---|
652 | Duplicate/O det_MR qTot_MR,qx_MR,qy_MR,qz_MR |
---|
653 | Duplicate/O det_MT qTot_MT,qx_MT,qy_MT,qz_MT |
---|
654 | Duplicate/O det_MB qTot_MB,qx_MB,qy_MB,qz_MB |
---|
655 | |
---|
656 | // BACK |
---|
657 | // TODO: the detector dimensions need to be properly defined here... |
---|
658 | SetDataFolder root:Packages:NIST:VSANS:VCALC:Back |
---|
659 | |
---|
660 | Make/O/D/N=(320,320) det_B |
---|
661 | Duplicate/O det_B qTot_B,qx_B,qy_B,qz_B |
---|
662 | |
---|
663 | |
---|
664 | //////////// FOR THE PANEL |
---|
665 | |
---|
666 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
667 | |
---|
668 | // popup strings for each tab (then use the string in the panel) |
---|
669 | // tab 0 - collimation |
---|
670 | String/G gMonochromatorType = "Velocity Selector;Graphite;White Beam;" |
---|
671 | String/G gSourceShape = "circular;rectangular;converging pinholes;converging slits;" |
---|
672 | String/G gSourceDiam = "1.0 cm;2.0 cm;5.0 cm;" |
---|
673 | String/G gDeltaLambda = "0.10;0.20;0.30;" |
---|
674 | |
---|
675 | // tab 1 - sample conditions |
---|
676 | String/G gTableLocation = "Changer;Stage;" |
---|
677 | String/G gSampleApertureShape = "circular;rectangular;converging pinholes;converging slits;" |
---|
678 | String/G gSampleApertureDiam = "0.5;1.0;1.5;2.0;" |
---|
679 | |
---|
680 | // tab 2 |
---|
681 | |
---|
682 | // tab 3 |
---|
683 | |
---|
684 | // tab 4 - back detector |
---|
685 | String/G gBackDetType = "1D;2D;" |
---|
686 | |
---|
687 | // tab 5 |
---|
688 | String/G gModelFunctionType = "Debye;Sphere;Big Debye;Big Sphere;AgBeh;Vycor;Empty Cell;Blocked Beam;" |
---|
689 | |
---|
690 | |
---|
691 | //////////////////// |
---|
692 | |
---|
693 | |
---|
694 | |
---|
695 | // limits for detector travel? or are these limits part of the panel, hard-wired there |
---|
696 | |
---|
697 | |
---|
698 | // // for the panel |
---|
699 | |
---|
700 | Variable/G gNg=0 |
---|
701 | // Variable/G gOffset=0 |
---|
702 | Variable/G gSamAp=1.27 //samAp diameter in cm |
---|
703 | String/G gSourceApString = "1.43 cm;2.54 cm;3.81 cm;" |
---|
704 | String/G gApPopStr = "1/16\";1/8\";3/16\";1/4\";5/16\";3/8\";7/16\";1/2\";9/16\";5/8\";11/16\";3/4\";other;" |
---|
705 | Variable/G gSamApOther = 10 //non-standard aperture diameter, in mm |
---|
706 | Variable/G gUsingLenses = 0 //0=no lenses, 1=lenses(or prisms) |
---|
707 | // Variable/G gModelOffsetFactor = 1 |
---|
708 | // |
---|
709 | // // for the MC simulation |
---|
710 | // Variable/G doSimulation =0 // == 1 if 1D simulated data, 0 if other from the checkbox |
---|
711 | // Variable/G gRanDateTime=datetime |
---|
712 | // Variable/G gImon = 10000 |
---|
713 | // Variable/G gThick = 0.1 |
---|
714 | // Variable/G gSig_incoh = 0.1 |
---|
715 | // String/G gFuncStr = "" |
---|
716 | // Variable/G gR2 = 2.54/2 |
---|
717 | // Variable/G gSamTrans=0.8 //for 1D, default value |
---|
718 | // Variable/G gCntTime = 300 |
---|
719 | // Variable/G gDoMonteCarlo = 0 |
---|
720 | // Variable/G gUse_MC_XOP = 1 //set to zero to use Igor code |
---|
721 | // Variable/G gBeamStopIn = 1 //set to zero for beamstop out (transmission) |
---|
722 | // Variable/G gRawCounts = 0 |
---|
723 | // Variable/G gSaveIndex = 100 |
---|
724 | // String/G gSavePrefix = "SIMUL" |
---|
725 | // Variable/G gAutoSaveIndex = 100 //a way to set the index for automated saves |
---|
726 | // String/G gAutoSaveLabel = "" //a way to set the "sample" label for automated saves |
---|
727 | // Make/O/D/N=10 results = 0 |
---|
728 | // Make/O/T/N=10 results_desc = {"total X-section (1/cm)","SAS X-section (1/cm)","number that scatter","number that reach detector","avg # times scattered","fraction single coherent","fraction multiple coherent","fraction multiple scattered","fraction transmitted","detector counts w/beamstop"} |
---|
729 | // |
---|
730 | // Variable/G g_1DTotCts = 0 //summed counts (simulated) |
---|
731 | // Variable/G g_1DEstDetCR = 0 // estimated detector count rate |
---|
732 | // Variable/G g_1DFracScatt = 0 // fraction of beam captured on detector |
---|
733 | // Variable/G g_1DEstTrans = 0 // estimated transmission of sample |
---|
734 | // Variable/G g_1D_DoABS = 1 |
---|
735 | // Variable/G g_1D_AddNoise = 1 |
---|
736 | // Variable/G g_MultScattFraction=0 |
---|
737 | // Variable/G g_detectorEff=0.75 //average value for most wavelengths |
---|
738 | // Variable/G g_actSimTime = 0 //for the save |
---|
739 | // Variable/G g_SimTimeWarn = 10 //manually set to a very large value for scripted operation |
---|
740 | // |
---|
741 | |
---|
742 | // |
---|
743 | // //for the fake dependency |
---|
744 | // Variable/G gTouched=0 |
---|
745 | // Variable/G gCalculate=0 |
---|
746 | // //for plotting |
---|
747 | // Variable/G gFreezeCount=1 //start the count at 1 to keep Jeff happy |
---|
748 | // Variable/G gDoTraceOffset=0 // (1==Yes, offset 2^n), 0==turn off the offset |
---|
749 | |
---|
750 | |
---|
751 | |
---|
752 | // |
---|
753 | // instrument - specific dimensions |
---|
754 | // |
---|
755 | |
---|
756 | // |
---|
757 | Variable/G gInstrument = 6 // files (may) be tagged SA6 as the 6th SANS instrument |
---|
758 | Variable/G gS12 = 54.8 |
---|
759 | // Variable/G d_det = 0.5 |
---|
760 | // Variable/G a_pixel = 0.5 |
---|
761 | // Variable/G del_r = 0.5 |
---|
762 | // Variable/G det_width = 64.0 |
---|
763 | Variable/G gLambda_t = 5.50 |
---|
764 | Variable/G gL2r_lower = 132.3 |
---|
765 | Variable/G gL2r_upper = 1317 |
---|
766 | Variable/G gLambda_lower = 2.5 |
---|
767 | Variable/G gLambda_upper = 20.0 |
---|
768 | Variable/G gD_upper = 25.0 |
---|
769 | Variable/G gBs_factor = 1.05 |
---|
770 | Variable/G gT1 = 0.63 |
---|
771 | Variable/G gT2 = 1.0 |
---|
772 | Variable/G gT3 = 0.75 |
---|
773 | Variable/G gL_gap = 100.0 |
---|
774 | Variable/G gGuide_width = 6.0 |
---|
775 | Variable/G gIdmax = 100.0 |
---|
776 | |
---|
777 | // |
---|
778 | // //new values, from 11/2009 --- BeamFluxReport_2009.ifn |
---|
779 | Variable/G gPhi_0 = 2.42e13 |
---|
780 | Variable/G gB = 0.0 |
---|
781 | Variable/G gC = -0.0243 |
---|
782 | Variable/G gGuide_loss = 0.924 |
---|
783 | // |
---|
784 | // //fwhm values (new variables) (+3, 0, -3, calibrated 2009) |
---|
785 | Variable/G gFwhm_narrow = 0.109 |
---|
786 | Variable/G gFwhm_mid = 0.125 |
---|
787 | Variable/G gFwhm_wide = 0.236 |
---|
788 | // |
---|
789 | // //source apertures (cm) |
---|
790 | Variable/G gA1_0_0 = 1.43 |
---|
791 | Variable/G gA1_0_1 = 2.54 |
---|
792 | Variable/G gA1_0_2 = 3.81 |
---|
793 | Variable/G gA1_7_0 = 2.5 // after the polarizer |
---|
794 | Variable/G gA1_7_1 = 5.0 |
---|
795 | Variable/G gA1_7_1 = 0.95 // |
---|
796 | Variable/G gA1_def = 5.00 |
---|
797 | // |
---|
798 | SetDataFolder root: |
---|
799 | end |
---|