source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_VCALCPanel_MockUp.ipf @ 953

Last change on this file since 953 was 953, checked in by srkline, 8 years ago

some minor changes to the FFT filling procedures to help out Abhiram

Replaced cansasXML.ipf v1.11 with v1.12 (current version)

some restructuring of the VSANS file names.

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