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

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

changes mostly to VCALC to add in what bits of information I have about the instrument dimensions. Added in stubs (based on NG3 SANS) for the beam intensity. Added in a preset condition for Front+Middle. Still need a more uniform way to do this.

File size: 37.7 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        Print "Beam Intensity = ",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                                       
406                                        SetVariable VCALCCtrl_0b,disable=0,noedit=0             // allow user editing again
407
408                                        break
409                                case "Graphite":
410                                        DLStr = "0.01;"
411                                        PopupMenu VCALCCtrl_0d,mode=1,popvalue="0.01",value= root:Packages:NIST:VSANS:VCALC:gDeltaLambda
412                                       
413                                        SetVariable VCALCCtrl_0b,value=_NUM:4.75,disable=2              // wavelength
414                                        break
415                                case "White Beam":
416                                        DLStr = "0.40;"
417                                        PopupMenu VCALCCtrl_0d,mode=1,popvalue="0.40",value= root:Packages:NIST:VSANS:VCALC:gDeltaLambda
418
419                                        SetVariable VCALCCtrl_0b,value=_NUM:5.3,disable=2               //wavelength
420                                        break           
421                                default:
422                                        Print "Error--No match in VC_MonochromSelectPopup"
423                                        return(0)
424                        endswitch
425                       
426
427                        // a recalculation is needed after the change
428                        Recalculate_AllDetectors()
429                                                               
430                        break
431                case -1: // control being killed
432                        break
433        endswitch
434
435        return 0
436End
437
438
439Function VC_PresetConfigPopup(pa) : PopupMenuControl
440        STRUCT WMPopupAction &pa
441
442        switch( pa.eventCode )
443                case 2: // mouse up
444                        Variable popNum = pa.popNum
445                        String popStr = pa.popStr
446                       
447               
448                        strswitch(popStr)
449                                case "Low Q":
450                                       
451                                        break
452                                case "High Q":
453                                       
454                                        break
455                                case "White Beam":
456                                       
457                                        break   
458                                case "Narrow Slit":
459                                       
460                                        break
461                                case "Front+Middle Only":
462                                        VC_FrontMiddlePreset()
463                                       
464                                        break
465                                case "Converging Pinholes":
466                                       
467                                        break
468                                case "Polarizer":
469                                       
470                                        break
471                                       
472                                default:
473                                        Print "Error--No match in VC_PresetConfigPopup"
474                                        return(0)
475                        endswitch
476                       
477                        // update the views
478                        VC_UpdateViews()
479                       
480                        // a recalculation is needed after the change
481                        Recalculate_AllDetectors()
482                       
483                                                                       
484                        break
485                case -1: // control being killed
486                        break
487        endswitch
488
489        return 0
490End
491
492
493
494
495
496//
497// recalculate the detectors with a preset model function
498//
499Function VC_SimModelFunc_PopProc(ctrlName,popNum,popStr) : PopupMenuControl
500        String ctrlName
501        Variable popNum // which item is currently selected (1-based)
502        String popStr           // contents of current popup item as string
503
504        Recalculate_AllDetectors()
505       
506        return(0)       
507End
508
509
510//
511// recalculate the I(q) binning. no need to adjust model function or views
512// just rebin
513//
514// this is for the VCALC 1-D plot subwindow only. so it is set up to
515// operate on that window - but uses the same binning and plotting routines
516// as the regualr VSANS data display
517//
518Function VC_RebinIQ_PopProc(ctrlName,popNum,popStr) : PopupMenuControl
519        String ctrlName
520        Variable popNum // which item is currently selected (1-based)
521        String popStr           // contents of current popup item as string
522
523
524        String type = "VCALC"
525        String str,winStr="VCALC#Panels_IQ",workTypeStr
526        workTypeStr = "root:Packages:NIST:VSANS:"+type
527       
528        String collimationStr = "pinhole"               //TODO: fill this in from the VCALC panel
529       
530// dispatch based on the string, not on the number of selection in the pop string
531        V_QBinAllPanels_Circular(type,V_BinTypeStr2Num(popStr),collimationStr)
532       
533        sprintf str,"(\"%s\",%d,\"%s\")",workTypeStr,V_BinTypeStr2Num(popStr),winStr
534
535        Execute ("V_Back_IQ_Graph"+str)
536        Execute ("V_Middle_IQ_Graph"+str)
537        Execute ("V_Front_IQ_Graph"+str)
538
539// OLD - do not use
540//      // do the q-binning for front panels to get I(Q)
541//      Execute "BinAllFrontPanels()"
542//      Execute "Front_IQ_Graph()"
543//
544//      // do the q-binning for middle panels to get I(Q)
545//      Execute "BinAllMiddlePanels()"
546//      Execute "Middle_IQ_Graph()"
547//     
548//      // do the q-binning for the back panel to get I(Q)
549//      Execute "BinAllBackPanels()"
550//      Execute "Back_IQ_Graph()"
551//     
552        return(0)       
553End
554
555
556
557       
558       
559//
560// setVar for the wavelength
561//
562Function VC_Lambda_SetVarProc(sva) : SetVariableControl
563        STRUCT WMSetVariableAction &sva
564
565        switch( sva.eventCode )
566                case 1: // mouse up
567                case 2: // Enter key
568                case 3: // Live update
569                        Variable dval = sva.dval
570                        String sval = sva.sval
571                       
572//                      // don't need to recalculate the views, but need to recalculate the detectors
573//                      fPlotBackPanels()
574//                      fPlotMiddlePanels()
575//                      fPlotFrontPanels()
576
577                        Recalculate_AllDetectors()             
578                               
579                        break
580                case -1: // control being killed
581                        break
582        endswitch
583
584        return 0
585End
586
587//
588// setVar for the simulation monitor count
589//
590Function VC_SimImon_SetVarProc(sva) : SetVariableControl
591        STRUCT WMSetVariableAction &sva
592
593        switch( sva.eventCode )
594                case 1: // mouse up
595                case 2: // Enter key
596                case 3: // Live update
597                        Variable dval = sva.dval
598                        String sval = sva.sval
599
600                        Recalculate_AllDetectors()             
601                               
602                        break
603                case -1: // control being killed
604                        break
605        endswitch
606
607        return 0
608End
609
610
611// setVar for the range (in degrees) for the FrontView plot of the detectors
612//
613Function FrontView_Range_SetVarProc(sva) : SetVariableControl
614        STRUCT WMSetVariableAction &sva
615
616        switch( sva.eventCode )
617                case 1: // mouse up
618                case 2: // Enter key
619                case 3: // Live update
620                        Variable dval = sva.dval
621                        String sval = sva.sval
622                       
623                        FrontView_1x()
624                       
625                        break
626                case -1: // control being killed
627                        break
628        endswitch
629
630        return 0
631End
632
633// setVar for the range (in Q) for the FrontView plot of the detectors
634//
635// TODO: this assumes that everything (the data) is already updated - this only updates the plot range
636Function Front2DQ_Range_SetVarProc(sva) : SetVariableControl
637        STRUCT WMSetVariableAction &sva
638
639        switch( sva.eventCode )
640                case 1: // mouse up
641                case 2: // Enter key
642                case 3: // Live update
643                        Variable dval = sva.dval
644                        String sval = sva.sval
645                       
646                        SetAxis/W=VCALC#Panels_Q left -dval,dval
647                        SetAxis/W=VCALC#Panels_Q bottom -dval,dval
648                       
649//                      FrontPanels_AsQ()
650                       
651                        break
652                case -1: // control being killed
653                        break
654        endswitch
655
656        return 0
657End
658
659// SDD for the Front detector. triggers a recalculation
660// of the intensity and a redraw of the banks
661//
662Function VC_FDet_SDD_SetVarProc(sva) : SetVariableControl
663        STRUCT WMSetVariableAction &sva
664
665        switch( sva.eventCode )
666                case 1: // mouse up
667                case 2: // Enter key
668                case 3: // Live update
669                        Variable dval = sva.dval
670                        String sval = sva.sval
671                       
672//                      Variable LR_sep,TB_sep
673//                      // don't know if LR or TB called, so get the explicit values
674//                      //
675//                      ControlInfo VCALCCtrl_2a
676//                      LR_sep = V_Value
677//                      ControlInfo VCALCCtrl_2b
678//                      TB_sep = V_Value
679//                     
680//                      UpdateFrontDetector(LR_sep,TB_sep)
681                       
682                        UpdateSideView()
683                        UpdateTopView()
684                        FrontView_1x()
685                       
686                        fPlotFrontPanels()
687                       
688                        break
689                case -1: // control being killed
690                        break
691        endswitch
692
693        return 0
694End
695
696// SDD for the Middle detector. triggers a recalculation
697// of the intensity and a redraw of the banks
698//
699Function VC_MDet_SDD_SetVarProc(sva) : SetVariableControl
700        STRUCT WMSetVariableAction &sva
701
702        switch( sva.eventCode )
703                case 1: // mouse up
704                case 2: // Enter key
705                case 3: // Live update
706                        Variable dval = sva.dval
707                        String sval = sva.sval
708                       
709//                      Variable LR_sep,TB_sep
710//                      // don't know if LR or TB called, so get the explicit values
711//                      //
712//                      ControlInfo VCALCCtrl_2a
713//                      LR_sep = V_Value
714//                      ControlInfo VCALCCtrl_2b
715//                      TB_sep = V_Value
716//                     
717//                      UpdateFrontDetector(LR_sep,TB_sep)
718                       
719                        UpdateSideView()
720                        UpdateTopView()
721                        FrontView_1x()
722                       
723                        fPlotMiddlePanels()
724                       
725                        break
726                case -1: // control being killed
727                        break
728        endswitch
729
730        return 0
731End
732
733// SDD for the Back detector. triggers a recalculation
734// of the intensity and a redraw of the banks
735//
736Function VC_BDet_SDD_SetVarProc(sva) : SetVariableControl
737        STRUCT WMSetVariableAction &sva
738
739        switch( sva.eventCode )
740                case 1: // mouse up
741                case 2: // Enter key
742                case 3: // Live update
743                        Variable dval = sva.dval
744                        String sval = sva.sval
745                       
746//                      Variable LR_sep,TB_sep
747//                      // don't know if LR or TB called, so get the explicit values
748//                      //
749//                      ControlInfo VCALCCtrl_2a
750//                      LR_sep = V_Value
751//                      ControlInfo VCALCCtrl_2b
752//                      TB_sep = V_Value
753//                     
754//                      UpdateFrontDetector(LR_sep,TB_sep)
755                       
756                        UpdateSideView()
757                        UpdateTopView()
758                        FrontView_1x()
759                       
760                        fPlotBackPanels()
761                       
762                        break
763                case -1: // control being killed
764                        break
765        endswitch
766
767        return 0
768End
769
770// separation, either LR or TB of the front detector. triggers a recalculation
771// of the intensity and a redraw of the banks
772//
773Function VC_FDet_LR_SetVarProc(sva) : SetVariableControl
774        STRUCT WMSetVariableAction &sva
775
776        switch( sva.eventCode )
777                case 1: // mouse up
778                case 2: // Enter key
779                case 3: // Live update
780                        Variable dval = sva.dval
781                        String sval = sva.sval
782                       
783//                      Variable LR_sep,TB_sep
784//                      // don't know if LR or TB called, so get the explicit values
785//                      //
786//                      ControlInfo VCALCCtrl_2a
787//                      LR_sep = V_Value
788//                      ControlInfo VCALCCtrl_2b
789//                      TB_sep = V_Value
790//                     
791//                      UpdateFrontDetector(LR_sep,TB_sep)
792                       
793                        UpdateSideView()
794                        UpdateTopView()
795                        FrontView_1x()
796                       
797                        fPlotFrontPanels()
798                       
799                        break
800                case -1: // control being killed
801                        break
802        endswitch
803
804        return 0
805End
806
807
808// separation, either LR or TB of the middle detector. triggers a recalculation
809// of the intensity and a redraw of the banks
810//
811Function VC_MDet_LR_SetVarProc(sva) : SetVariableControl
812        STRUCT WMSetVariableAction &sva
813
814        switch( sva.eventCode )
815                case 1: // mouse up
816                case 2: // Enter key
817                case 3: // Live update
818                        Variable dval = sva.dval
819                        String sval = sva.sval
820                       
821//                      Variable LR_sep,TB_sep
822//                      // don't know if LR or TB called, so get the explicit values
823//                      //
824//                      ControlInfo VCALCCtrl_3a
825//                      LR_sep = V_Value
826//                      ControlInfo VCALCCtrl_3b
827//                      TB_sep = V_Value
828                       
829//                      UpdateMiddleDetector(LR_sep,TB_sep)
830                       
831                        UpdateSideView()
832                        UpdateTopView()
833                        FrontView_1x()
834                       
835                        fPlotMiddlePanels()
836                       
837                        break
838                case -1: // control being killed
839                        break
840        endswitch
841
842        return 0
843End
844
845// call to update the views (not the q-calculation, that is a separate call)
846Function VC_UpdateViews()
847
848        UpdateSideView()
849        UpdateTopView()
850        FrontView_1x()
851       
852        return(0)
853End
854
855// this all needs to be fixed and updated - not yet specific to VSANS
856//
857// -- all of the simulation stuff will need to be re-thought
858// -- all of the integersRead, data, etc. will need to be re-thought...
859// -- but the space needs to be allocated.
860// -- parameters and constants need to be defined in their own space
861//
862// FEB 2016 -- changed the data folder space to mimic the HDF folder structure
863// so that the averaging routines could be re-used (along with everything else)
864// -- painful, but better in the long run
865//
866// -- I have not re-named the detector arrays to all be "data" since that is very difficult to
867//   deal with on images. Added a global "gVCALC_Active" as a crude workaround as needed. Turn it
868//   on when needed and then immediately off
869//
870Proc VC_Initialize_Space()
871//
872        NewDataFolder/O root:Packages
873        NewDataFolder/O root:Packages:NIST
874        NewDataFolder/O root:Packages:NIST:VSANS
875        NewDataFolder/O root:Packages:NIST:VSANS:VCALC
876        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry
877        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument
878        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_B
879        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_MB
880        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_MT
881        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_ML
882        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_MR
883        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FB
884        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FT
885        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FL
886        NewDataFolder/O root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FR
887
888//      NewDataFolder/O root:Packages:NIST:VSANS:VCALC:Front
889//      NewDataFolder/O root:Packages:NIST:VSANS:VCALC:Middle
890//      NewDataFolder/O root:Packages:NIST:VSANS:VCALC:Back
891
892        NewDataFolder/O root:Packages:NIST:VSANS:RawVSANS
893       
894        Variable/G root:Packages:NIST:VSANS:VCALC:gVCALC_Active = 1
895        Variable/G root:Packages:NIST:VSANS:VCALC:gUseNonLinearDet = 0          //if == 1, use RAW non-linear corrections
896       
897        SetDataFolder root:Packages:NIST:VSANS:VCALC
898       
899
900///// FRONT DETECTOR BANKS
901// dimensions for the detector banks (then get them in the drawing functions)
902// Width and height are not part of the Nexus file definition, but are needed for VCALC drawing
903// so keep them as variables
904        Variable/G gFront_LR_w = 38.4           //front bank, nominal LR panel width [cm]
905        Variable/G gFront_LR_h = 100.0
906        Variable/G gFront_TB_w = 50.0
907        Variable/G gFront_TB_h = 38.4
908
909// SDD setback of T/B (decide on units??)
910// for the Nexus file, the detector distance should already be corrected for the "setback"
911// of the T/B panels. keep as VCALC variable
912        Variable/G gFront_SDDsetback = 41.0                     // [cm]
913       
914       
915// detector resolution (xy for each bank!)
916        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)
917        Make/O/D/N=1 :entry:instrument:detector_FL:y_pixel_size = 0.8           // (cm)         //!! now 8 mm, since nPix=128, rather than 256
918        Make/O/D/N=1 :entry:instrument:detector_FR:x_pixel_size = 0.84
919        Make/O/D/N=1 :entry:instrument:detector_FR:y_pixel_size = 0.8
920        //T/B
921        Make/O/D/N=1 :entry:instrument:detector_FT:x_pixel_size = 0.4           //these tubes are horizontal
922        Make/O/D/N=1 :entry:instrument:detector_FT:y_pixel_size = 0.84
923        Make/O/D/N=1 :entry:instrument:detector_FB:x_pixel_size = 0.4
924        Make/O/D/N=1 :entry:instrument:detector_FB:y_pixel_size = 0.84
925       
926
927// number of pixels in each bank (this can be modified at acquisition time, so it must be adjustable here)
928        Make/O/D/N=1 :entry:instrument:detector_FL:pixel_num_x = 48     // == number of tubes
929        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)
930        Make/O/D/N=1 :entry:instrument:detector_FR:pixel_num_x = 48     // == number of tubes
931        Make/O/D/N=1 :entry:instrument:detector_FR:pixel_num_y = 128    // == pixels in vertical direction
932        Make/O/D/N=1 :entry:instrument:detector_FT:pixel_num_x = 128    // == pixels in horizontal direction
933        Make/O/D/N=1 :entry:instrument:detector_FT:pixel_num_y = 48     // == number of tubes
934        Make/O/D/N=1 :entry:instrument:detector_FB:pixel_num_x = 128    // == pixels in horizontal direction
935        Make/O/D/N=1 :entry:instrument:detector_FB:pixel_num_y = 48     // == number of tubes
936
937
938
939// pixel beam center - HDF style
940        Make/O/D/N=1 :entry:instrument:detector_FL:beam_center_x = 55           // == x beam center, in pixels
941        Make/O/D/N=1 :entry:instrument:detector_FL:beam_center_y = 64           // == y beam center, in pixels
942        Make/O/D/N=1 :entry:instrument:detector_FR:beam_center_x = -8   
943        Make/O/D/N=1 :entry:instrument:detector_FR:beam_center_y = 64   
944        Make/O/D/N=1 :entry:instrument:detector_FT:beam_center_x = 64   
945        Make/O/D/N=1 :entry:instrument:detector_FT:beam_center_y = -8   
946        Make/O/D/N=1 :entry:instrument:detector_FB:beam_center_x = 64   
947        Make/O/D/N=1 :entry:instrument:detector_FB:beam_center_y = 55   
948
949
950
951///// MIDDLE DETECTOR BANKS
952// Width and height are not part of the Nexus file definition, but are needed for VCALC drawing
953// so keep them as variables
954        Variable/G gMiddle_LR_w = 38.4          //middle bank, nominal LR panel width (cm)
955        Variable/G gMiddle_LR_h = 100.0
956        Variable/G gMiddle_TB_w = 50.0
957        Variable/G gMiddle_TB_h = 38.4
958// SDD offset of T/B (decide on units??)
959// for the Nexus file, the detector distance should already be corrected for the "setback"
960// of the T/B panels. keep as VCALC variable
961        Variable/G gMiddle_SDDsetback = 41.0                    // [cm]
962       
963// detector resolution (xy for each bank!)
964        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)
965        Make/O/D/N=1 :entry:instrument:detector_ML:y_pixel_size = 0.8           // (cm)         //!! now 8 mm, since nPix=128, rather than 256
966        Make/O/D/N=1 :entry:instrument:detector_MR:x_pixel_size = 0.84
967        Make/O/D/N=1 :entry:instrument:detector_MR:y_pixel_size = 0.8
968        //T/B
969        Make/O/D/N=1 :entry:instrument:detector_MT:x_pixel_size = 0.4           //these tubes are horizontal
970        Make/O/D/N=1 :entry:instrument:detector_MT:y_pixel_size = 0.84
971        Make/O/D/N=1 :entry:instrument:detector_MB:x_pixel_size = 0.4
972        Make/O/D/N=1 :entry:instrument:detector_MB:y_pixel_size = 0.84
973
974
975
976// number of pixels in each bank (this can be modified at acquisition time, so it must be adjustable here)
977        Make/O/D/N=1 :entry:instrument:detector_ML:pixel_num_x = 48     // == number of tubes
978        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)
979        Make/O/D/N=1 :entry:instrument:detector_MR:pixel_num_x = 48     // == number of tubes
980        Make/O/D/N=1 :entry:instrument:detector_MR:pixel_num_y = 128    // == pixels in vertical direction
981        Make/O/D/N=1 :entry:instrument:detector_MT:pixel_num_x = 128    // == pixels in horizontal direction
982        Make/O/D/N=1 :entry:instrument:detector_MT:pixel_num_y = 48     // == number of tubes
983        Make/O/D/N=1 :entry:instrument:detector_MB:pixel_num_x = 128    // == pixels in horizontal direction
984        Make/O/D/N=1 :entry:instrument:detector_MB:pixel_num_y = 48     // == number of tubes
985       
986
987
988// pixel beam center - HDF style
989        Make/O/D/N=1 :entry:instrument:detector_ML:beam_center_x = 55           // == x beam center, in pixels
990        Make/O/D/N=1 :entry:instrument:detector_ML:beam_center_y = 64           // == y beam center, in pixels
991        Make/O/D/N=1 :entry:instrument:detector_MR:beam_center_x = -8   
992        Make/O/D/N=1 :entry:instrument:detector_MR:beam_center_y = 64   
993        Make/O/D/N=1 :entry:instrument:detector_MT:beam_center_x = 64   
994        Make/O/D/N=1 :entry:instrument:detector_MT:beam_center_y = -8   
995        Make/O/D/N=1 :entry:instrument:detector_MB:beam_center_x = 64   
996        Make/O/D/N=1 :entry:instrument:detector_MB:beam_center_y = 55   
997
998
999
1000
1001//// BACK DETECTOR
1002        Variable/G gBack_w = 22.2                               //w and h for the back detector [cm]
1003        Variable/G gBack_h = 50.4
1004       
1005        Make/O/D/N=1 :entry:instrument:detector_B:x_pixel_size = 0.034          // 340 micron resolution (units of [cm] here)
1006        Make/O/D/N=1 :entry:instrument:detector_B:y_pixel_size = 0.034         
1007
1008
1009        Make/O/D/N=1 :entry:instrument:detector_B:pixel_num_x = 680             // detector pixels in x-direction
1010        Make/O/D/N=1 :entry:instrument:detector_B:pixel_num_y = 1656
1011       
1012
1013// pixel beam center - HDF style
1014        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
1015        Make/O/D/N=1 :entry:instrument:detector_B:beam_center_y = 828.1         // == y beam center, in pixels
1016
1017
1018// Generate all of the waves used for the detector and the q values
1019//
1020// TODO: the detector dimensions need to be properly defined here...
1021// FRONT
1022//      SetDataFolder root:Packages:NIST:VSANS:VCALC:Front
1023
1024        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FL
1025        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_FL
1026        Duplicate/O det_FL qTot_FL,qx_FL,qy_FL,qz_FL
1027
1028        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FR
1029        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_FR
1030        Duplicate/O det_FR qTot_FR,qx_FR,qy_FR,qz_FR
1031
1032        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FT
1033        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_FT
1034        Duplicate/O det_FT qTot_FT,qx_FT,qy_FT,qz_FT
1035       
1036        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_FB
1037        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_FB
1038        Duplicate/O det_FB qTot_FB,qx_FB,qy_FB,qz_FB
1039
1040
1041//MIDDLE
1042// TODO: the detector dimensions need to be properly defined here...
1043//      SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle
1044
1045        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_ML
1046        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_ML
1047        Duplicate/O det_ML qTot_ML,qx_ML,qy_ML,qz_ML
1048       
1049        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_MR
1050        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_MR
1051        Duplicate/O det_MR qTot_MR,qx_MR,qy_MR,qz_MR
1052
1053        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_MT
1054        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_MT
1055        Duplicate/O det_MT qTot_MT,qx_MT,qy_MT,qz_MT
1056       
1057        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_MB
1058        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_MB
1059        Duplicate/O det_MB qTot_MB,qx_MB,qy_MB,qz_MB
1060
1061// BACK
1062// TODO: the detector dimensions need to be properly defined here...
1063//      SetDataFolder root:Packages:NIST:VSANS:VCALC:Back
1064
1065        SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_B
1066        Make/O/D/N=(pixel_num_x[0],pixel_num_y[0]) det_B
1067        Duplicate/O det_B qTot_B,qx_B,qy_B,qz_B
1068
1069
1070////////////    FOR THE PANEL
1071
1072        SetDataFolder root:Packages:NIST:VSANS:VCALC
1073
1074        Make/O/D/N=2 fpx1,fpy1,mpx1,mpy1                // for display of the detector panels
1075        Make/O/D/N=2 fv_degX,fv_degY
1076
1077
1078// to fill in:
1079// values for always-visible items
1080        String/G gPresetPopStr = "Low Q;High Q;Front+Middle Only;Converging Pinholes;Narrow Slit;White Beam;Polarizer;"
1081        String/G gBinTypeStr = ksBinTypeStr
1082        Variable/G gBeamIntensity= 0
1083
1084
1085
1086// popup strings for each tab (then use the string in the panel)
1087// tab 0 - collimation
1088        String/G gMonochromatorType = "Velocity Selector;Graphite;White Beam;"
1089        String/G gSourceShape = "circular;rectangular;converging pinholes;"
1090        String/G gSourceDiam = "1.0 cm;2.0 cm;5.0 cm;"
1091        String/G gSourceDiam_0g = "0.75 cm;1.5 cm;3.0 cm;"              // values from John Mar 2018
1092        String/G gDeltaLambda = "0.01;0.10;0.20;0.30;0.40;"
1093       
1094// tab 1 - sample conditions
1095        String/G gTableLocation = "Changer;Stage;"
1096        String/G gSampleApertureShape = "circular;rectangular;converging pinholes;"
1097        String/G gSampleApertureDiam = "0.5;1.0;1.5;2.0;"
1098       
1099// tab 2
1100
1101// tab 3
1102
1103// tab 4 - back detector
1104        String/G gBackDetType = "1D;2D;"
1105
1106// tab 5
1107        String/G gModelFunctionType = "Debye;Sphere;Big Debye;Big Sphere;AgBeh;Vycor;Empty Cell;Blocked Beam;"
1108        gModelFunctionType += "Debye +;AgBeh +;Empty Cell +;"
1109
1110////////////////////
1111
1112
1113
1114// limits for detector travel? or are these limits part of the panel, hard-wired there
1115
1116
1117//      // for the panel
1118
1119        Variable/G gNg=0
1120//      Variable/G gOffset=0
1121        Variable/G gSamAp=1.27          //samAp diameter in cm
1122        String/G gSourceApString = "1.43 cm;2.54 cm;3.81 cm;"
1123        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;"
1124        Variable/G gSamApOther = 10             //non-standard aperture diameter, in mm
1125        Variable/G gUsingLenses = 0             //0=no lenses, 1=lenses(or prisms)
1126//      Variable/G gModelOffsetFactor = 1
1127//     
1128//      // for the MC simulation
1129//      Variable/G doSimulation =0              // == 1 if 1D simulated data, 0 if other from the checkbox
1130//      Variable/G gRanDateTime=datetime
1131//      Variable/G gImon = 10000
1132//      Variable/G gThick = 0.1
1133//      Variable/G gSig_incoh = 0.1
1134//      String/G gFuncStr = ""
1135//      Variable/G gR2 = 2.54/2
1136//      Variable/G gSamTrans=0.8                        //for 1D, default value
1137//      Variable/G gCntTime = 300
1138//      Variable/G gDoMonteCarlo = 0
1139//      Variable/G gUse_MC_XOP = 1                              //set to zero to use Igor code
1140//      Variable/G gBeamStopIn = 1                      //set to zero for beamstop out (transmission)
1141//      Variable/G gRawCounts = 0
1142//      Variable/G gSaveIndex = 100
1143//      String/G gSavePrefix = "SIMUL"
1144//      Variable/G gAutoSaveIndex = 100                 //a way to set the index for automated saves
1145//      String/G gAutoSaveLabel = ""                            //a way to set the "sample" label for automated saves
1146//      Make/O/D/N=10 results = 0
1147//      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"}
1148//
1149//      Variable/G g_1DTotCts = 0                       //summed counts (simulated)
1150//      Variable/G g_1DEstDetCR = 0             // estimated detector count rate
1151//      Variable/G g_1DFracScatt = 0            // fraction of beam captured on detector
1152//      Variable/G g_1DEstTrans = 0             // estimated transmission of sample
1153//      Variable/G g_1D_DoABS = 1
1154//      Variable/G g_1D_AddNoise = 1
1155//      Variable/G g_MultScattFraction=0
1156//      Variable/G g_detectorEff=0.75                   //average value for most wavelengths
1157//      Variable/G g_actSimTime = 0                             //for the save
1158//      Variable/G g_SimTimeWarn = 10                   //manually set to a very large value for scripted operation
1159//     
1160
1161//     
1162//      //for the fake dependency
1163//      Variable/G gTouched=0
1164//      Variable/G gCalculate=0
1165//      //for plotting
1166//      Variable/G gFreezeCount=1               //start the count at 1 to keep Jeff happy
1167//      Variable/G gDoTraceOffset=0             // (1==Yes, offset 2^n), 0==turn off the offset
1168
1169
1170
1171//
1172// instrument - specific dimensions
1173//
1174
1175//     
1176        Variable/G gInstrument = 6              // files (may) be tagged SA6 as the 6th SANS instrument
1177        Variable/G gS12 = 54.8
1178//      Variable/G d_det = 0.5
1179//      Variable/G a_pixel = 0.5
1180//      Variable/G del_r = 0.5
1181//      Variable/G det_width = 64.0
1182        Variable/G gLambda_t = 5.50
1183        Variable/G gL2r_lower = 132.3
1184        Variable/G gL2r_upper =  1317
1185        Variable/G gLambda_lower = 2.5
1186        Variable/G gLambda_upper = 20.0
1187        Variable/G gD_upper = 25.0
1188        Variable/G gBs_factor = 1.05
1189        Variable/G gT1 = 0.63
1190        Variable/G gT2 = 1.0
1191        Variable/G gT3 = 0.75
1192        Variable/G gL_gap = 100.0
1193        Variable/G gGuide_width = 6.0
1194        Variable/G gIdmax = 100.0
1195
1196//
1197//      //new values, from 11/2009 --- BeamFluxReport_2009.ifn
1198        Variable/G gPhi_0 = 2.42e13
1199        Variable/G gB = 0.0
1200        Variable/G gC = -0.0243
1201        Variable/G gGuide_loss = 0.924
1202//     
1203//      //fwhm values (new variables) (+3, 0, -3, calibrated 2009)
1204        Variable/G gFwhm_narrow = 0.109
1205        Variable/G gFwhm_mid = 0.125
1206        Variable/G gFwhm_wide = 0.236
1207//     
1208//      //source apertures (cm)
1209        Variable/G gA1_0_0 = 1.43
1210        Variable/G gA1_0_1 = 2.54
1211        Variable/G gA1_0_2 = 3.81
1212        Variable/G gA1_7_0 = 2.5                        // after the polarizer         
1213        Variable/G gA1_7_1 = 5.0
1214        Variable/G gA1_7_1 = 0.95               //
1215        Variable/G gA1_def = 5.00
1216//     
1217        SetDataFolder root:
1218end
Note: See TracBrowser for help on using the repository browser.