source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_VCALCPanel_MockUp.ipf @ 1117

Last change on this file since 1117 was 1117, checked in by srkline, 4 years ago

extensive changes to accomodate 1x1 binning of the HighRes? detector. It is implemented as a global flag. Currently only 4x4 and 1x1 are allowed. 1x1 has never been tested in reality, only simulated data - so my assumed dimensions may not be correct. look for TODOHIGHRES in the file for places that may need to be updated for different file dimensions. Testing of the simulated data is proving to be excruciatingly slow, but passable for a test. Speed optimization will be needed if this is the final solution. Memory management will also be an issue since every "copy" of the highRes matrix is enormous. Carry as few of these around as possible in the future to keep the experiment size to something reasonable.

File size: 38.9 KB
Line 
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
18Proc VCALC_Panel()
19        DoWindow/F VCALC
20        if(V_flag==0)
21       
22                //initialize space = folders, parameters, instrument constants, etc.
23                VC_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
40End
41
42Function FakeFrontMiddleSDDClick()
43       
44        STRUCT WMSetVariableAction sva
45        sva.eventCode = 3
46//      sva.dval = 0.3
47
48        VC_BDet_SDD_SetVarProc(sva)             
49        VC_MDet_SDD_SetVarProc(sva)
50        VC_FDet_SDD_SetVarProc(sva)
51
52        return(0)
53end
54
55
56Proc 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        PopupMenu popup_a,proc=VC_PresetConfigPopup
74
75        PopupMenu popup_b,pos={670,311},size={142,20},title="Binning type",proc=VC_RebinIQ_PopProc
76        PopupMenu popup_b,mode=1,value= root:Packages:NIST:VSANS:VCALC:gBinTypeStr
77        SetVariable setVar_b,pos={476,313},size={120,15},title="axis Q",proc=Front2DQ_Range_SetVarProc
78        SetVariable setVar_b,limits={0.02,1,0.02},value=_NUM:0.3
79        CheckBox check_0a title="Log?",size={60,20},pos={619,313},proc=Front2DQ_Log_CheckProc
80               
81        SetVariable setVar_a,pos={476,26},size={120,15},title="axis degrees",proc=FrontView_Range_SetVarProc
82        SetVariable setVar_a,limits={0.3,30,0.2},value=_NUM:20
83
84        ValDisplay valDisp_a,pos={50,100},size={150,15},title="Beam Intensity",value=root:Packages:NIST:VSANS:VCALC:gBeamIntensity
85
86
87
88        // for panels (in degrees)     
89        Display/W=(476,45,757,303)/HOST=# root:Packages:NIST:VSANS:VCALC:fv_degY vs root:Packages:NIST:VSANS:VCALC:fv_degX
90        RenameWindow #,FrontView
91        ModifyGraph mode=2              // mode = 2 = dots
92        ModifyGraph marker=19
93        ModifyGraph rgb=(0,0,0)
94        ModifyGraph tick=2,mirror=1
95        Label left "degrees"
96        Label bottom "degrees" 
97        SetActiveSubwindow ##
98
99
100        // for side view
101        Display/W=(842,25,1200,170)/HOST=# root:Packages:NIST:VSANS:VCALC:fv_degY vs root:Packages:NIST:VSANS:VCALC:fv_degX
102        RenameWindow #,SideView
103        ModifyGraph mode=2              // mode = 2 = dots
104        ModifyGraph marker=19
105        ModifyGraph rgb=(0,0,0)
106        ModifyGraph tick=2,mirror=1
107        Label left "Vertical position (cm)"
108        Label bottom "SDD (cm)"
109        SetActiveSubwindow ##   
110       
111        // for top view
112        Display/W=(842,180,1200,325)/HOST=# root:Packages:NIST:VSANS:VCALC:fv_degY vs root:Packages:NIST:VSANS:VCALC:fv_degX
113        RenameWindow #,TopView
114        ModifyGraph mode=2              // mode = 2 = dots
115        ModifyGraph marker=19
116        ModifyGraph rgb=(0,0,0)
117        ModifyGraph tick=2,mirror=1
118        Label left "Horizontal position (cm)"
119        Label bottom "SDD (cm)"
120        SetActiveSubwindow ##   
121
122        // for panels (as 2D Q)
123        Display/W=(475,332,814,631)/HOST=# root:Packages:NIST:VSANS:VCALC:fv_degY vs root:Packages:NIST:VSANS:VCALC:fv_degX
124        RenameWindow #,Panels_Q
125        ModifyGraph mode=2              // mode = 2 = dots
126        ModifyGraph tick=2,mirror=1,grid=2,standoff=0
127        ModifyGraph width={Aspect,1},height={Aspect,1},gbRGB=(56797,56797,56797)
128        SetAxis left -0.2,0.2
129        SetAxis bottom -0.2,0.2
130        Label left "Qy"
131        Label bottom "Qx"       
132        SetActiveSubwindow ##
133
134
135
136        // for averaged I(Q)
137        Display/W=(842,334,1204,629)/HOST=# //root:Packages:NIST:VCALC:fv_degY vs root:Packages:NIST:VSANS:VCALC:fv_degX
138        RenameWindow #,Panels_IQ
139//      ModifyGraph mode=2              // mode = 2 = dots
140        ModifyGraph tick=2,mirror=1,grid=2
141//      Label left "Intensity"
142//      Label bottom "Q"       
143        SetActiveSubwindow ##
144
145
146       
147// all controls are named VCALCCtrl_NA where N is the tab number and A is the letter indexing items on tab
148
149       
150// tab(0), collimation - initially visible
151        Slider VCALCCtrl_0a,pos={223,324},size={200,45},limits={0,10,1},value= 1,vert= 0
152        SetVariable VCALCCtrl_0b,pos={25,294},size={120,15},title="wavelength"
153        SetVariable VCALCCtrl_0b,limits={4,20,1},value=_NUM:8,proc=VC_Lambda_SetVarProc
154        PopupMenu VCALCCtrl_0c,pos={26,257},size={150,20},title="monochromator"
155        PopupMenu VCALCCtrl_0c,mode=1,popvalue="Velocity Selector",value= root:Packages:NIST:VSANS:VCALC:gMonochromatorType
156        PopupMenu VCALCCtrl_0c,proc=VC_MonochromSelectPopup
157        PopupMenu VCALCCtrl_0d,pos={26,321},size={115,20},title="delta lambda"
158        PopupMenu VCALCCtrl_0d,mode=1,popvalue="0.10",value= root:Packages:NIST:VSANS:VCALC:gDeltaLambda
159        PopupMenu VCALCCtrl_0d,proc=VC_DeltaLamSelectPopup
160        PopupMenu VCALCCtrl_0e,pos={291,262},size={132,20},title="source shape"
161        PopupMenu VCALCCtrl_0e,mode=1,popvalue="circular",value= root:Packages:NIST:VSANS:VCALC:gSourceShape
162        PopupMenu VCALCCtrl_0e,proc=VC_SourceApShapeSelectPopup
163        PopupMenu VCALCCtrl_0f,pos={283,293},size={141,20},title="source aperture"
164        PopupMenu VCALCCtrl_0f,mode=1,popvalue="1.0 cm",value= root:Packages:NIST:VSANS:VCALC:gSourceDiam
165        PopupMenu VCALCCtrl_0f,proc=VC_SourceAperDiamSelectPopup
166
167
168// tab(1) - Sample conditions, initially not visible
169        PopupMenu VCALCCtrl_1a,pos={38,270},size={142,20},title="table location",disable=1
170        PopupMenu VCALCCtrl_1a,mode=1,popvalue="Changer",value= root:Packages:NIST:VSANS:VCALC:gTableLocation
171        PopupMenu VCALCCtrl_1b,pos={270,270},size={115,20},title="Aperture Shape",disable=1
172        PopupMenu VCALCCtrl_1b,mode=1,popvalue="circular",value= root:Packages:NIST:VSANS:VCALC:gSampleApertureShape
173        PopupMenu VCALCCtrl_1c,pos={270,330},size={132,20},title="Aperture Size (cm)",disable=1
174        PopupMenu VCALCCtrl_1c,mode=1,popvalue="0.5",value= root:Packages:NIST:VSANS:VCALC:gSampleApertureDiam
175       
176
177// tab(2) - Front detector panels, initially not visible
178        SetVariable VCALCCtrl_2a,pos={30,260},size={150,15},title="LEFT Offset (cm)",proc=VC_FDet_LR_SetVarProc
179        SetVariable VCALCCtrl_2a,limits={-20,19,0.1},disable=1,value=_NUM:-10
180        SetVariable VCALCCtrl_2aa,pos={30,290},size={150,15},title="RIGHT Offset (cm)",proc=VC_FDet_LR_SetVarProc
181        SetVariable VCALCCtrl_2aa,limits={-19,20,0.1},disable=1,value=_NUM:10
182       
183        SetVariable VCALCCtrl_2b,pos={30,330},size={150,15},title="TOP Offset (cm)",proc=VC_FDet_LR_SetVarProc
184        SetVariable VCALCCtrl_2b,limits={0,18,0.1},disable=1,value=_NUM:10
185        SetVariable VCALCCtrl_2bb,pos={30,360},size={150,15},title="BOTTOM Offset (cm)",proc=VC_FDet_LR_SetVarProc
186        SetVariable VCALCCtrl_2bb,limits={-18,0,0.1},disable=1,value=_NUM:-10
187       
188        SetVariable VCALCCtrl_2d,pos={205,260},size={230,15},title="Sample to Detector Distance (cm)",proc=VC_FDet_SDD_SetVarProc
189        SetVariable VCALCCtrl_2d,limits={100,800,1},disable=1   ,value=_NUM:150
190       
191
192// tab(3) - Middle detector panels, initially not visible
193        SetVariable VCALCCtrl_3a,pos={30,260},size={150,15},title="LEFT Offset (cm)",proc=VC_MDet_LR_SetVarProc
194        SetVariable VCALCCtrl_3a,limits={-20,19,0.1},disable=1,value=_NUM:-7
195        SetVariable VCALCCtrl_3aa,pos={30,290},size={150,15},title="RIGHT Offset (cm)",proc=VC_MDet_LR_SetVarProc
196        SetVariable VCALCCtrl_3aa,limits={-19,20,0.1},disable=1,value=_NUM:7
197               
198        SetVariable VCALCCtrl_3b,pos={30,330},size={150,15},title="TOP Offset (cm)",proc=VC_MDet_LR_SetVarProc
199        SetVariable VCALCCtrl_3b,limits={0,18,0.1},disable=1,value=_NUM:14
200        SetVariable VCALCCtrl_3bb,pos={30,360},size={150,15},title="BOTTOM Offset (cm)",proc=VC_MDet_LR_SetVarProc
201        SetVariable VCALCCtrl_3bb,limits={-18,0,0.1},disable=1,value=_NUM:-14
202
203        SetVariable VCALCCtrl_3d,pos={205,260},size={230,15},title="Sample to Detector Distance (cm)",proc=VC_MDet_SDD_SetVarProc
204        SetVariable VCALCCtrl_3d,limits={800,2000,1},disable=1,value=_NUM:1000
205
206       
207// tab(4) - Back detector panel
208        SetVariable VCALCCtrl_4a,pos={188,290},size={150,15},title="Lateral Offset (cm)"
209        SetVariable VCALCCtrl_4a,limits={0,20,0.1},disable=1,value=_NUM:0
210        SetVariable VCALCCtrl_4b,pos={188,260},size={230,15},title="Sample to Detector Distance (cm)",proc=VC_BDet_SDD_SetVarProc
211        SetVariable VCALCCtrl_4b,limits={2000,2500,1},disable=1,value=_NUM:2200
212//      PopupMenu VCALCCtrl_4c,pos={40,260},size={180,20},title="Detector type",disable=1
213//      PopupMenu VCALCCtrl_4c,mode=1,popvalue="2D",value= root:Packages:NIST:VSANS:VCALC:gBackDetType
214
215// tab(5) - Simulation setup
216        SetVariable VCALCCtrl_5a,pos={40,290},size={200,15},title="Neutrons on Sample (imon)"
217        SetVariable VCALCCtrl_5a,limits={1e7,1e15,1e7},disable=1,value=_NUM:1e11,proc=VC_SimImon_SetVarProc
218        PopupMenu VCALCCtrl_5b,pos={40,260},size={180,20},title="Model Function",disable=1
219        PopupMenu VCALCCtrl_5b,mode=1,popvalue="Debye",value= root:Packages:NIST:VSANS:VCALC:gModelFunctionType,proc=VC_SimModelFunc_PopProc
220       
221End
222
223//
224// just recalculates the detector panels, doesn't adjust the views
225//
226Function Recalculate_AllDetectors()
227
228        fPlotBackPanels()
229        fPlotMiddlePanels()
230        fPlotFrontPanels()
231
232        V_beamIntensity()
233       
234        return(0)
235End
236
237// function to control the drawing of controls in the TabControl on the main panel
238// Naming scheme for the controls MUST be strictly adhered to... else controls will
239// appear in odd places...
240// all controls are named VCALCCtrl_NA where N is the tab number and A is the letter denoting
241// the controls position on that particular tab.
242// in this way, they will always be drawn correctly..
243//
244//
245// -- this will need to be modified to allow for the graph to be drawn of the detector bank positions
246//     if that is individual to each tab - or if it's  always visible - that's still to be decided.
247//
248//
249Function VCALCTabProc(name,tab)
250        String name
251        Variable tab
252       
253//      Print "name,number",name,tab
254        String ctrlList = ControlNameList("",";"),item="",nameStr=""
255        Variable num = ItemsinList(ctrlList,";"),ii,onTab
256        for(ii=0;ii<num;ii+=1)
257                //items all start w/"VCALCCtrl_", 10 characters
258                item=StringFromList(ii, ctrlList ,";")
259                nameStr=item[0,9]
260                if(cmpstr(nameStr,"VCALCCtrl_")==0)
261                        onTab = str2num(item[10])                       //[10] is a number
262                        ControlInfo $item
263                        switch(abs(V_flag))     
264                                case 1:
265                                        Button $item,disable=(tab!=onTab)
266                                        break
267                                case 2:
268                                        CheckBox $item,disable=(tab!=onTab)
269                                        break
270                                case 3:
271                                        PopupMenu $item,disable=(tab!=onTab)
272                                        break
273                                case 4:
274                                        ValDisplay $item,disable=(tab!=onTab)
275                                        break
276                                case 5:
277                                        SetVariable $item,disable=(tab!=onTab)
278                                        break
279                                case 7:
280                                        Slider $item,disable=(tab!=onTab)
281                                        break
282                                case 9:
283                                        GroupBox $item,disable=(tab!=onTab)
284                                        break
285                                case 10:       
286                                        TitleBox $item,disable=(tab!=onTab)
287                                        break
288                                // add more items to the switch if different control types are used
289                        endswitch
290                endif
291        endfor
292       
293
294       
295        return(0)
296End
297
298Function Front2DQ_Log_CheckProc(cba) : CheckBoxControl
299        STRUCT WMCheckboxAction &cba
300
301        switch( cba.eventCode )
302                case 2: // mouse up
303                        Variable checked = cba.checked
304                       
305                        Execute "FrontPanels_AsQ()"
306                        Execute "MiddlePanels_AsQ()"
307                        Execute "BackPanels_AsQ()"
308                       
309                        break
310                case -1: // control being killed
311                        break
312        endswitch
313
314        return 0
315End
316
317
318
319       
320
321
322
323
324Function VC_SourceAperDiamSelectPopup(pa) : PopupMenuControl
325        STRUCT WMPopupAction &pa
326
327        switch( pa.eventCode )
328                case 2: // mouse up
329                        Variable popNum = pa.popNum
330                        String popStr = pa.popStr
331                       
332                        Print "Not filled in yet"
333                       
334                        // a recalculation is needed after the change
335                        //Recalculate_AllDetectors()
336                                       
337                        break
338                case -1: // control being killed
339                        break
340        endswitch
341
342        return 0
343End
344
345Function VC_SourceApShapeSelectPopup(pa) : PopupMenuControl
346        STRUCT WMPopupAction &pa
347
348        switch( pa.eventCode )
349                case 2: // mouse up
350                        Variable popNum = pa.popNum
351                        String popStr = pa.popStr
352                       
353                        Print "Not filled in yet"
354
355                        // a recalculation is needed after the change
356                        //Recalculate_AllDetectors()
357                                                                       
358                        break
359                case -1: // control being killed
360                        break
361        endswitch
362
363        return 0
364End
365
366Function VC_DeltaLamSelectPopup(pa) : PopupMenuControl
367        STRUCT WMPopupAction &pa
368
369        switch( pa.eventCode )
370                case 2: // mouse up
371                        Variable popNum = pa.popNum
372                        String popStr = pa.popStr
373                       
374                        // a recalculation is needed after the change
375                        Recalculate_AllDetectors()
376                                                                       
377                        break
378                case -1: // control being killed
379                        break
380        endswitch
381
382        return 0
383End
384
385// change the choices for deltaLam based on the
386// type of monochromator selected
387//
388// some cases force a change of the wavelength
389//
390// then recalculate
391Function VC_MonochromSelectPopup(pa) : PopupMenuControl
392        STRUCT WMPopupAction &pa
393
394        switch( pa.eventCode )
395                case 2: // mouse up
396                        Variable popNum = pa.popNum
397                        String popStr = pa.popStr
398                       
399                        SVAR DLStr = root:Packages:NIST:VSANS:VCALC:gDeltaLambda
400                       
401                        strswitch(popStr)
402                                case "Velocity Selector":
403                                        DLStr = "0.12;"
404//                                      PopupMenu VCALCCtrl_0d,mode=1,popvalue="0.12",value= root:Packages:NIST:VSANS:VCALC:gDeltaLambda
405                                        PopupMenu VCALCCtrl_0d,mode=1,popvalue="0.12"
406                                       
407                                        SetVariable VCALCCtrl_0b,disable=0,noedit=0             // allow user editing again
408
409                                        break
410                                case "Graphite":
411                                        DLStr = "0.01;"
412//                                      PopupMenu VCALCCtrl_0d,mode=1,popvalue="0.01",value= root:Packages:NIST:VSANS:VCALC:gDeltaLambda
413                                        PopupMenu VCALCCtrl_0d,mode=1,popvalue="0.01"
414                                       
415                                        SetVariable VCALCCtrl_0b,value=_NUM:4.75,disable=2              // wavelength
416                                        break
417                                case "White Beam":
418                                        DLStr = "0.40;"
419//                                      PopupMenu VCALCCtrl_0d,mode=1,popvalue="0.40",value= root:Packages:NIST:VSANS:VCALC:gDeltaLambda
420                                        PopupMenu VCALCCtrl_0d,mode=1,popvalue="0.40"
421
422                                        SetVariable VCALCCtrl_0b,value=_NUM:5.3,disable=2               //wavelength
423                                        break           
424                                default:
425                                        Print "Error--No match in VC_MonochromSelectPopup"
426                                        return(0)
427                        endswitch
428                       
429
430                        // a recalculation is needed after the change
431                        Recalculate_AllDetectors()
432                                                               
433                        break
434                case -1: // control being killed
435                        break
436        endswitch
437
438        return 0
439End
440
441
442Function VC_PresetConfigPopup(pa) : PopupMenuControl
443        STRUCT WMPopupAction &pa
444
445        switch( pa.eventCode )
446                case 2: // mouse up
447                        Variable popNum = pa.popNum
448                        String popStr = pa.popStr
449                       
450                        String BinStr = "F2-M2xTB-B"
451               
452                        strswitch(popStr)
453                                case "Low Q":
454                                       
455                                        break
456                                case "High Q":
457                                       
458                                        break
459                                case "White Beam":
460                                        VC_WhiteBeamPreset()
461                                        binStr = "F4-M4-B"
462                                        break   
463                                case "Graphite":
464                                        VC_GraphiteMonoPreset()
465                                        binStr = "F4-M4-B"
466                                        break
467                                case "Narrow Slit":
468                                       
469                                        break
470                                case "Front+Middle Only":
471                                        VC_FrontMiddlePreset()
472                                        binStr = "F2-M2xTB-B"
473                                        break
474                                case "Converging Pinholes":
475                                       
476                                        break
477                                case "Polarizer":
478                                       
479                                        break
480                                       
481                                default:
482                                        Print "Error--No match in VC_PresetConfigPopup"
483                                        return(0)
484                        endswitch
485                       
486                        // update the views
487                        VC_UpdateViews()
488                       
489                        // a recalculation is needed after the change
490                        Recalculate_AllDetectors()
491                       
492                        // re-bin the data?
493                        VC_RebinIQ_PopProc("",0,binStr)
494                                       
495                        break
496                case -1: // control being killed
497                        break
498        endswitch
499
500        return 0
501End
502
503
504
505
506
507//
508// recalculate the detectors with a preset model function
509//
510Function VC_SimModelFunc_PopProc(ctrlName,popNum,popStr) : PopupMenuControl
511        String ctrlName
512        Variable popNum // which item is currently selected (1-based)
513        String popStr           // contents of current popup item as string
514
515        Recalculate_AllDetectors()
516       
517        return(0)       
518End
519
520
521//
522// recalculate the I(q) binning. no need to adjust model function or views
523// just rebin
524//
525// this is for the VCALC 1-D plot subwindow only. so it is set up to
526// operate on that window - but uses the same binning and plotting routines
527// as the regualr VSANS data display
528//
529Function VC_RebinIQ_PopProc(ctrlName,popNum,popStr) : PopupMenuControl
530        String ctrlName
531        Variable popNum // which item is currently selected (1-based)
532        String popStr           // contents of current popup item as string
533
534
535        String type = "VCALC"
536        String str,winStr="VCALC#Panels_IQ",workTypeStr
537        workTypeStr = "root:Packages:NIST:VSANS:"+type
538       
539        String collimationStr = "pinhole"               //TODO: fill this in from the VCALC panel
540       
541// dispatch based on the string, not on the number of selection in the pop string
542        V_QBinAllPanels_Circular(type,V_BinTypeStr2Num(popStr),collimationStr)
543       
544        sprintf str,"(\"%s\",%d,\"%s\")",workTypeStr,V_BinTypeStr2Num(popStr),winStr
545
546        Execute ("V_Back_IQ_Graph"+str)
547        Execute ("V_Middle_IQ_Graph"+str)
548        Execute ("V_Front_IQ_Graph"+str)
549
550// OLD - do not use
551//      // do the q-binning for front panels to get I(Q)
552//      Execute "BinAllFrontPanels()"
553//      Execute "Front_IQ_Graph()"
554//
555//      // do the q-binning for middle panels to get I(Q)
556//      Execute "BinAllMiddlePanels()"
557//      Execute "Middle_IQ_Graph()"
558//     
559//      // do the q-binning for the back panel to get I(Q)
560//      Execute "BinAllBackPanels()"
561//      Execute "Back_IQ_Graph()"
562//     
563        return(0)       
564End
565
566
567
568       
569       
570//
571// setVar for the wavelength
572//
573Function VC_Lambda_SetVarProc(sva) : SetVariableControl
574        STRUCT WMSetVariableAction &sva
575
576        switch( sva.eventCode )
577                case 1: // mouse up
578                case 2: // Enter key
579                case 3: // Live update
580                        Variable dval = sva.dval
581                        String sval = sva.sval
582                       
583//                      // don't need to recalculate the views, but need to recalculate the detectors
584//                      fPlotBackPanels()
585//                      fPlotMiddlePanels()
586//                      fPlotFrontPanels()
587
588                        Recalculate_AllDetectors()             
589                               
590                        break
591                case -1: // control being killed
592                        break
593        endswitch
594
595        return 0
596End
597
598//
599// setVar for the simulation monitor count
600//
601Function VC_SimImon_SetVarProc(sva) : SetVariableControl
602        STRUCT WMSetVariableAction &sva
603
604        switch( sva.eventCode )
605                case 1: // mouse up
606                case 2: // Enter key
607                case 3: // Live update
608                        Variable dval = sva.dval
609                        String sval = sva.sval
610
611                        Recalculate_AllDetectors()             
612                               
613                        break
614                case -1: // control being killed
615                        break
616        endswitch
617
618        return 0
619End
620
621
622// setVar for the range (in degrees) for the FrontView plot of the detectors
623//
624Function FrontView_Range_SetVarProc(sva) : SetVariableControl
625        STRUCT WMSetVariableAction &sva
626
627        switch( sva.eventCode )
628                case 1: // mouse up
629                case 2: // Enter key
630                case 3: // Live update
631                        Variable dval = sva.dval
632                        String sval = sva.sval
633                       
634                        FrontView_1x()
635                       
636                        break
637                case -1: // control being killed
638                        break
639        endswitch
640
641        return 0
642End
643
644// setVar for the range (in Q) for the FrontView plot of the detectors
645//
646// TODO: this assumes that everything (the data) is already updated - this only updates the plot range
647Function Front2DQ_Range_SetVarProc(sva) : SetVariableControl
648        STRUCT WMSetVariableAction &sva
649
650        switch( sva.eventCode )
651                case 1: // mouse up
652                case 2: // Enter key
653                case 3: // Live update
654                        Variable dval = sva.dval
655                        String sval = sva.sval
656                       
657                        SetAxis/W=VCALC#Panels_Q left -dval,dval
658                        SetAxis/W=VCALC#Panels_Q bottom -dval,dval
659                       
660//                      FrontPanels_AsQ()
661                       
662                        break
663                case -1: // control being killed
664                        break
665        endswitch
666
667        return 0
668End
669
670// SDD for the Front detector. triggers a recalculation
671// of the intensity and a redraw of the banks
672//
673Function VC_FDet_SDD_SetVarProc(sva) : SetVariableControl
674        STRUCT WMSetVariableAction &sva
675
676        switch( sva.eventCode )
677                case 1: // mouse up
678                case 2: // Enter key
679                case 3: // Live update
680                        Variable dval = sva.dval
681                        String sval = sva.sval
682                       
683//                      Variable LR_sep,TB_sep
684//                      // don't know if LR or TB called, so get the explicit values
685//                      //
686//                      ControlInfo VCALCCtrl_2a
687//                      LR_sep = V_Value
688//                      ControlInfo VCALCCtrl_2b
689//                      TB_sep = V_Value
690//                     
691//                      UpdateFrontDetector(LR_sep,TB_sep)
692                       
693                        UpdateSideView()
694                        UpdateTopView()
695                        FrontView_1x()
696                       
697                        fPlotFrontPanels()
698                       
699                        break
700                case -1: // control being killed
701                        break
702        endswitch
703
704        return 0
705End
706
707// SDD for the Middle detector. triggers a recalculation
708// of the intensity and a redraw of the banks
709//
710Function VC_MDet_SDD_SetVarProc(sva) : SetVariableControl
711        STRUCT WMSetVariableAction &sva
712
713        switch( sva.eventCode )
714                case 1: // mouse up
715                case 2: // Enter key
716                case 3: // Live update
717                        Variable dval = sva.dval
718                        String sval = sva.sval
719                       
720//                      Variable LR_sep,TB_sep
721//                      // don't know if LR or TB called, so get the explicit values
722//                      //
723//                      ControlInfo VCALCCtrl_2a
724//                      LR_sep = V_Value
725//                      ControlInfo VCALCCtrl_2b
726//                      TB_sep = V_Value
727//                     
728//                      UpdateFrontDetector(LR_sep,TB_sep)
729                       
730                        UpdateSideView()
731                        UpdateTopView()
732                        FrontView_1x()
733                       
734                        fPlotMiddlePanels()
735                       
736                        break
737                case -1: // control being killed
738                        break
739        endswitch
740
741        return 0
742End
743
744// SDD for the Back detector. triggers a recalculation
745// of the intensity and a redraw of the banks
746//
747Function VC_BDet_SDD_SetVarProc(sva) : SetVariableControl
748        STRUCT WMSetVariableAction &sva
749
750        switch( sva.eventCode )
751                case 1: // mouse up
752                case 2: // Enter key
753                case 3: // Live update
754                        Variable dval = sva.dval
755                        String sval = sva.sval
756                       
757//                      Variable LR_sep,TB_sep
758//                      // don't know if LR or TB called, so get the explicit values
759//                      //
760//                      ControlInfo VCALCCtrl_2a
761//                      LR_sep = V_Value
762//                      ControlInfo VCALCCtrl_2b
763//                      TB_sep = V_Value
764//                     
765//                      UpdateFrontDetector(LR_sep,TB_sep)
766                       
767                        UpdateSideView()
768                        UpdateTopView()
769                        FrontView_1x()
770                       
771                        fPlotBackPanels()
772                       
773                        break
774                case -1: // control being killed
775                        break
776        endswitch
777
778        return 0
779End
780
781// separation, either LR or TB of the front detector. triggers a recalculation
782// of the intensity and a redraw of the banks
783//
784Function VC_FDet_LR_SetVarProc(sva) : SetVariableControl
785        STRUCT WMSetVariableAction &sva
786
787        switch( sva.eventCode )
788                case 1: // mouse up
789                case 2: // Enter key
790                case 3: // Live update
791                        Variable dval = sva.dval
792                        String sval = sva.sval
793                       
794//                      Variable LR_sep,TB_sep
795//                      // don't know if LR or TB called, so get the explicit values
796//                      //
797//                      ControlInfo VCALCCtrl_2a
798//                      LR_sep = V_Value
799//                      ControlInfo VCALCCtrl_2b
800//                      TB_sep = V_Value
801//                     
802//                      UpdateFrontDetector(LR_sep,TB_sep)
803                       
804                        UpdateSideView()
805                        UpdateTopView()
806                        FrontView_1x()
807                       
808                        fPlotFrontPanels()
809                       
810                        break
811                case -1: // control being killed
812                        break
813        endswitch
814
815        return 0
816End
817
818
819// separation, either LR or TB of the middle detector. triggers a recalculation
820// of the intensity and a redraw of the banks
821//
822Function VC_MDet_LR_SetVarProc(sva) : SetVariableControl
823        STRUCT WMSetVariableAction &sva
824
825        switch( sva.eventCode )
826                case 1: // mouse up
827                case 2: // Enter key
828                case 3: // Live update
829                        Variable dval = sva.dval
830                        String sval = sva.sval
831                       
832//                      Variable LR_sep,TB_sep
833//                      // don't know if LR or TB called, so get the explicit values
834//                      //
835//                      ControlInfo VCALCCtrl_3a
836//                      LR_sep = V_Value
837//                      ControlInfo VCALCCtrl_3b
838//                      TB_sep = V_Value
839                       
840//                      UpdateMiddleDetector(LR_sep,TB_sep)
841                       
842                        UpdateSideView()
843                        UpdateTopView()
844                        FrontView_1x()
845                       
846                        fPlotMiddlePanels()
847                       
848                        break
849                case -1: // control being killed
850                        break
851        endswitch
852
853        return 0
854End
855
856// call to update the views (not the q-calculation, that is a separate call)
857Function VC_UpdateViews()
858
859        UpdateSideView()
860        UpdateTopView()
861        FrontView_1x()
862       
863        return(0)
864End
865
866// this all needs to be fixed and updated - not yet specific to VSANS
867//
868// -- all of the simulation stuff will need to be re-thought
869// -- all of the integersRead, data, etc. will need to be re-thought...
870// -- but the space needs to be allocated.
871// -- parameters and constants need to be defined in their own space
872//
873// FEB 2016 -- changed the data folder space to mimic the HDF folder structure
874// so that the averaging routines could be re-used (along with everything else)
875// -- painful, but better in the long run
876//
877// -- I have not re-named the detector arrays to all be "data" since that is very difficult to
878//   deal with on images. Added a global "gVCALC_Active" as a crude workaround as needed. Turn it
879//   on when needed and then immediately off
880//
881Proc VC_Initialize_Space()
882//
883        NewDataFolder/O root:Packages
884        NewDataFolder/O root:Packages:NIST
885        NewDataFolder/O root:Packages:NIST:VSANS
886        NewDataFolder/O root:Packages:NIST:VSANS:VCALC
887        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry
888        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument
889        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_B
890        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_MB
891        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_MT
892        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_ML
893        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_MR
894        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FB
895        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FT
896        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FL
897        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FR
898
899//      NewDataFolder/O root:Packages:NIST:VSANS:VCALC:Front
900//      NewDataFolder/O root:Packages:NIST:VSANS:VCALC:Middle
901//      NewDataFolder/O root:Packages:NIST:VSANS:VCALC:Back
902
903        NewDataFolder/O root:Packages:NIST:VSANS:RawVSANS
904       
905        Variable/G root:Packages:NIST:VSANS:VCALC:gVCALC_Active = 1
906        Variable/G root:Packages:NIST:VSANS:VCALC:gUseNonLinearDet = 0          //if == 1, use RAW non-linear corrections
907       
908        SetDataFolder root:Packages:NIST:VSANS:VCALC
909       
910
911///// FRONT DETECTOR BANKS
912// dimensions for the detector banks (then get them in the drawing functions)
913// Width and height are not part of the Nexus file definition, but are needed for VCALC drawing
914// so keep them as variables
915        Variable/G gFront_LR_w = 38.4           //front bank, nominal LR panel width [cm]
916        Variable/G gFront_LR_h = 100.0
917        Variable/G gFront_TB_w = 50.0
918        Variable/G gFront_TB_h = 38.4
919
920// SDD setback of T/B (decide on units??)
921// for the Nexus file, the detector distance should already be corrected for the "setback"
922// of the T/B panels. keep as VCALC variable
923        Variable/G gFront_SDDsetback = 41.0                     // [cm]
924       
925       
926// detector resolution (xy for each bank!)
927        Make/O/D/N=1 :entry:instrument:detector_FL:x_pixel_size = 0.84          // (cm)         these tubes are vertical 8.4 mm x-spacing (JGB 2/2106)
928        Make/O/D/N=1 :entry:instrument:detector_FL:y_pixel_size = 0.8           // (cm)         //!! now 8 mm, since nPix=128, rather than 256
929        Make/O/D/N=1 :entry:instrument:detector_FR:x_pixel_size = 0.84
930        Make/O/D/N=1 :entry:instrument:detector_FR:y_pixel_size = 0.8
931        //T/B
932        Make/O/D/N=1 :entry:instrument:detector_FT:x_pixel_size = 0.4           //these tubes are horizontal
933        Make/O/D/N=1 :entry:instrument:detector_FT:y_pixel_size = 0.84
934        Make/O/D/N=1 :entry:instrument:detector_FB:x_pixel_size = 0.4
935        Make/O/D/N=1 :entry:instrument:detector_FB:y_pixel_size = 0.84
936       
937
938// number of pixels in each bank (this can be modified at acquisition time, so it must be adjustable here)
939        Make/O/D/N=1 :entry:instrument:detector_FL:pixel_num_x = 48     // == number of tubes
940        Make/O/D/N=1 :entry:instrument:detector_FL:pixel_num_y = 128    // == pixels in vertical direction (was 256, John says likely will run @ 128 9/2015)
941        Make/O/D/N=1 :entry:instrument:detector_FR:pixel_num_x = 48     // == number of tubes
942        Make/O/D/N=1 :entry:instrument:detector_FR:pixel_num_y = 128    // == pixels in vertical direction
943        Make/O/D/N=1 :entry:instrument:detector_FT:pixel_num_x = 128    // == pixels in horizontal direction
944        Make/O/D/N=1 :entry:instrument:detector_FT:pixel_num_y = 48     // == number of tubes
945        Make/O/D/N=1 :entry:instrument:detector_FB:pixel_num_x = 128    // == pixels in horizontal direction
946        Make/O/D/N=1 :entry:instrument:detector_FB:pixel_num_y = 48     // == number of tubes
947
948
949
950// pixel beam center - HDF style
951        Make/O/D/N=1 :entry:instrument:detector_FL:beam_center_x = 55           // == x beam center, in pixels
952        Make/O/D/N=1 :entry:instrument:detector_FL:beam_center_y = 64           // == y beam center, in pixels
953        Make/O/D/N=1 :entry:instrument:detector_FR:beam_center_x = -8   
954        Make/O/D/N=1 :entry:instrument:detector_FR:beam_center_y = 64   
955        Make/O/D/N=1 :entry:instrument:detector_FT:beam_center_x = 64   
956        Make/O/D/N=1 :entry:instrument:detector_FT:beam_center_y = -8   
957        Make/O/D/N=1 :entry:instrument:detector_FB:beam_center_x = 64   
958        Make/O/D/N=1 :entry:instrument:detector_FB:beam_center_y = 55   
959
960
961
962///// MIDDLE DETECTOR BANKS
963// Width and height are not part of the Nexus file definition, but are needed for VCALC drawing
964// so keep them as variables
965        Variable/G gMiddle_LR_w = 38.4          //middle bank, nominal LR panel width (cm)
966        Variable/G gMiddle_LR_h = 100.0
967        Variable/G gMiddle_TB_w = 50.0
968        Variable/G gMiddle_TB_h = 38.4
969// SDD offset of T/B (decide on units??)
970// for the Nexus file, the detector distance should already be corrected for the "setback"
971// of the T/B panels. keep as VCALC variable
972        Variable/G gMiddle_SDDsetback = 41.0                    // [cm]
973       
974// detector resolution (xy for each bank!)
975        Make/O/D/N=1 :entry:instrument:detector_ML:x_pixel_size = 0.84          // (cm)         these tubes are vertical 8.4 mm x-spacing (JGB 2/2106)
976        Make/O/D/N=1 :entry:instrument:detector_ML:y_pixel_size = 0.8           // (cm)         //!! now 8 mm, since nPix=128, rather than 256
977        Make/O/D/N=1 :entry:instrument:detector_MR:x_pixel_size = 0.84
978        Make/O/D/N=1 :entry:instrument:detector_MR:y_pixel_size = 0.8
979        //T/B
980        Make/O/D/N=1 :entry:instrument:detector_MT:x_pixel_size = 0.4           //these tubes are horizontal
981        Make/O/D/N=1 :entry:instrument:detector_MT:y_pixel_size = 0.84
982        Make/O/D/N=1 :entry:instrument:detector_MB:x_pixel_size = 0.4
983        Make/O/D/N=1 :entry:instrument:detector_MB:y_pixel_size = 0.84
984
985
986
987// number of pixels in each bank (this can be modified at acquisition time, so it must be adjustable here)
988        Make/O/D/N=1 :entry:instrument:detector_ML:pixel_num_x = 48     // == number of tubes
989        Make/O/D/N=1 :entry:instrument:detector_ML:pixel_num_y = 128    // == pixels in vertical direction (was 256, John says likely will run @ 128 9/2015)
990        Make/O/D/N=1 :entry:instrument:detector_MR:pixel_num_x = 48     // == number of tubes
991        Make/O/D/N=1 :entry:instrument:detector_MR:pixel_num_y = 128    // == pixels in vertical direction
992        Make/O/D/N=1 :entry:instrument:detector_MT:pixel_num_x = 128    // == pixels in horizontal direction
993        Make/O/D/N=1 :entry:instrument:detector_MT:pixel_num_y = 48     // == number of tubes
994        Make/O/D/N=1 :entry:instrument:detector_MB:pixel_num_x = 128    // == pixels in horizontal direction
995        Make/O/D/N=1 :entry:instrument:detector_MB:pixel_num_y = 48     // == number of tubes
996       
997
998
999// pixel beam center - HDF style
1000        Make/O/D/N=1 :entry:instrument:detector_ML:beam_center_x = 55           // == x beam center, in pixels
1001        Make/O/D/N=1 :entry:instrument:detector_ML:beam_center_y = 64           // == y beam center, in pixels
1002        Make/O/D/N=1 :entry:instrument:detector_MR:beam_center_x = -8   
1003        Make/O/D/N=1 :entry:instrument:detector_MR:beam_center_y = 64   
1004        Make/O/D/N=1 :entry:instrument:detector_MT:beam_center_x = 64   
1005        Make/O/D/N=1 :entry:instrument:detector_MT:beam_center_y = -8   
1006        Make/O/D/N=1 :entry:instrument:detector_MB:beam_center_x = 64   
1007        Make/O/D/N=1 :entry:instrument:detector_MB:beam_center_y = 55   
1008
1009
1010
1011
1012//// BACK DETECTOR
1013        Variable/G gBack_w = 22.2                               //w and h for the back detector [cm]
1014        Variable/G gBack_h = 50.4
1015       
1016       
1017        // TODOHIRES -- be sure that all of this is correct, since it is hard-wired values
1018        // -- can't use a switch so I'm using an if(), where the default is 4x4 binning
1019        if(root:Packages:NIST:VSANS:Globals:gHighResBinning == 1)
1020                Make/O/D/N=1 :entry:instrument:detector_B:x_pixel_size = 0.00845                // 340 micron resolution (units of [cm] here)
1021                Make/O/D/N=1 :entry:instrument:detector_B:y_pixel_size = 0.00845               
1022       
1023                Make/O/D/N=1 :entry:instrument:detector_B:pixel_num_x = 2720            // detector pixels in x-direction
1024                Make/O/D/N=1 :entry:instrument:detector_B:pixel_num_y = 6624
1025               
1026        // pixel beam center - HDF style
1027                Make/O/D/N=1 :entry:instrument:detector_B:beam_center_x = 1360.1        // == x beam center, in pixels +0.1 so I know it's from here
1028                Make/O/D/N=1 :entry:instrument:detector_B:beam_center_y = 3312.1                // == y beam center, in pixels
1029        else
1030                Make/O/D/N=1 :entry:instrument:detector_B:x_pixel_size = 0.034          // 340 micron resolution (units of [cm] here)
1031                Make/O/D/N=1 :entry:instrument:detector_B:y_pixel_size = 0.034         
1032       
1033                Make/O/D/N=1 :entry:instrument:detector_B:pixel_num_x = 680             // detector pixels in x-direction
1034                Make/O/D/N=1 :entry:instrument:detector_B:pixel_num_y = 1656
1035               
1036        // pixel beam center - HDF style
1037                Make/O/D/N=1 :entry:instrument:detector_B:beam_center_x = 340.1 // == x beam center, in pixels +0.1 so I know it's from here
1038                Make/O/D/N=1 :entry:instrument:detector_B:beam_center_y = 828.1         // == y beam center, in pixels
1039        endif
1040
1041
1042// Generate all of the waves used for the detector and the q values
1043//
1044// TODO: the detector dimensions need to be properly defined here...
1045// FRONT
1046//      SetDataFolder root:Packages:NIST:VSANS:VCALC:Front
1047
1048        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FL
1049        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_FL
1050        Duplicate/O det_FL qTot_FL,qx_FL,qy_FL,qz_FL
1051
1052        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FR
1053        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_FR
1054        Duplicate/O det_FR qTot_FR,qx_FR,qy_FR,qz_FR
1055
1056        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FT
1057        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_FT
1058        Duplicate/O det_FT qTot_FT,qx_FT,qy_FT,qz_FT
1059       
1060        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FB
1061        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_FB
1062        Duplicate/O det_FB qTot_FB,qx_FB,qy_FB,qz_FB
1063
1064
1065//MIDDLE
1066// TODO: the detector dimensions need to be properly defined here...
1067//      SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle
1068
1069        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_ML
1070        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_ML
1071        Duplicate/O det_ML qTot_ML,qx_ML,qy_ML,qz_ML
1072       
1073        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_MR
1074        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_MR
1075        Duplicate/O det_MR qTot_MR,qx_MR,qy_MR,qz_MR
1076
1077        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_MT
1078        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_MT
1079        Duplicate/O det_MT qTot_MT,qx_MT,qy_MT,qz_MT
1080       
1081        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_MB
1082        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_MB
1083        Duplicate/O det_MB qTot_MB,qx_MB,qy_MB,qz_MB
1084
1085// BACK
1086// TODO: the detector dimensions need to be properly defined here...
1087//      SetDataFolder root:Packages:NIST:VSANS:VCALC:Back
1088
1089        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_B
1090        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_B
1091        Duplicate/O det_B qTot_B,qx_B,qy_B,qz_B
1092
1093
1094////////////    FOR THE PANEL
1095
1096        SetDataFolder root:Packages:NIST:VSANS:VCALC
1097
1098        Make/O/D/N=2 fpx1,fpy1,mpx1,mpy1                // for display of the detector panels
1099        Make/O/D/N=2 fv_degX,fv_degY
1100
1101
1102// to fill in:
1103// values for always-visible items
1104        String/G gPresetPopStr = "Low Q;High Q;Front+Middle Only;Converging Pinholes;Narrow Slit;White Beam;Graphite;Polarizer;"
1105        String/G gBinTypeStr = ksBinTypeStr
1106        Variable/G gBeamIntensity= 0
1107
1108
1109
1110// popup strings for each tab (then use the string in the panel)
1111// tab 0 - collimation
1112        String/G gMonochromatorType = "Velocity Selector;Graphite;White Beam;"
1113        String/G gSourceShape = "circular;rectangular;converging pinholes;"
1114        String/G gSourceDiam = "1.0 cm;2.0 cm;5.0 cm;"
1115        String/G gSourceDiam_0g = "0.75 cm;1.5 cm;3.0 cm;"              // values from John Mar 2018
1116        String/G gDeltaLambda = "0.01;0.10;0.20;0.30;0.40;"
1117       
1118// tab 1 - sample conditions
1119        String/G gTableLocation = "Changer;Stage;"
1120        String/G gSampleApertureShape = "circular;rectangular;converging pinholes;"
1121        String/G gSampleApertureDiam = "0.5;1.0;1.5;2.0;"
1122       
1123// tab 2
1124
1125// tab 3
1126
1127// tab 4 - back detector
1128        String/G gBackDetType = "1D;2D;"
1129
1130// tab 5
1131        String/G gModelFunctionType = "Debye;Sphere;Big Debye;Big Sphere;AgBeh;Vycor;Empty Cell;Blocked Beam;"
1132        gModelFunctionType += "Debye +;AgBeh +;Empty Cell +;"
1133
1134////////////////////
1135
1136
1137
1138// limits for detector travel? or are these limits part of the panel, hard-wired there
1139
1140
1141//      // for the panel
1142
1143        Variable/G gNg=0
1144//      Variable/G gOffset=0
1145        Variable/G gSamAp=1.27          //samAp diameter in cm
1146        String/G gSourceApString = "1.43 cm;2.54 cm;3.81 cm;"
1147        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;"
1148        Variable/G gSamApOther = 10             //non-standard aperture diameter, in mm
1149        Variable/G gUsingLenses = 0             //0=no lenses, 1=lenses(or prisms)
1150//      Variable/G gModelOffsetFactor = 1
1151//     
1152//      // for the MC simulation
1153//      Variable/G doSimulation =0              // == 1 if 1D simulated data, 0 if other from the checkbox
1154//      Variable/G gRanDateTime=datetime
1155//      Variable/G gImon = 10000
1156//      Variable/G gThick = 0.1
1157//      Variable/G gSig_incoh = 0.1
1158//      String/G gFuncStr = ""
1159//      Variable/G gR2 = 2.54/2
1160//      Variable/G gSamTrans=0.8                        //for 1D, default value
1161//      Variable/G gCntTime = 300
1162//      Variable/G gDoMonteCarlo = 0
1163//      Variable/G gUse_MC_XOP = 1                              //set to zero to use Igor code
1164//      Variable/G gBeamStopIn = 1                      //set to zero for beamstop out (transmission)
1165//      Variable/G gRawCounts = 0
1166//      Variable/G gSaveIndex = 100
1167//      String/G gSavePrefix = "SIMUL"
1168//      Variable/G gAutoSaveIndex = 100                 //a way to set the index for automated saves
1169//      String/G gAutoSaveLabel = ""                            //a way to set the "sample" label for automated saves
1170//      Make/O/D/N=10 results = 0
1171//      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"}
1172//
1173//      Variable/G g_1DTotCts = 0                       //summed counts (simulated)
1174//      Variable/G g_1DEstDetCR = 0             // estimated detector count rate
1175//      Variable/G g_1DFracScatt = 0            // fraction of beam captured on detector
1176//      Variable/G g_1DEstTrans = 0             // estimated transmission of sample
1177//      Variable/G g_1D_DoABS = 1
1178//      Variable/G g_1D_AddNoise = 1
1179//      Variable/G g_MultScattFraction=0
1180//      Variable/G g_detectorEff=0.75                   //average value for most wavelengths
1181//      Variable/G g_actSimTime = 0                             //for the save
1182//      Variable/G g_SimTimeWarn = 10                   //manually set to a very large value for scripted operation
1183//     
1184
1185//     
1186//      //for the fake dependency
1187//      Variable/G gTouched=0
1188//      Variable/G gCalculate=0
1189//      //for plotting
1190//      Variable/G gFreezeCount=1               //start the count at 1 to keep Jeff happy
1191//      Variable/G gDoTraceOffset=0             // (1==Yes, offset 2^n), 0==turn off the offset
1192
1193
1194
1195//
1196// instrument - specific dimensions
1197//
1198
1199//     
1200        Variable/G gInstrument = 6              // files (may) be tagged SA6 as the 6th SANS instrument
1201        Variable/G gS12 = 54.8
1202//      Variable/G d_det = 0.5
1203//      Variable/G a_pixel = 0.5
1204//      Variable/G del_r = 0.5
1205//      Variable/G det_width = 64.0
1206        Variable/G gLambda_t = 5.50
1207        Variable/G gL2r_lower = 132.3
1208        Variable/G gL2r_upper =  1317
1209        Variable/G gLambda_lower = 2.5
1210        Variable/G gLambda_upper = 20.0
1211        Variable/G gD_upper = 25.0
1212        Variable/G gBs_factor = 1.05
1213        Variable/G gT1 = 0.63
1214        Variable/G gT2 = 1.0
1215        Variable/G gT3 = 0.75
1216        Variable/G gL_gap = 100.0
1217        Variable/G gGuide_width = 6.0
1218        Variable/G gIdmax = 100.0
1219
1220//
1221//      //new values, from 11/2009 --- BeamFluxReport_2009.ifn
1222        Variable/G gPhi_0 = 2.42e13
1223        Variable/G gB = 0.0
1224        Variable/G gC = -0.0243
1225        Variable/G gGuide_loss = 0.924
1226//     
1227//      //fwhm values (new variables) (+3, 0, -3, calibrated 2009)
1228        Variable/G gFwhm_narrow = 0.109
1229        Variable/G gFwhm_mid = 0.125
1230        Variable/G gFwhm_wide = 0.236
1231//     
1232//      //source apertures (cm)
1233        Variable/G gA1_0_0 = 1.43
1234        Variable/G gA1_0_1 = 2.54
1235        Variable/G gA1_0_2 = 3.81
1236        Variable/G gA1_7_0 = 2.5                        // after the polarizer         
1237        Variable/G gA1_7_1 = 5.0
1238        Variable/G gA1_7_1 = 0.95               //
1239        Variable/G gA1_def = 5.00
1240//     
1241        SetDataFolder root:
1242end
Note: See TracBrowser for help on using the repository browser.