source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DetectorBin_Middle.ipf @ 947

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

Changes to VCALC files, moving detector information into sub-folders in anticipation of the possible folder structure that I will use for the actual data reduction. But purely speculative at this point.

Fixing some typos in other procedures.

File size: 19.6 KB
Line 
1#pragma rtGlobals=3             // Use modern global access method and strict wave access.
2
3
4
5Proc PlotMiddlePanels()
6        fPlotMiddlePanels()
7End
8
9// to plot I(q) for the 4 Middle panels
10//
11// *** Call this function when Middle panels are adjusted, or wavelength, etc. changed
12//
13Function fPlotMiddlePanels()
14
15        // space is allocated for all of the detectors and Q's on initialization
16        // calculate Qtot, qxqyqz arrays from geometry
17        V_CalculateQMiddlePanels()
18       
19        // fill the panels with fake sphere scattering data
20        // TODO: am I in the right data folder??
21        SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle
22
23        WAVE det_ML = det_ML
24        WAVE det_MR = det_MR
25        WAVE det_MT = det_MT
26        WAVE det_MB = det_MB
27       
28        WAVE qTot_ML = qTot_ML
29        WAVE qTot_MR = qTot_MR
30        WAVE qTot_MT = qTot_MT
31        WAVE qTot_MB = qTot_MB
32
33        FillPanel_wModelData(det_ML,qTot_ML,"ML")
34        FillPanel_wModelData(det_MR,qTot_MR,"MR")
35        FillPanel_wModelData(det_MT,qTot_MT,"MT")
36        FillPanel_wModelData(det_MB,qTot_MB,"MB")                       
37
38        SetDataFolder root:
39               
40        // set any "shadowed" area of the T/B detectors to NaN to get a realitic
41        // view of how much of the detectors are actually collecting data
42        // -- I can get the separation L/R from the panel - only this "open" width is visible.
43        V_SetShadow_TopBottom("Middle","MT")            // TODO: -- be sure the data folder is properly set (within the function...)
44        V_SetShadow_TopBottom("Middle","MB")
45       
46        // do the q-binning for each of the panels to get I(Q)
47        Execute "BinAllMiddlePanels()"
48
49        // plot the results
50        Execute "Middle_IQ_Graph()"
51        Execute "MiddlePanels_AsQ()"
52End
53
54// works for Left, works for Right... works for T/B too.
55//
56// - TODO: be sure that the Q's are calculated correctly even when the beam is off of the
57//     detector, and on different sides of the detector (or T/B) - since it will be in a different
58//     relative postion to 0,0 on the detector. If the postions are symmetric, then the Q's should be identical.
59//     --- test this...
60// TODO -- be sure I'm in the right data folder. nothing is set correctly right now
61//
62// TODO: make all detector parameters global, not hard-wired
63//
64//
65// --- Panels are all allocated in the initialization. Here, only the q-values are calculated
66//     when anything changes
67//
68Function V_CalculateQMiddlePanels()
69
70        Variable xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY
71        Variable M_LR_sep,M_TB_sep,M_offset, M_sdd_offset
72
73        M_LR_sep = VCALC_getPanelSeparation("MLR")
74        M_TB_sep = VCALC_getPanelSeparation("MTB")
75        M_offset = VCALC_getLateralOffset("ML")
76       
77        SDD = VCALC_getSDD("ML")                //nominal SDD - need offset for TB
78        lam = VCALC_getWavelength()
79
80//separations are in mm -- need to watch the units, convert to cm
81        M_LR_sep /= 10
82        M_TB_sep /= 10
83// TODO - I'm treating the separation as the TOTAL width - so the difference
84//      from the "center" to the edge is 1/2 of the separation
85
86// TODO (make the N along the tube length a variable, since this can be reset @ acquisition)
87        M_sdd_offset = VSANS_getTopBottomSDDOffset("MT")        //T/B are 30 cm farther back  //TODO: make all detector parameters global, not hard-wired
88
89        SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle
90        Wave det_ML,det_MR                      // these are (48,256)
91        Wave det_MT,det_MB                      // these are (128,48)
92
93//Middle/LEFT   
94        WAVE qTot_ML,qx_ML,qy_ML,qz_ML
95        qTot_ML = 0
96        qx_ML = 0
97        qy_ML = 0
98        qz_ML = 0       
99       
100// TODO - these are to be set from globals, not hard-wired. N and pixelSixze will be known (or pre-measured)
101// pixel sizes are in cm
102        pixSizeX = VCALC_getPixSizeX("ML")
103        pixSizeY = VCALC_getPixSizeY("ML")
104       
105        xCtr = 48+(M_LR_sep/2/pixSizeX)         // TODO  -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)??
106        yCtr = 127     
107        V_Detector_2Q(det_ML,qTot_ML,qx_ML,qy_ML,qz_ML,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY)
108//      Print "xy for ML = ",xCtr,yCtr
109       
110        //set the wave scaling for the detector image so that it can be plotted in q-space
111        // TODO: this is only approximate - since the left "edge" is not the same from top to bottom, so I crudely
112        // take the middle value. At very small angles, OK, at 1m, this is a crummy approximation.
113        // since qTot is magnitude only, I need to put in the (-ve)
114        SetScale/I x WaveMin(qx_ML),WaveMax(qx_ML),"", det_ML           //this sets the left and right ends of the data scaling
115        SetScale/I y WaveMin(qy_ML),WaveMax(qy_ML),"", det_ML
116       
117//////////////////
118
119//Middle/RIGHT
120        SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle
121        WAVE qTot_MR,qx_MR,qy_MR,qz_MR
122        qTot_MR = 0
123        qx_MR = 0
124        qy_MR = 0
125        qz_MR = 0
126
127// TODO - these are to be set from globals, not hard-wired
128// pixel sizes are in cm
129        pixSizeX = VCALC_getPixSizeX("MR")
130        pixSizeY = VCALC_getPixSizeY("MR")
131       
132        xCtr = -(M_LR_sep/2/pixSizeX)-1         
133        yCtr = 127
134        V_Detector_2Q(det_MR,qTot_MR,qx_MR,qy_MR,qz_MR,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY)
135//      Print "xy for MR = ",xCtr,yCtr
136        SetScale/I x WaveMin(qx_MR),WaveMax(qx_MR),"", det_MR           //this sets the left and right ends of the data scaling
137        SetScale/I y WaveMin(qy_MR),WaveMax(qy_MR),"", det_MR
138/////////////////
139
140//Middle/TOP
141        SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle
142        WAVE qTot_MT,qx_MT,qy_MT,qz_MT
143        qTot_MT = 0
144        qx_MT = 0
145        qy_MT = 0
146        qz_MT = 0
147
148// TODO - these are to be set from globals, not hard-wired
149// pixel sizes are in cm
150        pixSizeX = VCALC_getPixSizeX("MT")
151        pixSizeY = VCALC_getPixSizeY("MT")
152
153        xCtr = 64
154        yCtr = -(M_TB_sep/2/pixSizeY)-1
155                // global sdd_offset is in (mm), convert to meters here for the Q-calculation 
156        V_Detector_2Q(det_MT,qTot_MT,qx_MT,qy_MT,qz_MT,xCtr,yCtr,sdd+M_sdd_offset/1000,lam,pixSizeX,pixSizeY)
157//      Print "xy for MT = ",xCtr,yCtr
158        SetScale/I x WaveMin(qx_MT),WaveMax(qx_MT),"", det_MT           //this sets the leMT and right ends of the data scaling
159        SetScale/I y WaveMin(qy_MT),WaveMax(qy_MT),"", det_MT
160//////////////////
161
162//Middle/BOTTOM
163        SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle
164        WAVE qTot_MB,qx_MB,qy_MB,qz_MB
165        qTot_MB = 0
166        qx_MB = 0
167        qy_MB = 0
168        qz_MB = 0
169
170// TODO - these are to be set from globals, not hard-wired
171// pixel sizes are in cm
172        pixSizeX = VCALC_getPixSizeX("MB")
173        pixSizeY = VCALC_getPixSizeY("MB")
174       
175        xCtr = 64
176        yCtr = 48+(M_TB_sep/2/pixSizeY)                 // TODO  -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)??
177                // global sdd_offset is in (mm), convert to meters here for the Q-calculation
178        V_Detector_2Q(det_MB,qTot_MB,qx_MB,qy_MB,qz_MB,xCtr,yCtr,sdd+M_sdd_offset/1000,lam,pixSizeX,pixSizeY)
179//      Print "xy for MB = ",xCtr,yCtr
180        SetScale/I x WaveMin(qx_MB),WaveMax(qx_MB),"", det_MB           //this sets the left and right ends of the data scaling
181        SetScale/I y WaveMin(qy_MB),WaveMax(qy_MB),"", det_MB
182/////////////////
183
184        SetDataFolder root:
185               
186        return(0)
187End
188
189
190Window MiddlePanels_AsQ() : Graph
191//      DoWindow/F MiddlePanels_AsQ
192//      if(V_flag == 0)
193//      PauseUpdate; Silent 1           // building window...
194//      Display /W=(1477,44,1978,517)
195
196        SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle
197
198        CheckDisplayed /W=VCALC#Panels_Q det_MB
199        if(V_flag == 0)
200                AppendImage/W=VCALC#Panels_Q det_MB
201                ModifyImage/W=VCALC#Panels_Q det_MB ctab= {*,*,ColdWarm,0}
202                AppendImage/W=VCALC#Panels_Q det_MT
203                ModifyImage/W=VCALC#Panels_Q det_MT ctab= {*,*,ColdWarm,0}
204                AppendImage/W=VCALC#Panels_Q det_ML
205                ModifyImage/W=VCALC#Panels_Q det_ML ctab= {*,*,ColdWarm,0}
206                AppendImage/W=VCALC#Panels_Q det_MR
207                ModifyImage/W=VCALC#Panels_Q det_MR ctab= {*,*,ColdWarm,0}
208        endif
209
210        Variable dval
211        ControlInfo/W=VCALC setVar_b
212        dval = V_Value
213
214        SetAxis/W=VCALC#Panels_Q left -dval,dval
215        SetAxis/W=VCALC#Panels_Q bottom -dval,dval     
216
217        ControlInfo/W=VCALC check_0a
218// V_Value == 1 if checked
219        ModifyImage/W=VCALC#Panels_Q det_MB log=V_Value
220        ModifyImage/W=VCALC#Panels_Q det_MT log=V_Value
221        ModifyImage/W=VCALC#Panels_Q det_ML log=V_Value
222        ModifyImage/W=VCALC#Panels_Q det_MR log=V_Value
223
224
225        SetDataFolder root:
226       
227//      ModifyGraph width={Aspect,1},height={Aspect,1},gbRGB=(56797,56797,56797)
228//      ModifyGraph grid=2
229//      ModifyGraph mirror=2
230//      SetAxis left -0.2,0.2
231//      SetAxis bottom -0.2,0.2
232//      endif
233EndMacro
234
235//
236// these routines bin the 2D q data to 1D I(q). Currently the Qtot is magnitude only, no sign (since
237// it's being binned to I(Q), having a sign makes no sense. If you want the sign, work from qxqyqz
238//
239// first - the DeltaQ step is set as the smaller detector resolution (along tube)
240//       which is different for LR / TB geometry. This is not set in stone.
241//
242// second - each detector is binned separately
243//
244// -- like the routines in CircSectAve, start with 500 points, and trim after binning is done.
245//      you'l end up with < 200 points.
246//
247// the results are in iBin_qxqy, qBin_qxqy, and eBin_qxqy, in the folder passed
248//
249Proc BinAllMiddlePanels()
250
251        SetDeltaQ("Middle","ML")
252        SetDeltaQ("Middle","MT")
253
254        Variable binType       
255        ControlInfo/W=VCALC popup_b
256        binType = V_Value               // V_value counts menu items from 1, so 1=1, 2=2, 3=4
257
258        if(binType == 1)
259                V_BinQxQy_to_1D("","ML")
260                V_BinQxQy_to_1D("","MR")
261                V_BinQxQy_to_1D("","MT")
262                V_BinQxQy_to_1D("","MB")
263        endif
264       
265        if(binType == 2)       
266                V_BinQxQy_to_1D("","MLR")
267                V_BinQxQy_to_1D("","MTB")
268        endif
269
270        if(binType == 3)
271                V_BinQxQy_to_1D("","MLRTB")
272        endif
273       
274        // TODO -- this is only a temporary fix for slit mode   
275        if(binType == 4)
276                /// this is for a tall, narrow slit mode       
277                V_fBinDetector_byRows("Middle","ML")
278                V_fBinDetector_byRows("Middle","MR")
279                V_fBinDetector_byRows("Middle","MT")
280                V_fBinDetector_byRows("Middle","MB")
281        endif
282End
283
284////////////to plot the (4) 2D panels and to plot the I(Q) data on the same plot
285Window Middle_IQ_Graph() : Graph
286
287        Variable binType
288       
289        ControlInfo/W=VCALC popup_b
290        binType = V_Value               // V_value counts menu items from 1, so 1=1, 2=2, 3=4
291
292        SetDataFolder root:Packages:NIST:VSANS:VCALC
293
294        if(binType==1)
295                ClearIQIfDisplayed("MLRTB")
296                ClearIQIfDisplayed("MLR")
297                ClearIQIfDisplayed("MTB")
298               
299                SetDataFolder root:Packages:NIST:VSANS:VCALC
300                CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_ML
301               
302                if(V_flag==0)
303                        AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_ML vs qBin_qxqy_ML
304                        AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_MR vs qBin_qxqy_MR
305                        AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_MT vs qBin_qxqy_MT
306                        AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_MB vs qBin_qxqy_MB
307                        ModifyGraph/W=VCALC#Panels_IQ mode=4
308                        ModifyGraph/W=VCALC#Panels_IQ marker=19
309                        ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_ML)=(65535,0,0),rgb(iBin_qxqy_MB)=(1,16019,65535),rgb(iBin_qxqy_MR)=(65535,0,0),rgb(iBin_qxqy_MT)=(1,16019,65535)
310                        ModifyGraph/W=VCALC#Panels_IQ msize=2
311                        ModifyGraph/W=VCALC#Panels_IQ muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MB)={0,2},muloffset(iBin_qxqy_MR)={0,8}
312                        ModifyGraph/W=VCALC#Panels_IQ grid=1
313                        ModifyGraph/W=VCALC#Panels_IQ log=1
314                        ModifyGraph/W=VCALC#Panels_IQ mirror=2
315                endif           
316        endif
317       
318        if(binType==2)
319                ClearIQIfDisplayed("MLRTB")
320                ClearIQIfDisplayed("MT")       
321                ClearIQIfDisplayed("ML")       
322                ClearIQIfDisplayed("MR")       
323                ClearIQIfDisplayed("MB")
324       
325
326                SetDataFolder root:Packages:NIST:VSANS:VCALC
327                CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_MLR
328               
329                if(V_flag==0)
330                        AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_MLR vs qBin_qxqy_MLR
331                        AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_MTB vs qBin_qxqy_MTB
332                        ModifyGraph/W=VCALC#Panels_IQ mode=4
333                        ModifyGraph/W=VCALC#Panels_IQ marker=19
334                        ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_MLR)=(65535,0,0),rgb(iBin_qxqy_MTB)=(1,16019,65535)
335                        ModifyGraph/W=VCALC#Panels_IQ msize=2
336                        ModifyGraph/W=VCALC#Panels_IQ muloffset(iBin_qxqy_MLR)={0,2}
337                        ModifyGraph/W=VCALC#Panels_IQ grid=1
338                        ModifyGraph/W=VCALC#Panels_IQ log=1
339                        ModifyGraph/W=VCALC#Panels_IQ mirror=2
340                        Label/W=VCALC#Panels_IQ left "Intensity (1/cm)"
341                        Label/W=VCALC#Panels_IQ bottom "Q (1/A)"
342                endif   
343                       
344        endif
345       
346        if(binType==3)
347                ClearIQIfDisplayed("MLR")
348                ClearIQIfDisplayed("MTB")       
349                ClearIQIfDisplayed("MT")       
350                ClearIQIfDisplayed("ML")       
351                ClearIQIfDisplayed("MR")       
352                ClearIQIfDisplayed("MB")       
353       
354                SetDataFolder root:Packages:NIST:VSANS:VCALC
355                CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_MLRTB
356               
357                if(V_flag==0)
358                        AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_MLRTB vs qBin_qxqy_MLRTB
359                        ModifyGraph/W=VCALC#Panels_IQ mode=4
360                        ModifyGraph/W=VCALC#Panels_IQ marker=19
361                        ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_MLRTB)=(65535,0,0)
362                        ModifyGraph/W=VCALC#Panels_IQ msize=2
363                        ModifyGraph/W=VCALC#Panels_IQ grid=1
364                        ModifyGraph/W=VCALC#Panels_IQ log=1
365                        ModifyGraph/W=VCALC#Panels_IQ mirror=2
366                        Label/W=VCALC#Panels_IQ left "Intensity (1/cm)"
367                        Label/W=VCALC#Panels_IQ bottom "Q (1/A)"
368                endif   
369                       
370        endif
371
372        if(binType==4)          // slit aperture binning - Mt, ML, MR, MB are averaged
373                ClearIQIfDisplayed("MLRTB")
374                ClearIQIfDisplayed("MLR")
375                ClearIQIfDisplayed("MTB")
376               
377                SetDataFolder root:Packages:NIST:VSANS:VCALC
378                CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_ML
379               
380                if(V_flag==0)
381                        AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_ML vs qBin_qxqy_ML
382                        AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_MR vs qBin_qxqy_MR
383                        AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_MT vs qBin_qxqy_MT
384                        AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_MB vs qBin_qxqy_MB
385                        ModifyGraph/W=VCALC#Panels_IQ mode=4
386                        ModifyGraph/W=VCALC#Panels_IQ marker=19
387                        ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_ML)=(65535,0,0),rgb(iBin_qxqy_MB)=(1,16019,65535),rgb(iBin_qxqy_MR)=(65535,0,0),rgb(iBin_qxqy_MT)=(1,16019,65535)
388                        ModifyGraph/W=VCALC#Panels_IQ msize=2
389                        ModifyGraph/W=VCALC#Panels_IQ muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MB)={0,2},muloffset(iBin_qxqy_MR)={0,8}
390                        ModifyGraph/W=VCALC#Panels_IQ grid=1
391                        ModifyGraph/W=VCALC#Panels_IQ log=1
392                        ModifyGraph/W=VCALC#Panels_IQ mirror=2
393                endif           
394                       
395        endif
396        SetDataFolder root:
397EndMacro
398
399
400////////// and for the BACK detector
401Proc PlotBackPanels()
402        fPlotBackPanels()
403End
404
405// to plot I(q) for the Back panel
406//
407// *** Call this function when Back panel is adjusted, or wavelength, etc. changed
408//
409Function fPlotBackPanels()
410
411        // space is allocated for all of the detectors and Q's on initialization
412        // calculate Qtot, qxqyqz arrays from geometry
413        V_CalculateQBackPanels()
414       
415        // fill the panels with fake sphere scattering data
416        // TODO: am I in the right data folder??
417        SetDataFolder root:Packages:NIST:VSANS:VCALC:Back
418
419        WAVE det_B = det_B
420        WAVE qTot_B = qTot_B
421
422        FillPanel_wModelData(det_B,qTot_B,"B")         
423
424        SetDataFolder root:
425               
426        // set any "shadowed" area of the T/B detectors to NaN to get a realitic
427        // view of how much of the detectors are actually collecting data
428        // -- I can get the separation L/R from the panel - only this "open" width is visible.
429//      V_SetShadow_TopBottom("","MT")          // TODO: -- be sure the data folder is properly set (within the function...)
430//      V_SetShadow_TopBottom("","MB")
431       
432        // do the q-binning for each of the panels to get I(Q)
433        Execute "BinAllBackPanels()"
434
435        // plot the results
436        Execute "Back_IQ_Graph()"
437        Execute "BackPanels_AsQ()"
438End
439
440// works for Left, works for Right... works for T/B too.
441//
442// - TODO: be sure that the Q's are calculated correctly even when the beam is off of the
443//     detector, and on different sides of the detector (or T/B) - since it will be in a different
444//     relative postion to 0,0 on the detector. If the postions are symmetric, then the Q's should be identical.
445//     --- test this...
446// TODO -- be sure I'm in the right data folder. nothing is set correctly right now
447//
448// TODO: make all detector parameters global, not hard-wired
449//
450//
451// --- Panels are all allocated in the initialization. Here, only the q-values are calculated
452//     when anything changes
453//
454Function V_CalculateQBackPanels()
455
456        Variable xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY
457        Variable B_offset
458
459        B_offset = VCALC_getLateralOffset("B")
460       
461        SDD = VCALC_getSDD("B")         //nominal SDD - need offset for TB
462        lam = VCALC_getWavelength()
463
464// TODO (make the N along the tube length a variable, since this can be reset @ acquisition)
465        SetDataFolder root:Packages:NIST:VSANS:VCALC:Back
466        Wave det_B                      // this is (320,320)
467
468//Back detector
469        WAVE qTot_B,qx_B,qy_B,qz_B
470        qTot_B = 0
471        qx_B = 0
472        qy_B = 0
473        qz_B = 0       
474       
475// TODO - these are to be set from globals, not hard-wired. N and pixelSixze will be known (or pre-measured)
476// pixel sizes are in cm
477        pixSizeX = VCALC_getPixSizeX("B")
478        pixSizeY = VCALC_getPixSizeY("B")
479       
480        xCtr = trunc( DimSize(det_B,0)/2 )              //should be 160
481        yCtr = trunc( DimSize(det_B,1)/2 )              //should be 160
482        V_Detector_2Q(det_B,qTot_B,qx_B,qy_B,qz_B,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY)
483       
484        //set the wave scaling for the detector image so that it can be plotted in q-space
485        // TODO: this is only approximate - since the left "edge" is not the same from top to bottom, so I crudely
486        // take the middle value. At very small angles, OK, at 1m, this is a crummy approximation.
487        // since qTot is magnitude only, I need to put in the (-ve)
488        SetScale/I x WaveMin(qx_B),WaveMax(qx_B),"", det_B              //this sets the left and right ends of the data scaling
489        SetScale/I y WaveMin(qy_B),WaveMax(qy_B),"", det_B
490
491        SetDataFolder root:
492               
493        return(0)
494End
495
496
497Window BackPanels_AsQ() : Graph
498//      DoWindow/F BackPanels_AsQ
499//      if(V_flag == 0)
500//      PauseUpdate; Silent 1           // building window...
501//      Display /W=(1477,44,1978,517)
502
503        SetDataFolder root:Packages:NIST:VSANS:VCALC:Back
504
505        CheckDisplayed /W=VCALC#Panels_Q det_B
506        if(V_flag == 0)
507                AppendImage/W=VCALC#Panels_Q det_B
508                ModifyImage/W=VCALC#Panels_Q det_B ctab= {*,*,ColdWarm,0}
509        endif
510
511        Variable dval
512        ControlInfo/W=VCALC setVar_b
513        dval = V_Value
514
515        SetAxis/W=VCALC#Panels_Q left -dval,dval
516        SetAxis/W=VCALC#Panels_Q bottom -dval,dval     
517
518        ControlInfo/W=VCALC check_0a
519// V_Value == 1 if checked
520        ModifyImage/W=VCALC#Panels_Q det_B log=V_Value
521
522        SetDataFolder root:
523       
524//      ModifyGraph width={Aspect,1},height={Aspect,1},gbRGB=(56797,56797,56797)
525//      ModifyGraph grid=2
526//      ModifyGraph mirror=2
527//      SetAxis left -0.2,0.2
528//      SetAxis bottom -0.2,0.2
529//      endif
530EndMacro
531
532//
533// these routines bin the 2D q data to 1D I(q). Currently the Qtot is magnitude only, no sign (since
534// it's being binned to I(Q), having a sign makes no sense. If you want the sign, work from qxqyqz
535//
536// first - the DeltaQ step is set as the smaller detector resolution (along tube)
537//       which is different for LR / TB geometry. This is not set in stone.
538//
539// second - each detector is binned separately
540//
541// -- like the routines in CircSectAve, start with 500 points, and trim after binning is done.
542//      you'l end up with < 200 points.
543//
544// the results are in iBin_qxqy, qBin_qxqy, and eBin_qxqy, in the folder passed
545//
546Proc BinAllBackPanels()
547
548        SetDeltaQ("Back","B")
549
550        Variable binType       
551        ControlInfo/W=VCALC popup_b
552        binType = V_Value               // V_value counts menu items from 1, so 1=1, 2=2, 3=4
553       
554        V_BinQxQy_to_1D("","B")
555
556// TODO -- this is only a temporary fix for slit mode   
557        if(binType == 4)
558                /// this is for a tall, narrow slit mode       
559                V_fBinDetector_byRows("Back","B")
560        endif   
561       
562End
563
564////////////to plot the back panel I(q)
565Window Back_IQ_Graph() : Graph
566
567        SetDataFolder root:Packages:NIST:VSANS:VCALC
568
569        Variable binType
570       
571        ControlInfo/W=VCALC popup_b
572        binType = V_Value               // V_value counts menu items from 1, so 1=1, 2=2, 3=4
573       
574
575        if(binType==1 || binType==2 || binType==3)
576               
577                SetDataFolder root:Packages:NIST:VSANS:VCALC
578                CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_B
579               
580                if(V_flag==0)
581                        AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_B vs qBin_qxqy_B
582                        ModifyGraph/W=VCALC#Panels_IQ mode=4
583                        ModifyGraph/W=VCALC#Panels_IQ marker=19
584                        ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_B)=(1,52428,52428)
585                        ModifyGraph/W=VCALC#Panels_IQ msize=2
586                        ModifyGraph/W=VCALC#Panels_IQ grid=1
587                        ModifyGraph/W=VCALC#Panels_IQ log=1
588                        ModifyGraph/W=VCALC#Panels_IQ mirror=2
589                endif
590        endif
591
592        //nothing different here since there is ony a single detector to display, but for the future...
593        if(binType==4)
594               
595                SetDataFolder root:Packages:NIST:VSANS:VCALC
596                CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_B
597               
598                if(V_flag==0)
599                        AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_B vs qBin_qxqy_B
600                        ModifyGraph/W=VCALC#Panels_IQ mode=4
601                        ModifyGraph/W=VCALC#Panels_IQ marker=19
602                        ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_B)=(1,52428,52428)
603                        ModifyGraph/W=VCALC#Panels_IQ msize=2
604                        ModifyGraph/W=VCALC#Panels_IQ grid=1
605                        ModifyGraph/W=VCALC#Panels_IQ log=1
606                        ModifyGraph/W=VCALC#Panels_IQ mirror=2
607                endif
608        endif
609
610       
611
612       
613        SetDataFolder root:
614EndMacro
615
Note: See TracBrowser for help on using the repository browser.