source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DataPlotting.ipf @ 982

Last change on this file since 982 was 982, checked in by srkline, 7 years ago

more changes and additons to display VSANS data

adding functions for IvsQ plotting

coverted much of VCALC to have similar folder structure as HDF to allow re-use of the Q-binning procedures from VCALC with real data in work files.

re-working the beam center finder to get it to work with work file data rather then only VCALC.

new plotting routines for the panels to rescale to the beam center (still in pixels, though)

File size: 11.2 KB
Line 
1#pragma TextEncoding = "MacRoman"               // For details execute DisplayHelpTopic "The TextEncoding Pragma"
2#pragma rtGlobals=3             // Use modern global access method and strict wave access.
3#pragma version=1.0
4
5
6//
7// functions to plot the averaged data in various views.
8//
9
10
11
12//
13// simple entry procedure
14//
15Function V_PlotData_Panel()
16        DoWindow V_1D_Data
17        if(V_flag==0)
18                Execute "V_DrawPlotPanel()"
19        endif
20End
21
22
23// graph with the 1D representation of the VSANS detectors
24//
25// TODO:
26// -- add multiple options for how to present/rescale the data
27// -- automatically position the window next to the 2D data
28// -- color coding of the different panels (data tags/arrows/toggle on/off)?
29// -- VERIFY accuracy
30// -- decide what to add to the control bar
31//
32// -- see Middle_IQ_Graph() and similar for how VCALC does this plot
33//
34Proc V_DrawPlotPanel()
35       
36        String type = root:Packages:NIST:VSANS:Globals:gCurDispType
37
38        PauseUpdate; Silent 1           // building window...
39        Display /W=(277,526,748,938)/N=V_1D_Data
40
41        V_QBinAllPanels(type)
42
43// TODO "B" detector is currently skipped - Q is not yet calculated
44//      V_Back_IQ_Graph()
45        V_Middle_IQ_Graph(type)
46        V_Front_IQ_Graph(type)
47       
48End
49
50
51
52//
53// see the VCALC BinAllMiddlePanels() for an example of this
54//
55// TODO
56// -- detector "B" is currently skipped since the calibration waves are not faked
57//    when the raw data is loaded. Then the qxqyqz waves are not generated.
58// -- figure out the binning type (where is it set?)
59// -- binning type is HARD-WIRED
60// -- figure out when this is to be called to re-calculate the I vs Q
61//
62Function V_QBinAllPanels(folderStr)
63        String folderStr
64
65        // do the back, middle, and front separately
66       
67//      figure out the binning type (where is it set?)
68        Variable binType,ii,delQ
69        String detStr
70        binType = 1
71       
72       
73
74//// TODO -- currently the "B" detector is skipped - it was skipped in
75//       previous functions where q values are calculated       
76//     
77//      delQ = SetDeltaQ("RAW","B")
78//     
79//      // dispatch based on binning type
80//      if(binType == 4)
81//              VC_fDoBinning_QxQy2D("RAW", "B")                //normal binning, nothing to combine
82//      endif
83//
84//// TODO -- this is only a temporary fix for slit mode
85//      if(binType == 4)
86//              /// this is for a tall, narrow slit mode       
87//              VC_fBinDetector_byRows("VCALC","B")
88//      endif   
89
90// these are the binning types where detectors are not combined
91// other combined binning is below the loop
92        for(ii=0;ii<ItemsInList(ksDetectorListNoB);ii+=1)
93                detStr = StringFromList(ii, ksDetectorListNoB, ";")
94               
95                // set delta Q for binning
96                delQ = SetDeltaQ(folderStr,detStr)
97               
98                // dispatch based on binning type
99                if(binType==1)
100                        VC_fDoBinning_QxQy2D(folderStr,detStr)
101                endif
102               
103                // TODO -- this is only a temporary fix for slit mode   
104                if(binType == 4)
105                        /// this is for a tall, narrow slit mode       
106                        VC_fBinDetector_byRows(folderStr,detStr)
107                endif   
108               
109        endfor
110       
111        // bin in pairs
112        if(binType == 2)
113                VC_fDoBinning_QxQy2D(folderStr,"MLR")
114                VC_fDoBinning_QxQy2D(folderStr,"MTB")
115                VC_fDoBinning_QxQy2D(folderStr,"FLR")
116                VC_fDoBinning_QxQy2D(folderStr,"FTB")   
117        endif
118       
119        // bin everything on front or middle together
120        if(binType == 3)
121                VC_fDoBinning_QxQy2D(folderStr,"MLRTB")
122                VC_fDoBinning_QxQy2D(folderStr,"FLRTB")
123        endif
124
125        return(0)
126End
127
128
129//
130// duplicated from Middle_IQ_Graph from VCALC
131// but plotted in a standalone graph window and not the VCALC subwindow
132//
133// V_1D_Data
134//
135// TODO
136// -- need to set binType
137// -- currently  hard-wired == 1
138//
139//
140Proc V_Middle_IQ_Graph(type)
141        String type
142
143        Variable binType
144       
145//      ControlInfo/W=VCALC popup_b
146//      binType = V_Value               // V_value counts menu items from 1, so 1=1, 2=2, 3=4
147
148        binType = 1
149        SetDataFolder $("root:Packages:NIST:VSANS:"+type)
150
151        if(binType==1)
152                ClearIQIfDisplayed(type,"MLRTB")
153                ClearIQIfDisplayed(type,"MLR")
154                ClearIQIfDisplayed(type,"MTB")          //this returns to root:
155               
156                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
157                CheckDisplayed/W=V_1D_Data iBin_qxqy_ML
158               
159                if(V_flag==0)
160                        AppendtoGraph/W=V_1D_Data iBin_qxqy_ML vs qBin_qxqy_ML
161                        AppendToGraph/W=V_1D_Data iBin_qxqy_MR vs qBin_qxqy_MR
162                        AppendToGraph/W=V_1D_Data iBin_qxqy_MT vs qBin_qxqy_MT
163                        AppendToGraph/W=V_1D_Data iBin_qxqy_MB vs qBin_qxqy_MB
164                        ModifyGraph/W=V_1D_Data mode=4
165                        ModifyGraph/W=V_1D_Data marker=19
166                        ModifyGraph/W=V_1D_Data 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)
167                        ModifyGraph/W=V_1D_Data msize=2
168                        ModifyGraph/W=V_1D_Data muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MB)={0,2},muloffset(iBin_qxqy_MR)={0,8}
169                        ModifyGraph/W=V_1D_Data grid=1
170                        ModifyGraph/W=V_1D_Data log=1
171                        ModifyGraph/W=V_1D_Data mirror=2
172                endif           
173        endif
174       
175        if(binType==2)
176                ClearIQIfDisplayed(type,"MLRTB")
177                ClearIQIfDisplayed(type,"MT")   
178                ClearIQIfDisplayed(type,"ML")   
179                ClearIQIfDisplayed(type,"MR")   
180                ClearIQIfDisplayed(type,"MB")
181       
182
183                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
184                CheckDisplayed/W=V_1D_Data iBin_qxqy_MLR
185               
186                if(V_flag==0)
187                        AppendtoGraph/W=V_1D_Data iBin_qxqy_MLR vs qBin_qxqy_MLR
188                        AppendToGraph/W=V_1D_Data iBin_qxqy_MTB vs qBin_qxqy_MTB
189                        ModifyGraph/W=V_1D_Data mode=4
190                        ModifyGraph/W=V_1D_Data marker=19
191                        ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_MLR)=(65535,0,0),rgb(iBin_qxqy_MTB)=(1,16019,65535)
192                        ModifyGraph/W=V_1D_Data msize=2
193                        ModifyGraph/W=V_1D_Data muloffset(iBin_qxqy_MLR)={0,2}
194                        ModifyGraph/W=V_1D_Data grid=1
195                        ModifyGraph/W=V_1D_Data log=1
196                        ModifyGraph/W=V_1D_Data mirror=2
197                        Label/W=V_1D_Data left "Intensity (1/cm)"
198                        Label/W=V_1D_Data bottom "Q (1/A)"
199                endif   
200                       
201        endif
202       
203        if(binType==3)
204                ClearIQIfDisplayed(type,"MLR")
205                ClearIQIfDisplayed(type,"MTB") 
206                ClearIQIfDisplayed(type,"MT")   
207                ClearIQIfDisplayed(type,"ML")   
208                ClearIQIfDisplayed(type,"MR")   
209                ClearIQIfDisplayed(type,"MB")   
210       
211                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
212                CheckDisplayed/W=V_1D_Data iBin_qxqy_MLRTB
213               
214                if(V_flag==0)
215                        AppendtoGraph/W=V_1D_Data iBin_qxqy_MLRTB vs qBin_qxqy_MLRTB
216                        ModifyGraph/W=V_1D_Data mode=4
217                        ModifyGraph/W=V_1D_Data marker=19
218                        ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_MLRTB)=(65535,0,0)
219                        ModifyGraph/W=V_1D_Data msize=2
220                        ModifyGraph/W=V_1D_Data grid=1
221                        ModifyGraph/W=V_1D_Data log=1
222                        ModifyGraph/W=V_1D_Data mirror=2
223                        Label/W=V_1D_Data left "Intensity (1/cm)"
224                        Label/W=V_1D_Data bottom "Q (1/A)"
225                endif   
226                       
227        endif
228
229        if(binType==4)          // slit aperture binning - Mt, ML, MR, MB are averaged
230                ClearIQIfDisplayed(type,"MLRTB")
231                ClearIQIfDisplayed(type,"MLR")
232                ClearIQIfDisplayed(type,"MTB")
233               
234//              SetDataFolder root:Packages:NIST:VSANS:VCALC
235                CheckDisplayed/W=V_1D_Data iBin_qxqy_ML
236               
237                if(V_flag==0)
238                        AppendtoGraph/W=V_1D_Data iBin_qxqy_ML vs qBin_qxqy_ML
239                        AppendToGraph/W=V_1D_Data iBin_qxqy_MR vs qBin_qxqy_MR
240                        AppendToGraph/W=V_1D_Data iBin_qxqy_MT vs qBin_qxqy_MT
241                        AppendToGraph/W=V_1D_Data iBin_qxqy_MB vs qBin_qxqy_MB
242                        ModifyGraph/W=V_1D_Data mode=4
243                        ModifyGraph/W=V_1D_Data marker=19
244                        ModifyGraph/W=V_1D_Data 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)
245                        ModifyGraph/W=V_1D_Data msize=2
246                        ModifyGraph/W=V_1D_Data muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MB)={0,2},muloffset(iBin_qxqy_MR)={0,8}
247                        ModifyGraph/W=V_1D_Data grid=1
248                        ModifyGraph/W=V_1D_Data log=1
249                        ModifyGraph/W=V_1D_Data mirror=2
250                endif           
251                       
252        endif
253       
254        SetDataFolder root:
255End
256
257//
258// duplicated from Middle_IQ_Graph from VCALC
259// but plotted in a standalone graph window and not the VCALC subwindow
260//
261// V_1D_Data
262//
263// TODO
264// -- need to set binType
265// -- currently  hard-wired == 1
266//
267//
268Proc V_Front_IQ_Graph(type)
269        String type
270
271        Variable binType
272       
273//      ControlInfo/W=VCALC popup_b
274//      binType = V_Value               // V_value counts menu items from 1, so 1=1, 2=2, 3=4
275
276        binType = 1
277        SetDataFolder $("root:Packages:NIST:VSANS:"+type)
278
279        if(binType==1)
280                ClearIQIfDisplayed(type,"FLRTB")
281                ClearIQIfDisplayed(type,"FLR")
282                ClearIQIfDisplayed(type,"FTB")          //this returns to root:
283               
284                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
285                CheckDisplayed/W=V_1D_Data iBin_qxqy_FL
286               
287                if(V_flag==0)
288                        AppendtoGraph/W=V_1D_Data iBin_qxqy_FL vs qBin_qxqy_FL
289                        AppendToGraph/W=V_1D_Data iBin_qxqy_FR vs qBin_qxqy_FR
290                        AppendToGraph/W=V_1D_Data iBin_qxqy_FT vs qBin_qxqy_FT
291                        AppendToGraph/W=V_1D_Data iBin_qxqy_FB vs qBin_qxqy_FB
292                        ModifyGraph/W=V_1D_Data mode=4
293                        ModifyGraph/W=V_1D_Data marker=19
294                        ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_FL)=(39321,26208,1),rgb(iBin_qxqy_FB)=(2,39321,1),rgb(iBin_qxqy_FR)=(39321,26208,1),rgb(iBin_qxqy_FT)=(2,39321,1)
295                        ModifyGraph/W=V_1D_Data msize=2
296                        ModifyGraph/W=V_1D_Data muloffset(iBin_qxqy_FL)={0,4},muloffset(iBin_qxqy_FB)={0,2},muloffset(iBin_qxqy_FR)={0,8}
297                        ModifyGraph/W=V_1D_Data grid=1
298                        ModifyGraph/W=V_1D_Data log=1
299                        ModifyGraph/W=V_1D_Data mirror=2
300                endif           
301        endif
302       
303        if(binType==2)
304                ClearIQIfDisplayed(type,"FLRTB")
305                ClearIQIfDisplayed(type,"FT")   
306                ClearIQIfDisplayed(type,"FL")   
307                ClearIQIfDisplayed(type,"FR")   
308                ClearIQIfDisplayed(type,"FB")
309       
310
311                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
312                CheckDisplayed/W=V_1D_Data iBin_qxqy_FLR
313               
314                if(V_flag==0)
315                        AppendtoGraph/W=V_1D_Data iBin_qxqy_FLR vs qBin_qxqy_FLR
316                        AppendToGraph/W=V_1D_Data iBin_qxqy_FTB vs qBin_qxqy_FTB
317                        ModifyGraph/W=V_1D_Data mode=4
318                        ModifyGraph/W=V_1D_Data marker=19
319                        ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_FLR)=(39321,26208,1),rgb(iBin_qxqy_FTB)=(2,39321,1)
320                        ModifyGraph/W=V_1D_Data msize=2
321                        ModifyGraph/W=V_1D_Data muloffset(iBin_qxqy_FLR)={0,2}
322                        ModifyGraph/W=V_1D_Data grid=1
323                        ModifyGraph/W=V_1D_Data log=1
324                        ModifyGraph/W=V_1D_Data mirror=2
325                        Label/W=V_1D_Data left "Intensity (1/cm)"
326                        Label/W=V_1D_Data bottom "Q (1/A)"
327                endif   
328                       
329        endif
330       
331        if(binType==3)
332                ClearIQIfDisplayed(type,"FLR")
333                ClearIQIfDisplayed(type,"FTB") 
334                ClearIQIfDisplayed(type,"FT")   
335                ClearIQIfDisplayed(type,"FL")   
336                ClearIQIfDisplayed(type,"FR")   
337                ClearIQIfDisplayed(type,"FB")   
338       
339                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
340                CheckDisplayed/W=V_1D_Data iBin_qxqy_FLRTB
341               
342                if(V_flag==0)
343                        AppendtoGraph/W=V_1D_Data iBin_qxqy_FLRTB vs qBin_qxqy_FLRTB
344                        ModifyGraph/W=V_1D_Data mode=4
345                        ModifyGraph/W=V_1D_Data marker=19
346                        ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_FLRTB)=(39321,26208,1)
347                        ModifyGraph/W=V_1D_Data msize=2
348                        ModifyGraph/W=V_1D_Data grid=1
349                        ModifyGraph/W=V_1D_Data log=1
350                        ModifyGraph/W=V_1D_Data mirror=2
351                        Label/W=V_1D_Data left "Intensity (1/cm)"
352                        Label/W=V_1D_Data bottom "Q (1/A)"
353                endif   
354                       
355        endif
356
357        if(binType==4)          // slit aperture binning - Mt, ML, MR, MB are averaged
358                ClearIQIfDisplayed(type,"FLRTB")
359                ClearIQIfDisplayed(type,"FLR")
360                ClearIQIfDisplayed(type,"FTB")
361               
362//              SetDataFolder root:Packages:NIST:VSANS:VCALC
363                CheckDisplayed/W=V_1D_Data iBin_qxqy_FL
364               
365                if(V_flag==0)
366                        AppendtoGraph/W=V_1D_Data iBin_qxqy_FL vs qBin_qxqy_FL
367                        AppendToGraph/W=V_1D_Data iBin_qxqy_FR vs qBin_qxqy_FR
368                        AppendToGraph/W=V_1D_Data iBin_qxqy_FT vs qBin_qxqy_FT
369                        AppendToGraph/W=V_1D_Data iBin_qxqy_FB vs qBin_qxqy_FB
370                        ModifyGraph/W=V_1D_Data mode=4
371                        ModifyGraph/W=V_1D_Data marker=19
372                        ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_FL)=(39321,26208,1),rgb(iBin_qxqy_FB)=(2,39321,1),rgb(iBin_qxqy_FR)=(39321,26208,1),rgb(iBin_qxqy_FT)=(2,39321,1)
373                        ModifyGraph/W=V_1D_Data msize=2
374                        ModifyGraph/W=V_1D_Data muloffset(iBin_qxqy_FL)={0,4},muloffset(iBin_qxqy_FB)={0,2},muloffset(iBin_qxqy_FR)={0,8}
375                        ModifyGraph/W=V_1D_Data grid=1
376                        ModifyGraph/W=V_1D_Data log=1
377                        ModifyGraph/W=V_1D_Data mirror=2
378                endif           
379                       
380        endif
381       
382        SetDataFolder root:
383End
384
385
386
Note: See TracBrowser for help on using the repository browser.