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

Last change on this file since 1037 was 1035, checked in by srkline, 5 years ago

changes to streamline the data plotting of 1D data, in preparation for different modes of combining detector panels. Also will allow better integration with protocols to combine 1D data, which can now be part of the protocol.

Other changes, but I can't remember whtat they were...

File size: 29.3 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 and binning types
8//
9
10
11
12//
13// simple entry procedure
14//
15// graph with the 1D representation of the VSANS detectors
16//
17// TODO:
18// -- add multiple options for how to present/rescale the data
19// -- automatically position the window next to the 2D data
20// -- color coding of the different panels (data tags/arrows/toggle on/off)?
21// -- VERIFY accuracy
22//
23// -- decide what to add to the control bar
24// ()()() In SANS, there are only 3 waves (q-i-s) and these are copied over to the plot1D folder, and the copy
25//    of the data is plotted, not the data in the WORK folder. Then for rescaling, a "fresh" copy of the data is
26//    fetched, and then rescaled. The plot automatically reflects these changes.
27//  --- for VSANS, this is much more difficult since there are multiple possibilites of 1D data, depending on the
28//     binning chosen. Currently, the data is plotted directly from the WORK folder, so this would need to be changed
29//     at the start, then deciding which waves to copy over. Messy. Very Messy. For now, simply toggle log/lin
30//
31// -- at the very least, add a log/lin toggle for the axes
32//
33// -- document, document, document
34//
35// -- see Middle_IQ_Graph() and similar for how VCALC does this plot
36//
37// -- when/if I want to add phi-averaging to this, go gack to AvgGraphics.ipf for the pink panel
38//    and to the function Draw_Plot1D() for the drawing of the plot
39//
40// If -9999 is passed in as the "binType", then read the proper value from the popup on the graph.
41//  otherwise, assume that a proper value has been passed in, say from the reduction protocol
42//
43Function V_PlotData_Panel()
44//      Variable binType
45
46        DoWindow/F V_1D_Data
47        if(V_flag==0)
48       
49//              NewDataFolder/O root:Packages:NIST:VSANS:Globals:Plot_1D
50//              Variable/G root:Packages:NIST:VSANS:Globals:Plot_1D:gYMode = 1
51//              Variable/G root:Packages:NIST:VSANS:Globals:Plot_1D:gXMode = 1
52//              Variable/G root:Packages:NIST:VSANS:Globals:Plot_1D:gExpA = 1
53//              Variable/G root:Packages:NIST:VSANS:Globals:Plot_1D:gExpB = 1
54//              Variable/G root:Packages:NIST:VSANS:Globals:Plot_1D:gExpC = 1
55               
56               
57                Display /W=(277,526,748,938)/N=V_1D_Data/K=1
58
59                ControlBar 70
60               
61                PopupMenu popup0,pos={16,5},size={71,20},title="Bin Type"
62                PopupMenu popup0,help={"This popup selects how the y-axis will be linearized based on the chosen data"}
63                PopupMenu popup0,value= ksBinTypeStr
64                PopupMenu popup0,mode=1,proc=V_BinningModePopup
65               
66                CheckBox check0,pos={18.00,36.00},size={57.00,16.00},proc=V_Plot1D_LogCheckProc,title="Log Axes"
67                CheckBox check0,value= 1
68       
69//              PopupMenu ymodel,pos={150,5},size={71,20},title="y-axis"
70//              PopupMenu ymodel,help={"This popup selects how the y-axis will be linearized based on the chosen data"}
71//              PopupMenu ymodel,value= #"\"I;log(I);ln(I);1/I;I^a;Iq^a;I^a q^b;1/sqrt(I);ln(Iq);ln(Iq^2)\""
72//              PopupMenu ymodel,mode=NumVarOrDefault("root:Packages:NIST:VSANS:Globals:Plot_1d:gYMode", 1 ),proc=V_YMode_PopMenuProc
73//              PopupMenu xmodel,pos={220,5},size={74,20},title="x-axis"
74//              PopupMenu xmodel,help={"This popup selects how the x-axis will be linearized given the chosen data"}
75//              PopupMenu xmodel,value= #"\"q;log(q);q^2;q^c\""
76//              PopupMenu xmodel,mode=NumVarOrDefault("root:Packages:NIST:VSANS:Globals:Plot_1d:gXMode", 1 ),proc=V_XMode_PopMenuProc
77////            Button Rescale,pos={281,5},size={70,20},proc=V_Rescale_Plot_1D_ButtonProc,title="Rescale"
78////            Button Rescale,help={"Rescale the x and y-axes of the data"},disable=1
79//
80//              SetVariable expa,pos={120,28},size={80,15},title="pow \"a\""
81//              SetVariable expa,help={"This sets the exponent \"a\" for some y-axis formats. The value is ignored if the model does not use an adjustable exponent"}
82//              SetVariable expa,limits={-2,10,0},value= root:Packages:NIST:VSANS:Globals:Plot_1d:gExpA
83//              SetVariable expb,pos={120,46},size={80,15},title="pow \"b\""
84//              SetVariable expb,help={"This sets the exponent \"b\" for some x-axis formats. The value is ignored if the model does not use an adjustable exponent"}
85//              SetVariable expb,limits={0,10,0},value= root:Packages:NIST:VSANS:Globals:Plot_1d:gExpB
86//
87//              SetVariable expc,pos={220,28},size={80,15},title="pow \"c\""
88//              SetVariable expc,help={"This sets the exponent \"c\" for some x-axis formats. The value is ignored if the model does not use \"c\" as an adjustable exponent"}
89//              SetVariable expc,limits={-10,10,0},value= root:Packages:NIST:VSANS:Globals:Plot_1d:gExpC
90               
91                Button AllQ,pos={320,28},size={70,20},proc=V_AllQ_Plot_1D_ButtonProc,title="All Q"
92                Button AllQ,help={"Show the full q-range of the dataset"}
93               
94                Legend/C/N=text0/J/X=72.00/Y=60.00
95        endif
96               
97       
98//      SVAR workType = root:Packages:NIST:VSANS:Globals:gCurDispType
99//
100//      if(binType == -9999)
101//              binType = V_GetBinningPopMode()         //dummy passed in, replace with value from panel
102//      endif
103//     
104//     
105//      V_QBinAllPanels(workType,binType)
106
107
108       
109End
110
111// TODO
112// -- winStr is currently hard-wired, but this may not be an issue
113Function V_Update1D_Graph(workType,binType)
114        String workType
115        Variable binType
116       
117        // TODO:
118// x- "B" detector is currently skipped - Q is not yet calculated
119        String str,winStr="V_1D_Data"
120        sprintf str,"(\"%s\",%d,\"%s\")",workType,binType,winStr
121       
122        Execute ("V_Back_IQ_Graph"+str)
123//      Print "V_Back_IQ_Graph"+str
124        Execute ("V_Middle_IQ_Graph"+str)
125        Execute ("V_Front_IQ_Graph"+str)
126
127       
128        return(0)
129end
130
131Function V_Plot1D_LogCheckProc(cba) : CheckBoxControl
132        STRUCT WMCheckboxAction &cba
133
134        switch( cba.eventCode )
135                case 2: // mouse up
136                        Variable checked = cba.checked
137                               
138                                ModifyGraph log=(checked)
139                       
140                        break
141                case -1: // control being killed
142                        break
143        endswitch
144
145        return 0
146End
147
148//
149////function to set the popItem (mode) of the graph, to re-create the graph based on user preferences
150//Function V_YMode_PopMenuProc(ctrlName,popNum,popStr) : PopupMenuControl
151//      String ctrlName
152//      Variable popNum
153//      String popStr
154//
155//      Variable/G root:Packages:NIST:VSANS:Globals:Plot_1d:gYMode=popNum
156//      V_Rescale_Plot_1D_ButtonProc("")
157//End
158//
159////function to set the popItem (mode) of the graph, to re-create the graph based on user preferences
160//Function V_XMode_PopMenuProc(ctrlName,popNum,popStr) : PopupMenuControl
161//      String ctrlName
162//      Variable popNum
163//      String popStr
164//
165//      Variable/G root:Packages:NIST:VSANS:Globals:Plot_1d:gXMode=popNum
166//      V_Rescale_Plot_1D_ButtonProc("")
167//End
168
169
170//function to rescale the axes of the graph as selected from the popups and the
171// entered values of the exponents
172//** assumes the current waves are unknown, so it goes and gets a "fresh" copy from
173//the data folder specified by the waves on the graph, which is the same folder that
174//contains the "fresh" copy of the 1D data
175//
176// for log(10) scaling, simply modify the axes, not the data - gives better plots
177//
178//Function V_Rescale_Plot_1D_ButtonProc(ctrlName) : ButtonControl
179//      String ctrlName
180//     
181//      DoWindow/F V_1D_Data
182////Scaling exponents and background value
183//      Variable pow_a,pow_b,pow_c
184//      ControlInfo expa
185//      pow_a = V_value
186//      ControlInfo expb
187//      pow_b = V_value
188//      ControlInfo expc
189//      pow_c = V_value
190//     
191////check for physical limits on exponent values, abort if bad values found
192//      if((pow_a < -2) || (pow_a > 10))
193//              Abort "Exponent a must be in the range (-2,10)"
194//      endif
195//      if((pow_b < 0) || (pow_b > 10))
196//              Abort "Exponent b must be in the range (0,10)"
197//      endif
198//      //if q^c is the x-scaling, c must be be within limits and also non-zero
199//      ControlInfo xModel
200//      If (cmpstr("q^c",S_Value) == 0)
201//              if(pow_c == 0)
202//                      Abort "Exponent c must be non-zero, q^0 = 1"
203//              endif
204//              if((pow_c < -10) || (pow_c > 10))
205//                      Abort "Exponent c must be in the range (-10,10)"
206//              endif
207//      endif           //check q^c exponent
208//     
209//// get the current experimental q, I, and std dev. waves
210//      SVAR curFolder=root:Packages:NIST:VSANS:Globals:gDataDisplayType
211//
212//// what is the binning? == what waves do we need to copy over
213//     
214//
215//      //get the untarnished data, so we can rescale it freshly here
216//      Wave yw = $("root:Packages:NIST:"+curFolder+":aveint")
217//      Wave ew = $("root:Packages:NIST:"+curFolder+":sigave")
218//      //get the correct x values
219//      NVAR isPhiAve= root:myGlobals:Plot_1d:isPhiAve  //0 signifies (normal) x=qvals
220//      if(isPhiAve)
221//              //x is angle
222//              Wave xw=$("root:Packages:NIST:"+curFolder+":phival")
223//      else
224//              //x is q-values
225//              Wave xw=$("root:Packages:NIST:"+curFolder+":qval")
226//      endif
227//      Wave yAxisWave=root:myGlobals:Plot_1d:yAxisWave         //refs to waves to be modified, hard-wired positions
228//      Wave xAxisWave=root:myGlobals:Plot_1d:xAxisWave
229//      Wave yErrWave=root:myGlobals:Plot_1d:yErrWave
230//     
231//      //variables set for each model to control look of graph
232//      String xlabel,ylabel,xstr,ystr
233//      Variable logLeft=0,logBottom=0
234//      //check for proper y-scaling selection, make the necessary waves
235//      ControlInfo yModel
236//      ystr = S_Value
237//      do
238//              If (cmpstr("I",S_Value) == 0)
239//                      SetScale d 0,0,"1/cm",yAxisWave
240//                      yErrWave = ew
241//                      yAxisWave = yw
242//                      ylabel = "I(q)"
243//                      break   
244//              endif
245//              If (cmpstr("ln(I)",S_Value) == 0)
246//                      SetScale d 0,0,"",yAxisWave
247//                      yErrWave = ew/yw
248//                      yAxisWave = ln(yw)
249//                      ylabel = "ln(I)"
250//                      break   
251//              endif
252//              If (cmpstr("log(I)",S_Value) == 0)
253//                      SetScale d 0,0,"",yAxisWave
254//                      yAxisWave = yw
255//                      yErrWave = ew
256//                      logLeft=1                               //scale the axis, not the wave
257//                      ylabel = "I(q)"
258////                    yErrWave = ew/(2.30*yw)
259////                    yAxisWave = log(yw)
260////                    ylabel = "log(I)"
261//                      break   
262//              endif
263//              If (cmpstr("1/I",S_Value) == 0)
264//                      SetScale d 0,0,"",yAxisWave
265//                      yErrWave = ew/yw^2
266//                      yAxisWave = 1/yw
267//                      ylabel = "1/I"
268//                      break
269//              endif
270//              If (cmpstr("I^a",S_Value) == 0)
271//                      SetScale d 0,0,"",yAxisWave
272//                      yErrWave = ew*abs(pow_a*(yw^(pow_a-1)))
273//                      yAxisWave = yw^pow_a
274//                      ylabel = "I^"+num2str(pow_a)
275//                      break
276//              endif
277//              If (cmpstr("Iq^a",S_Value) == 0)
278//                      SetScale d 0,0,"",yAxisWave
279//                      yErrWave = ew*xw^pow_a
280//                      yAxisWave = yw*xw^pow_a
281//                      ylabel = "I*q^"+num2str(pow_a)
282//                      break
283//              endif
284//              If (cmpstr("I^a q^b",S_Value) == 0)
285//                      SetScale d 0,0,"",yAxisWave
286//                      yErrWave = ew*abs(pow_a*(yw^(pow_a-1)))*xw^pow_b
287//                      yAxisWave = yw^pow_a*xw^pow_b
288//                      ylabel = "I^" + num2str(pow_a) + "q^"+num2str(pow_b)
289//                      break
290//              endif
291//              If (cmpstr("1/sqrt(I)",S_Value) == 0)
292//                      SetScale d 0,0,"",yAxisWave
293//                      yErrWave = 0.5*ew*yw^(-1.5)
294//                      yAxisWave = 1/sqrt(yw)
295//                      ylabel = "1/sqrt(I)"
296//                      break
297//              endif
298//              If (cmpstr("ln(Iq)",S_Value) == 0)
299//                      SetScale d 0,0,"",yAxisWave
300//                      yErrWave =ew/yw
301//                      yAxisWave = ln(xw*yw)
302//                      ylabel = "ln(q*I)"
303//                      break
304//              endif
305//              If (cmpstr("ln(Iq^2)",S_Value) == 0)
306//                      SetScale d 0,0,"",yAxisWave
307//                      yErrWave = ew/yw
308//                      yAxisWave = ln(xw*xw*yw)
309//                      ylabel = "ln(I*q^2)"
310//                      break
311//              endif
312//              //more ifs for each case as they are added
313//             
314//              // if selection not found, abort
315//              DoAlert 0,"Y-axis scaling incorrect. Aborting"
316//              Abort
317//      while(0)        //end of "case" statement for y-axis scaling
318//     
319//      //check for proper x-scaling selection
320//      SVAR/Z angst = root:Packages:NIST:gAngstStr
321//      String dum
322//     
323//      ControlInfo xModel
324//      xstr = S_Value
325//      do
326//              If (cmpstr("q",S_Value) == 0)   
327//                      SetScale d 0,0,"",xAxisWave
328//                      xAxisWave = xw
329//                      if(isPhiAve)
330//                              xlabel="Angle (deg)"
331//                      else
332//                              xlabel = "q ("+angst+"\\S-1\\M)"
333//                      endif
334//                      break   
335//              endif
336//              If (cmpstr("q^2",S_Value) == 0)
337//                      SetScale d 0,0,"",xAxisWave
338//                      xAxisWave = xw*xw
339//                      if(isPhiAve)
340//                              xlabel="(Angle (deg) )^2"
341//                      else
342//                              xlabel = "q^2 ("+angst+"\\S-2\\M)"
343//                      endif
344//                      break   
345//              endif
346//              If (cmpstr("log(q)",S_Value) == 0)     
347//                      SetScale d 0,0,"",xAxisWave
348//                      xAxisWave = xw          //scale the axis, not the wave
349//                      //xAxisWave = log(xw)
350//                      logBottom=1
351//                      if(isPhiAve)
352//                              //xlabel="log(Angle (deg))"
353//                              xlabel="Angle (deg)"
354//                      else
355//                              //xlabel = "log(q)"
356//                              xlabel = "q ("+angst+"\\S-1\\M)"
357//                      endif
358//                      break   
359//              endif
360//              If (cmpstr("q^c",S_Value) == 0)
361//                      SetScale d 0,0,"",xAxisWave
362//                      xAxisWave = xw^pow_c
363//                      dum = num2str(pow_c)
364//                      if(isPhiAve)
365//                              xlabel="Angle^"+dum
366//                      else
367//                              xlabel = "q^"+dum+" ("+angst+"\\S-"+dum+"\\M)"
368//                      endif
369//                      break
370//              endif
371//     
372//              //more ifs for each case
373//             
374//              // if selection not found, abort
375//              DoAlert 0,"X-axis scaling incorrect. Aborting"
376//              Abort
377//      while(0)        //end of "case" statement for x-axis scaling
378//     
379//      Label left ylabel
380//      Label bottom xlabel     //E denotes "scaling"  - may want to use "units" instead       
381//      ModifyGraph log(left)=(logLeft)
382//      ModifyGraph log(bottom)=(logBottom)
383//     
384//End
385
386
387//function to restore the graph axes to full scale, undoing any zooming
388Function V_AllQ_Plot_1D_ButtonProc(ctrlName) : ButtonControl
389        String ctrlName
390       
391        SetAxis/A
392End
393
394
395//
396// recalculate the I(q) binning. no need to adjust model function or views
397// just rebin
398//
399// see V_CombineModePopup() in V_Combine_1D.ipf for a duplicate verison of this function
400//
401Function V_BinningModePopup(ctrlName,popNum,popStr) : PopupMenuControl
402        String ctrlName
403        Variable popNum // which item is currently selected (1-based)
404        String popStr           // contents of current popup item as string
405
406        SVAR type = root:Packages:NIST:VSANS:Globals:gCurDispType
407
408        V_QBinAllPanels(type,popNum)
409
410        String str,winStr="V_1D_Data"
411        sprintf str,"(\"%s\",%d,\"%s\")",type,popNum,winStr
412
413        Execute ("V_Back_IQ_Graph"+str)
414        Execute ("V_Middle_IQ_Graph"+str)
415        Execute ("V_Front_IQ_Graph"+str)
416               
417//      Execute ("V_Back_IQ_Graph(\""+type+"\")")
418//      Execute ("V_Middle_IQ_Graph(\""+type+"\")")
419//      Execute ("V_Front_IQ_Graph(\""+type+"\")")
420       
421        return(0)       
422End
423
424Function V_GetBinningPopMode()
425
426        Variable binType
427       
428        if(WinType("V_1D_Data")==0)
429                DoAlert 0,"V_1D_Data window is not open, called from V_GetBinningPopMode()"
430                return(0)
431        endif
432       
433        ControlInfo/W=V_1D_Data popup0
434        binType = V_BinTypeStr2Num(S_Value)
435       
436        return(binType)
437end
438
439//
440// duplicated from Middle_IQ_Graph from VCALC
441// but plotted in a standalone graph window and not the VCALC subwindow
442//
443// V_1D_Data
444//
445// TODO
446// x- need to set binType
447// x- currently  hard-wired == 1
448//
449// input "type" is the data type and defines the folder
450//
451Proc V_Middle_IQ_Graph(type,binType,winNameStr)
452        String type
453        Variable binType
454        String winNameStr
455
456//      binType = V_GetBinningPopMode()
457        SetDataFolder $("root:Packages:NIST:VSANS:"+type)
458
459// clear EVERYTHING
460//              ClearIQIfDisplayed_AllFldr("MLRTB")
461//              ClearIQIfDisplayed_AllFldr("MLR")
462//              ClearIQIfDisplayed_AllFldr("MTB")               //this returns to root:
463//              ClearIQIfDisplayed_AllFldr("MT")       
464//              ClearIQIfDisplayed_AllFldr("ML")       
465//              ClearIQIfDisplayed_AllFldr("MR")       
466//              ClearIQIfDisplayed_AllFldr("MB")       
467
468        if(binType==1)
469                ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr)
470                ClearIQIfDisplayed_AllFldr("MLR",winNameStr)
471                ClearIQIfDisplayed_AllFldr("MTB",winNameStr)            //this returns to root:
472                ClearIQIfDisplayed_AllFldr("MT",winNameStr)     
473                ClearIQIfDisplayed_AllFldr("ML",winNameStr)     
474                ClearIQIfDisplayed_AllFldr("MR",winNameStr)     
475                ClearIQIfDisplayed_AllFldr("MB",winNameStr)                     
476                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
477                CheckDisplayed/W=$winNameStr iBin_qxqy_ML
478               
479                if(V_flag==0)
480                        AppendtoGraph/W=$winNameStr iBin_qxqy_ML vs qBin_qxqy_ML
481                        AppendToGraph/W=$winNameStr iBin_qxqy_MR vs qBin_qxqy_MR
482                        AppendToGraph/W=$winNameStr iBin_qxqy_MT vs qBin_qxqy_MT
483                        AppendToGraph/W=$winNameStr iBin_qxqy_MB vs qBin_qxqy_MB
484                        ErrorBars/T=0 iBin_qxqy_ML Y,wave=(:eBin_qxqy_ML,:eBin_qxqy_ML)
485                        ErrorBars/T=0 iBin_qxqy_MR Y,wave=(:eBin_qxqy_MR,:eBin_qxqy_MR)
486                        ErrorBars/T=0 iBin_qxqy_MT Y,wave=(:eBin_qxqy_MT,:eBin_qxqy_MT)
487                        ErrorBars/T=0 iBin_qxqy_MB Y,wave=(:eBin_qxqy_MB,:eBin_qxqy_MB)
488                       
489                        ModifyGraph/W=$winNameStr mode=4
490                        ModifyGraph/W=$winNameStr marker=19
491                        ModifyGraph/W=$winNameStr 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)
492                        ModifyGraph/W=$winNameStr msize=2
493                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MB)={0,2},muloffset(iBin_qxqy_MR)={0,8}
494                        ModifyGraph/W=$winNameStr grid=1
495                        ModifyGraph/W=$winNameStr log=1
496                        ModifyGraph/W=$winNameStr mirror=2
497                endif           
498        endif
499       
500        if(binType==2)
501// clear EVERYTHING
502                ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr)
503                ClearIQIfDisplayed_AllFldr("MLR",winNameStr)
504                ClearIQIfDisplayed_AllFldr("MTB",winNameStr)            //this returns to root:
505                ClearIQIfDisplayed_AllFldr("MT",winNameStr)     
506                ClearIQIfDisplayed_AllFldr("ML",winNameStr)     
507                ClearIQIfDisplayed_AllFldr("MR",winNameStr)     
508                ClearIQIfDisplayed_AllFldr("MB",winNameStr)             
509       
510//              ClearIQIfDisplayed_AllFldr("MLRTB")
511//              ClearIQIfDisplayed_AllFldr("MT")       
512//              ClearIQIfDisplayed_AllFldr("ML")       
513//              ClearIQIfDisplayed_AllFldr("MR")       
514//              ClearIQIfDisplayed_AllFldr("MB")
515       
516
517                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
518                CheckDisplayed/W=$winNameStr iBin_qxqy_MLR
519               
520                if(V_flag==0)
521                        AppendtoGraph/W=$winNameStr iBin_qxqy_MLR vs qBin_qxqy_MLR
522                        AppendToGraph/W=$winNameStr iBin_qxqy_MTB vs qBin_qxqy_MTB
523                        ErrorBars/T=0 iBin_qxqy_MLR Y,wave=(:eBin_qxqy_MLR,:eBin_qxqy_MLR)
524                        ErrorBars/T=0 iBin_qxqy_MTB Y,wave=(:eBin_qxqy_MTB,:eBin_qxqy_MTB)
525                       
526                        ModifyGraph/W=$winNameStr mode=4
527                        ModifyGraph/W=$winNameStr marker=19
528                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_MLR)=(65535,0,0),rgb(iBin_qxqy_MTB)=(1,16019,65535)
529                        ModifyGraph/W=$winNameStr msize=2
530                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_MLR)={0,2}
531                        ModifyGraph/W=$winNameStr grid=1
532                        ModifyGraph/W=$winNameStr log=1
533                        ModifyGraph/W=$winNameStr mirror=2
534                        Label/W=$winNameStr left "Intensity (1/cm)"
535                        Label/W=$winNameStr bottom "Q (1/A)"
536                endif   
537                       
538        endif
539       
540        if(binType==3)
541// clear EVERYTHING
542                ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr)
543                ClearIQIfDisplayed_AllFldr("MLR",winNameStr)
544                ClearIQIfDisplayed_AllFldr("MTB",winNameStr)            //this returns to root:
545                ClearIQIfDisplayed_AllFldr("MT",winNameStr)     
546                ClearIQIfDisplayed_AllFldr("ML",winNameStr)     
547                ClearIQIfDisplayed_AllFldr("MR",winNameStr)     
548                ClearIQIfDisplayed_AllFldr("MB",winNameStr)             
549       
550//              ClearIQIfDisplayed_AllFldr("MLR")
551//              ClearIQIfDisplayed_AllFldr("MTB")       
552//              ClearIQIfDisplayed_AllFldr("MT")       
553//              ClearIQIfDisplayed_AllFldr("ML")       
554//              ClearIQIfDisplayed_AllFldr("MR")       
555//              ClearIQIfDisplayed_AllFldr("MB")       
556       
557                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
558                CheckDisplayed/W=$winNameStr iBin_qxqy_MLRTB
559               
560                if(V_flag==0)
561                        AppendtoGraph/W=$winNameStr iBin_qxqy_MLRTB vs qBin_qxqy_MLRTB
562                        ErrorBars/T=0 iBin_qxqy_MLRTB Y,wave=(:eBin_qxqy_MLRTB,:eBin_qxqy_MLRTB)
563                       
564                        ModifyGraph/W=$winNameStr mode=4
565                        ModifyGraph/W=$winNameStr marker=19
566                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_MLRTB)=(65535,0,0)
567                        ModifyGraph/W=$winNameStr msize=2
568                        ModifyGraph/W=$winNameStr grid=1
569                        ModifyGraph/W=$winNameStr log=1
570                        ModifyGraph/W=$winNameStr mirror=2
571                        Label/W=$winNameStr left "Intensity (1/cm)"
572                        Label/W=$winNameStr bottom "Q (1/A)"
573                endif   
574                       
575        endif
576
577        if(binType==4)          // slit aperture binning - MT, ML, MR, MB are averaged
578// clear EVERYTHING
579                ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr)
580                ClearIQIfDisplayed_AllFldr("MLR",winNameStr)
581                ClearIQIfDisplayed_AllFldr("MTB",winNameStr)            //this returns to root:
582                ClearIQIfDisplayed_AllFldr("MT",winNameStr)     
583                ClearIQIfDisplayed_AllFldr("ML",winNameStr)     
584                ClearIQIfDisplayed_AllFldr("MR",winNameStr)     
585                ClearIQIfDisplayed_AllFldr("MB",winNameStr)             
586       
587       
588//              ClearIQIfDisplayed_AllFldr("MLRTB")
589//              ClearIQIfDisplayed_AllFldr("MLR")
590//              ClearIQIfDisplayed_AllFldr("MTB")
591               
592                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
593                CheckDisplayed/W=$winNameStr iBin_qxqy_ML
594               
595                if(V_flag==0)
596                        AppendToGraph/W=$winNameStr iBin_qxqy_ML vs qBin_qxqy_ML
597                        AppendToGraph/W=$winNameStr iBin_qxqy_MR vs qBin_qxqy_MR
598                        AppendToGraph/W=$winNameStr iBin_qxqy_MT vs qBin_qxqy_MT
599                        AppendToGraph/W=$winNameStr iBin_qxqy_MB vs qBin_qxqy_MB
600                        ErrorBars/T=0 iBin_qxqy_ML Y,wave=(:eBin_qxqy_ML,:eBin_qxqy_ML)
601                        ErrorBars/T=0 iBin_qxqy_MR Y,wave=(:eBin_qxqy_MR,:eBin_qxqy_MR)
602                        ErrorBars/T=0 iBin_qxqy_MT Y,wave=(:eBin_qxqy_MT,:eBin_qxqy_MT)
603                        ErrorBars/T=0 iBin_qxqy_MB Y,wave=(:eBin_qxqy_MB,:eBin_qxqy_MB)
604                       
605                        ModifyGraph/W=$winNameStr mode=4
606                        ModifyGraph/W=$winNameStr marker=19
607                        ModifyGraph/W=$winNameStr 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)
608                        ModifyGraph/W=$winNameStr msize=2
609                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MB)={0,2},muloffset(iBin_qxqy_MR)={0,8}
610                        ModifyGraph/W=$winNameStr grid=1
611                        ModifyGraph/W=$winNameStr log=1
612                        ModifyGraph/W=$winNameStr mirror=2
613                endif           
614                       
615        endif
616       
617        SetDataFolder root:
618End
619
620//
621// duplicated from Middle_IQ_Graph from VCALC
622// but plotted in a standalone graph window and not the VCALC subwindow
623//
624// V_1D_Data
625//
626// TODO
627// x- need to set binType
628// x- currently  hard-wired == 1
629// x- error bars on the data
630//
631Proc V_Front_IQ_Graph(type,binType,winNameStr)
632        String type
633        Variable binType
634        String winNameStr
635
636
637//      binType = V_GetBinningPopMode()
638        SetDataFolder $("root:Packages:NIST:VSANS:"+type)
639
640// clear EVERYTHING
641//              ClearIQIfDisplayed_AllFldr("FLRTB")
642//             
643//              ClearIQIfDisplayed_AllFldr("FLR")
644//              ClearIQIfDisplayed_AllFldr("FTB")
645//
646//              ClearIQIfDisplayed_AllFldr("FT")       
647//              ClearIQIfDisplayed_AllFldr("FL")       
648//              ClearIQIfDisplayed_AllFldr("FR")       
649//              ClearIQIfDisplayed_AllFldr("FB")
650               
651        if(binType==1)
652                ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr)
653               
654                ClearIQIfDisplayed_AllFldr("FLR",winNameStr)
655                ClearIQIfDisplayed_AllFldr("FTB",winNameStr)
656
657                ClearIQIfDisplayed_AllFldr("FT",winNameStr)     
658                ClearIQIfDisplayed_AllFldr("FL",winNameStr)     
659                ClearIQIfDisplayed_AllFldr("FR",winNameStr)     
660                ClearIQIfDisplayed_AllFldr("FB",winNameStr)
661                               
662                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
663                CheckDisplayed/W=$winNameStr iBin_qxqy_FL
664               
665                if(V_flag==0)
666                        AppendtoGraph/W=$winNameStr iBin_qxqy_FL vs qBin_qxqy_FL
667                        AppendToGraph/W=$winNameStr iBin_qxqy_FR vs qBin_qxqy_FR
668                        AppendToGraph/W=$winNameStr iBin_qxqy_FT vs qBin_qxqy_FT
669                        AppendToGraph/W=$winNameStr iBin_qxqy_FB vs qBin_qxqy_FB
670                        ErrorBars/T=0 iBin_qxqy_FL Y,wave=(:eBin_qxqy_FL,:eBin_qxqy_FL)
671                        ErrorBars/T=0 iBin_qxqy_FR Y,wave=(:eBin_qxqy_FR,:eBin_qxqy_FR)
672                        ErrorBars/T=0 iBin_qxqy_FT Y,wave=(:eBin_qxqy_FT,:eBin_qxqy_FT)
673                        ErrorBars/T=0 iBin_qxqy_FB Y,wave=(:eBin_qxqy_FB,:eBin_qxqy_FB)
674
675                        ModifyGraph/W=$winNameStr mode=4
676                        ModifyGraph/W=$winNameStr marker=19
677                        ModifyGraph/W=$winNameStr 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)
678                        ModifyGraph/W=$winNameStr msize=2
679                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_FL)={0,4},muloffset(iBin_qxqy_FB)={0,2},muloffset(iBin_qxqy_FR)={0,8}
680                        ModifyGraph/W=$winNameStr grid=1
681                        ModifyGraph/W=$winNameStr log=1
682                        ModifyGraph/W=$winNameStr mirror=2
683                        Label/W=$winNameStr left "Intensity (1/cm)"
684                        Label/W=$winNameStr bottom "Q (1/A)"
685                endif           
686        endif
687       
688        if(binType==2)
689        // clear EVERYTHING
690                ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr)
691               
692                ClearIQIfDisplayed_AllFldr("FLR",winNameStr)
693                ClearIQIfDisplayed_AllFldr("FTB",winNameStr)
694
695                ClearIQIfDisplayed_AllFldr("FT",winNameStr)     
696                ClearIQIfDisplayed_AllFldr("FL",winNameStr)     
697                ClearIQIfDisplayed_AllFldr("FR",winNameStr)     
698                ClearIQIfDisplayed_AllFldr("FB",winNameStr)
699//              ClearIQIfDisplayed_AllFldr("FLRTB")
700//              ClearIQIfDisplayed_AllFldr("FT")       
701//              ClearIQIfDisplayed_AllFldr("FL")       
702//              ClearIQIfDisplayed_AllFldr("FR")       
703//              ClearIQIfDisplayed_AllFldr("FB")       
704
705                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
706                CheckDisplayed/W=$winNameStr iBin_qxqy_FLR
707               
708                if(V_flag==0)
709                        AppendtoGraph/W=$winNameStr iBin_qxqy_FLR vs qBin_qxqy_FLR
710                        AppendToGraph/W=$winNameStr iBin_qxqy_FTB vs qBin_qxqy_FTB
711                        ErrorBars/T=0 iBin_qxqy_FLR Y,wave=(:eBin_qxqy_FLR,:eBin_qxqy_FLR)
712                        ErrorBars/T=0 iBin_qxqy_FTB Y,wave=(:eBin_qxqy_FTB,:eBin_qxqy_FTB)
713
714                        ModifyGraph/W=$winNameStr mode=4
715                        ModifyGraph/W=$winNameStr marker=19
716                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FLR)=(39321,26208,1),rgb(iBin_qxqy_FTB)=(2,39321,1)
717                        ModifyGraph/W=$winNameStr msize=2
718                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_FLR)={0,2}
719                        ModifyGraph/W=$winNameStr grid=1
720                        ModifyGraph/W=$winNameStr log=1
721                        ModifyGraph/W=$winNameStr mirror=2
722//                      Label/W=$winNameStr left "Intensity (1/cm)"
723//                      Label/W=$winNameStr bottom "Q (1/A)"
724                endif   
725                       
726        endif
727       
728        if(binType==3)
729// clear EVERYTHING
730                ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr)
731               
732                ClearIQIfDisplayed_AllFldr("FLR",winNameStr)
733                ClearIQIfDisplayed_AllFldr("FTB",winNameStr)
734
735                ClearIQIfDisplayed_AllFldr("FT",winNameStr)     
736                ClearIQIfDisplayed_AllFldr("FL",winNameStr)     
737                ClearIQIfDisplayed_AllFldr("FR",winNameStr)     
738                ClearIQIfDisplayed_AllFldr("FB",winNameStr)     
739       
740//              ClearIQIfDisplayed_AllFldr("FLR")
741//              ClearIQIfDisplayed_AllFldr("FTB")       
742//              ClearIQIfDisplayed_AllFldr("FT")       
743//              ClearIQIfDisplayed_AllFldr("FL")       
744//              ClearIQIfDisplayed_AllFldr("FR")       
745//              ClearIQIfDisplayed_AllFldr("FB")       
746       
747                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
748                CheckDisplayed/W=$winNameStr iBin_qxqy_FLRTB
749               
750                if(V_flag==0)
751                        AppendtoGraph/W=$winNameStr iBin_qxqy_FLRTB vs qBin_qxqy_FLRTB
752                        ErrorBars/T=0 iBin_qxqy_FLRTB Y,wave=(:eBin_qxqy_FLRTB,:eBin_qxqy_FLRTB)
753
754                        ModifyGraph/W=$winNameStr mode=4
755                        ModifyGraph/W=$winNameStr marker=19
756                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FLRTB)=(39321,26208,1)
757                        ModifyGraph/W=$winNameStr msize=2
758                        ModifyGraph/W=$winNameStr grid=1
759                        ModifyGraph/W=$winNameStr log=1
760                        ModifyGraph/W=$winNameStr mirror=2
761                        Label/W=$winNameStr left "Intensity (1/cm)"
762                        Label/W=$winNameStr bottom "Q (1/A)"
763                endif   
764                       
765        endif
766
767        if(binType==4)          // slit aperture binning - MT, ML, MR, MB are averaged
768// clear EVERYTHING
769                ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr)
770               
771                ClearIQIfDisplayed_AllFldr("FLR",winNameStr)
772                ClearIQIfDisplayed_AllFldr("FTB",winNameStr)
773
774                ClearIQIfDisplayed_AllFldr("FT",winNameStr)     
775                ClearIQIfDisplayed_AllFldr("FL",winNameStr)     
776                ClearIQIfDisplayed_AllFldr("FR",winNameStr)     
777                ClearIQIfDisplayed_AllFldr("FB",winNameStr)     
778       
779       
780//              ClearIQIfDisplayed_AllFldr("FLRTB")
781//              ClearIQIfDisplayed_AllFldr("FLR")
782//              ClearIQIfDisplayed_AllFldr("FTB")
783               
784                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
785                CheckDisplayed/W=$winNameStr iBin_qxqy_FL
786               
787                if(V_flag==0)
788                        AppendtoGraph/W=$winNameStr iBin_qxqy_FL vs qBin_qxqy_FL
789                        AppendToGraph/W=$winNameStr iBin_qxqy_FR vs qBin_qxqy_FR
790                        AppendToGraph/W=$winNameStr iBin_qxqy_FT vs qBin_qxqy_FT
791                        AppendToGraph/W=$winNameStr iBin_qxqy_FB vs qBin_qxqy_FB
792                        ErrorBars/T=0 iBin_qxqy_FL Y,wave=(:eBin_qxqy_FL,:eBin_qxqy_FL)
793                        ErrorBars/T=0 iBin_qxqy_FR Y,wave=(:eBin_qxqy_FR,:eBin_qxqy_FR)
794                        ErrorBars/T=0 iBin_qxqy_FT Y,wave=(:eBin_qxqy_FT,:eBin_qxqy_FT)
795                        ErrorBars/T=0 iBin_qxqy_FB Y,wave=(:eBin_qxqy_FB,:eBin_qxqy_FB)
796                       
797                        ModifyGraph/W=$winNameStr mode=4
798                        ModifyGraph/W=$winNameStr marker=19
799                        ModifyGraph/W=$winNameStr 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)
800                        ModifyGraph/W=$winNameStr msize=2
801                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_FL)={0,4},muloffset(iBin_qxqy_FB)={0,2},muloffset(iBin_qxqy_FR)={0,8}
802                        ModifyGraph/W=$winNameStr grid=1
803                        ModifyGraph/W=$winNameStr log=1
804                        ModifyGraph/W=$winNameStr mirror=2
805                endif           
806                       
807        endif
808       
809        SetDataFolder root:
810End
811
812
813// TODO
814// x- need to set binType
815// x- currently  hard-wired == 1
816// x- error bars on the data
817//
818//      type = the data folder
819// binType = numerical index of the bin type (1->4)
820//  one;two;four;slit
821// winNameStr = the name of the target window
822//
823////////////to plot the back panel I(q)
824Proc V_Back_IQ_Graph(type,binType,winNameStr)
825        String type
826        Variable binType
827        String winNameStr
828       
829//      SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_B
830
831//      Variable binType
832
833//      binType = V_GetBinningPopMode()
834       
835
836        SetDataFolder $("root:Packages:NIST:VSANS:"+type)       
837
838        if(binType==1 || binType==2 || binType==3)
839       
840                ClearIQIfDisplayed_AllFldr("B",winNameStr)
841                SetDataFolder $("root:Packages:NIST:VSANS:"+type)       
842                CheckDisplayed/W=$winNameStr iBin_qxqy_B
843               
844                if(V_flag==0)
845                        AppendtoGraph/W=$winNameStr iBin_qxqy_B vs qBin_qxqy_B
846                        ErrorBars/T=0 iBin_qxqy_B Y,wave=(:eBin_qxqy_B,:eBin_qxqy_B)
847                        ModifyGraph/W=$winNameStr mode=4
848//                      ModifyGraph/W=$winNameStr marker=19
849                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_B)=(1,52428,52428)
850//                      ModifyGraph/W=$winNameStr msize=2
851                        ModifyGraph/W=$winNameStr grid=1
852                        ModifyGraph/W=$winNameStr log=1
853                        ModifyGraph/W=$winNameStr mirror=2
854                        ModifyGraph/W=$winNameStr msize(iBin_qxqy_B)=3,textMarker(iBin_qxqy_B)={"B","default",1,0,5,0.00,0.00}
855
856                endif
857               
858//              ClearIQIfDisplayed_AllFldr("B")
859//              SetDataFolder $("root:Packages:NIST:VSANS:"+type)       
860//              CheckDisplayed/W=V_1D_Data iBin_qxqy_B
861//             
862//              if(V_flag==0)
863//                      AppendtoGraph/W=V_1D_Data iBin_qxqy_B vs qBin_qxqy_B
864//                      ModifyGraph/W=V_1D_Data mode=4
865//                      ModifyGraph/W=V_1D_Data marker=19
866//                      ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_B)=(1,52428,52428)
867//                      ModifyGraph/W=V_1D_Data msize=2
868//                      ModifyGraph/W=V_1D_Data grid=1
869//                      ModifyGraph/W=V_1D_Data log=1
870//                      ModifyGraph/W=V_1D_Data mirror=2
871//              endif
872               
873        endif
874
875        //nothing different here since there is ony a single detector to display, but for the future...
876        if(binType==4)
877       
878                ClearIQIfDisplayed_AllFldr("B",winNameStr)
879                SetDataFolder $("root:Packages:NIST:VSANS:"+type)       
880                CheckDisplayed/W=$winNameStr iBin_qxqy_B
881               
882                if(V_flag==0)
883                        AppendtoGraph/W=$winNameStr iBin_qxqy_B vs qBin_qxqy_B
884                        ModifyGraph/W=$winNameStr mode=4
885                        ModifyGraph/W=$winNameStr marker=19
886                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_B)=(1,52428,52428)
887                        ModifyGraph/W=$winNameStr msize=2
888                        ModifyGraph/W=$winNameStr grid=1
889                        ModifyGraph/W=$winNameStr log=1
890                        ModifyGraph/W=$winNameStr mirror=2
891                endif
892        endif
893
894       
895        SetDataFolder root:
896End
897
Note: See TracBrowser for help on using the repository browser.