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