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

Last change on this file since 1031 was 1031, checked in by srkline, 6 years ago

changes for combining of 1D data sets

File size: 27.7 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(binType)
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= "One;Two;Four;Slit Mode;"
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        V_QBinAllPanels(workType,binType)
104
105// TODO:
106// x- "B" detector is currently skipped - Q is not yet calculated
107        String str,winStr="V_1D_Data"
108        sprintf str,"(\"%s\",%d,\"%s\")",workType,binType,winStr
109       
110        Execute ("V_Back_IQ_Graph"+str)
111//      Print "V_Back_IQ_Graph"+str
112        Execute ("V_Middle_IQ_Graph"+str)
113        Execute ("V_Front_IQ_Graph"+str)
114
115       
116End
117
118Function V_Plot1D_LogCheckProc(cba) : CheckBoxControl
119        STRUCT WMCheckboxAction &cba
120
121        switch( cba.eventCode )
122                case 2: // mouse up
123                        Variable checked = cba.checked
124                               
125                                ModifyGraph log=(checked)
126                       
127                        break
128                case -1: // control being killed
129                        break
130        endswitch
131
132        return 0
133End
134
135//
136////function to set the popItem (mode) of the graph, to re-create the graph based on user preferences
137//Function V_YMode_PopMenuProc(ctrlName,popNum,popStr) : PopupMenuControl
138//      String ctrlName
139//      Variable popNum
140//      String popStr
141//
142//      Variable/G root:Packages:NIST:VSANS:Globals:Plot_1d:gYMode=popNum
143//      V_Rescale_Plot_1D_ButtonProc("")
144//End
145//
146////function to set the popItem (mode) of the graph, to re-create the graph based on user preferences
147//Function V_XMode_PopMenuProc(ctrlName,popNum,popStr) : PopupMenuControl
148//      String ctrlName
149//      Variable popNum
150//      String popStr
151//
152//      Variable/G root:Packages:NIST:VSANS:Globals:Plot_1d:gXMode=popNum
153//      V_Rescale_Plot_1D_ButtonProc("")
154//End
155
156
157//function to rescale the axes of the graph as selected from the popups and the
158// entered values of the exponents
159//** assumes the current waves are unknown, so it goes and gets a "fresh" copy from
160//the data folder specified by the waves on the graph, which is the same folder that
161//contains the "fresh" copy of the 1D data
162//
163// for log(10) scaling, simply modify the axes, not the data - gives better plots
164//
165//Function V_Rescale_Plot_1D_ButtonProc(ctrlName) : ButtonControl
166//      String ctrlName
167//     
168//      DoWindow/F V_1D_Data
169////Scaling exponents and background value
170//      Variable pow_a,pow_b,pow_c
171//      ControlInfo expa
172//      pow_a = V_value
173//      ControlInfo expb
174//      pow_b = V_value
175//      ControlInfo expc
176//      pow_c = V_value
177//     
178////check for physical limits on exponent values, abort if bad values found
179//      if((pow_a < -2) || (pow_a > 10))
180//              Abort "Exponent a must be in the range (-2,10)"
181//      endif
182//      if((pow_b < 0) || (pow_b > 10))
183//              Abort "Exponent b must be in the range (0,10)"
184//      endif
185//      //if q^c is the x-scaling, c must be be within limits and also non-zero
186//      ControlInfo xModel
187//      If (cmpstr("q^c",S_Value) == 0)
188//              if(pow_c == 0)
189//                      Abort "Exponent c must be non-zero, q^0 = 1"
190//              endif
191//              if((pow_c < -10) || (pow_c > 10))
192//                      Abort "Exponent c must be in the range (-10,10)"
193//              endif
194//      endif           //check q^c exponent
195//     
196//// get the current experimental q, I, and std dev. waves
197//      SVAR curFolder=root:Packages:NIST:VSANS:Globals:gDataDisplayType
198//
199//// what is the binning? == what waves do we need to copy over
200//     
201//
202//      //get the untarnished data, so we can rescale it freshly here
203//      Wave yw = $("root:Packages:NIST:"+curFolder+":aveint")
204//      Wave ew = $("root:Packages:NIST:"+curFolder+":sigave")
205//      //get the correct x values
206//      NVAR isPhiAve= root:myGlobals:Plot_1d:isPhiAve  //0 signifies (normal) x=qvals
207//      if(isPhiAve)
208//              //x is angle
209//              Wave xw=$("root:Packages:NIST:"+curFolder+":phival")
210//      else
211//              //x is q-values
212//              Wave xw=$("root:Packages:NIST:"+curFolder+":qval")
213//      endif
214//      Wave yAxisWave=root:myGlobals:Plot_1d:yAxisWave         //refs to waves to be modified, hard-wired positions
215//      Wave xAxisWave=root:myGlobals:Plot_1d:xAxisWave
216//      Wave yErrWave=root:myGlobals:Plot_1d:yErrWave
217//     
218//      //variables set for each model to control look of graph
219//      String xlabel,ylabel,xstr,ystr
220//      Variable logLeft=0,logBottom=0
221//      //check for proper y-scaling selection, make the necessary waves
222//      ControlInfo yModel
223//      ystr = S_Value
224//      do
225//              If (cmpstr("I",S_Value) == 0)
226//                      SetScale d 0,0,"1/cm",yAxisWave
227//                      yErrWave = ew
228//                      yAxisWave = yw
229//                      ylabel = "I(q)"
230//                      break   
231//              endif
232//              If (cmpstr("ln(I)",S_Value) == 0)
233//                      SetScale d 0,0,"",yAxisWave
234//                      yErrWave = ew/yw
235//                      yAxisWave = ln(yw)
236//                      ylabel = "ln(I)"
237//                      break   
238//              endif
239//              If (cmpstr("log(I)",S_Value) == 0)
240//                      SetScale d 0,0,"",yAxisWave
241//                      yAxisWave = yw
242//                      yErrWave = ew
243//                      logLeft=1                               //scale the axis, not the wave
244//                      ylabel = "I(q)"
245////                    yErrWave = ew/(2.30*yw)
246////                    yAxisWave = log(yw)
247////                    ylabel = "log(I)"
248//                      break   
249//              endif
250//              If (cmpstr("1/I",S_Value) == 0)
251//                      SetScale d 0,0,"",yAxisWave
252//                      yErrWave = ew/yw^2
253//                      yAxisWave = 1/yw
254//                      ylabel = "1/I"
255//                      break
256//              endif
257//              If (cmpstr("I^a",S_Value) == 0)
258//                      SetScale d 0,0,"",yAxisWave
259//                      yErrWave = ew*abs(pow_a*(yw^(pow_a-1)))
260//                      yAxisWave = yw^pow_a
261//                      ylabel = "I^"+num2str(pow_a)
262//                      break
263//              endif
264//              If (cmpstr("Iq^a",S_Value) == 0)
265//                      SetScale d 0,0,"",yAxisWave
266//                      yErrWave = ew*xw^pow_a
267//                      yAxisWave = yw*xw^pow_a
268//                      ylabel = "I*q^"+num2str(pow_a)
269//                      break
270//              endif
271//              If (cmpstr("I^a q^b",S_Value) == 0)
272//                      SetScale d 0,0,"",yAxisWave
273//                      yErrWave = ew*abs(pow_a*(yw^(pow_a-1)))*xw^pow_b
274//                      yAxisWave = yw^pow_a*xw^pow_b
275//                      ylabel = "I^" + num2str(pow_a) + "q^"+num2str(pow_b)
276//                      break
277//              endif
278//              If (cmpstr("1/sqrt(I)",S_Value) == 0)
279//                      SetScale d 0,0,"",yAxisWave
280//                      yErrWave = 0.5*ew*yw^(-1.5)
281//                      yAxisWave = 1/sqrt(yw)
282//                      ylabel = "1/sqrt(I)"
283//                      break
284//              endif
285//              If (cmpstr("ln(Iq)",S_Value) == 0)
286//                      SetScale d 0,0,"",yAxisWave
287//                      yErrWave =ew/yw
288//                      yAxisWave = ln(xw*yw)
289//                      ylabel = "ln(q*I)"
290//                      break
291//              endif
292//              If (cmpstr("ln(Iq^2)",S_Value) == 0)
293//                      SetScale d 0,0,"",yAxisWave
294//                      yErrWave = ew/yw
295//                      yAxisWave = ln(xw*xw*yw)
296//                      ylabel = "ln(I*q^2)"
297//                      break
298//              endif
299//              //more ifs for each case as they are added
300//             
301//              // if selection not found, abort
302//              DoAlert 0,"Y-axis scaling incorrect. Aborting"
303//              Abort
304//      while(0)        //end of "case" statement for y-axis scaling
305//     
306//      //check for proper x-scaling selection
307//      SVAR/Z angst = root:Packages:NIST:gAngstStr
308//      String dum
309//     
310//      ControlInfo xModel
311//      xstr = S_Value
312//      do
313//              If (cmpstr("q",S_Value) == 0)   
314//                      SetScale d 0,0,"",xAxisWave
315//                      xAxisWave = xw
316//                      if(isPhiAve)
317//                              xlabel="Angle (deg)"
318//                      else
319//                              xlabel = "q ("+angst+"\\S-1\\M)"
320//                      endif
321//                      break   
322//              endif
323//              If (cmpstr("q^2",S_Value) == 0)
324//                      SetScale d 0,0,"",xAxisWave
325//                      xAxisWave = xw*xw
326//                      if(isPhiAve)
327//                              xlabel="(Angle (deg) )^2"
328//                      else
329//                              xlabel = "q^2 ("+angst+"\\S-2\\M)"
330//                      endif
331//                      break   
332//              endif
333//              If (cmpstr("log(q)",S_Value) == 0)     
334//                      SetScale d 0,0,"",xAxisWave
335//                      xAxisWave = xw          //scale the axis, not the wave
336//                      //xAxisWave = log(xw)
337//                      logBottom=1
338//                      if(isPhiAve)
339//                              //xlabel="log(Angle (deg))"
340//                              xlabel="Angle (deg)"
341//                      else
342//                              //xlabel = "log(q)"
343//                              xlabel = "q ("+angst+"\\S-1\\M)"
344//                      endif
345//                      break   
346//              endif
347//              If (cmpstr("q^c",S_Value) == 0)
348//                      SetScale d 0,0,"",xAxisWave
349//                      xAxisWave = xw^pow_c
350//                      dum = num2str(pow_c)
351//                      if(isPhiAve)
352//                              xlabel="Angle^"+dum
353//                      else
354//                              xlabel = "q^"+dum+" ("+angst+"\\S-"+dum+"\\M)"
355//                      endif
356//                      break
357//              endif
358//     
359//              //more ifs for each case
360//             
361//              // if selection not found, abort
362//              DoAlert 0,"X-axis scaling incorrect. Aborting"
363//              Abort
364//      while(0)        //end of "case" statement for x-axis scaling
365//     
366//      Label left ylabel
367//      Label bottom xlabel     //E denotes "scaling"  - may want to use "units" instead       
368//      ModifyGraph log(left)=(logLeft)
369//      ModifyGraph log(bottom)=(logBottom)
370//     
371//End
372
373
374//function to restore the graph axes to full scale, undoing any zooming
375Function V_AllQ_Plot_1D_ButtonProc(ctrlName) : ButtonControl
376        String ctrlName
377       
378        SetAxis/A
379End
380
381
382//
383// recalculate the I(q) binning. no need to adjust model function or views
384// just rebin
385//
386// see V_CombineModePopup() in V_Combine_1D.ipf for a duplicate verison of this function
387//
388Function V_BinningModePopup(ctrlName,popNum,popStr) : PopupMenuControl
389        String ctrlName
390        Variable popNum // which item is currently selected (1-based)
391        String popStr           // contents of current popup item as string
392
393        SVAR type = root:Packages:NIST:VSANS:Globals:gCurDispType
394
395        V_QBinAllPanels(type,popNum)
396
397        String str,winStr="V_1D_Data"
398        sprintf str,"(\"%s\",%d,\"%s\")",type,popNum,winStr
399
400        Execute ("V_Back_IQ_Graph"+str)
401        Execute ("V_Middle_IQ_Graph"+str)
402        Execute ("V_Front_IQ_Graph"+str)
403               
404//      Execute ("V_Back_IQ_Graph(\""+type+"\")")
405//      Execute ("V_Middle_IQ_Graph(\""+type+"\")")
406//      Execute ("V_Front_IQ_Graph(\""+type+"\")")
407       
408        return(0)       
409End
410
411Function V_GetBinningPopMode()
412
413        Variable binType
414       
415        if(WinType("V_1D_Data")==0)
416                DoAlert 0,"V_1D_Data window is not open, called from V_GetBinningPopMode()"
417                return(0)
418        endif
419       
420        ControlInfo/W=V_1D_Data popup0
421        strswitch(S_Value)      // string switch
422                case "One":
423                        binType = 1
424                        break           // exit from switch
425                case "Two":
426                        binType = 2
427                        break           // exit from switch
428                case "Four":
429                        binType = 3
430                        break           // exit from switch
431                case "Slit Mode":
432                        binType = 4
433                        break           // exit from switch
434
435                default:                        // optional default expression executed
436                        binType = 0
437                        Abort "Binning mode not found in V_GetBinningPopMode() "// when no case matches
438        endswitch
439       
440        return(binType)
441end
442
443//
444// duplicated from Middle_IQ_Graph from VCALC
445// but plotted in a standalone graph window and not the VCALC subwindow
446//
447// V_1D_Data
448//
449// TODO
450// x- need to set binType
451// x- currently  hard-wired == 1
452//
453// input "type" is the data type and defines the folder
454//
455Proc V_Middle_IQ_Graph(type,binType,winNameStr)
456        String type
457        Variable binType
458        String winNameStr
459
460//      binType = V_GetBinningPopMode()
461        SetDataFolder $("root:Packages:NIST:VSANS:"+type)
462
463// clear EVERYTHING
464//              ClearIQIfDisplayed_AllFldr("MLRTB")
465//              ClearIQIfDisplayed_AllFldr("MLR")
466//              ClearIQIfDisplayed_AllFldr("MTB")               //this returns to root:
467//              ClearIQIfDisplayed_AllFldr("MT")       
468//              ClearIQIfDisplayed_AllFldr("ML")       
469//              ClearIQIfDisplayed_AllFldr("MR")       
470//              ClearIQIfDisplayed_AllFldr("MB")       
471
472        if(binType==1)
473                ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr)
474                ClearIQIfDisplayed_AllFldr("MLR",winNameStr)
475                ClearIQIfDisplayed_AllFldr("MTB",winNameStr)            //this returns to root:
476                ClearIQIfDisplayed_AllFldr("MT",winNameStr)     
477                ClearIQIfDisplayed_AllFldr("ML",winNameStr)     
478                ClearIQIfDisplayed_AllFldr("MR",winNameStr)     
479                ClearIQIfDisplayed_AllFldr("MB",winNameStr)                     
480                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
481                CheckDisplayed/W=$winNameStr iBin_qxqy_ML
482               
483                if(V_flag==0)
484                        AppendtoGraph/W=$winNameStr iBin_qxqy_ML vs qBin_qxqy_ML
485                        AppendToGraph/W=$winNameStr iBin_qxqy_MR vs qBin_qxqy_MR
486                        AppendToGraph/W=$winNameStr iBin_qxqy_MT vs qBin_qxqy_MT
487                        AppendToGraph/W=$winNameStr iBin_qxqy_MB vs qBin_qxqy_MB
488                        ModifyGraph/W=$winNameStr mode=4
489                        ModifyGraph/W=$winNameStr marker=19
490                        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)
491                        ModifyGraph/W=$winNameStr msize=2
492                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MB)={0,2},muloffset(iBin_qxqy_MR)={0,8}
493                        ModifyGraph/W=$winNameStr grid=1
494                        ModifyGraph/W=$winNameStr log=1
495                        ModifyGraph/W=$winNameStr mirror=2
496                endif           
497        endif
498       
499        if(binType==2)
500// clear EVERYTHING
501                ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr)
502                ClearIQIfDisplayed_AllFldr("MLR",winNameStr)
503                ClearIQIfDisplayed_AllFldr("MTB",winNameStr)            //this returns to root:
504                ClearIQIfDisplayed_AllFldr("MT",winNameStr)     
505                ClearIQIfDisplayed_AllFldr("ML",winNameStr)     
506                ClearIQIfDisplayed_AllFldr("MR",winNameStr)     
507                ClearIQIfDisplayed_AllFldr("MB",winNameStr)             
508       
509//              ClearIQIfDisplayed_AllFldr("MLRTB")
510//              ClearIQIfDisplayed_AllFldr("MT")       
511//              ClearIQIfDisplayed_AllFldr("ML")       
512//              ClearIQIfDisplayed_AllFldr("MR")       
513//              ClearIQIfDisplayed_AllFldr("MB")
514       
515
516                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
517                CheckDisplayed/W=$winNameStr iBin_qxqy_MLR
518               
519                if(V_flag==0)
520                        AppendtoGraph/W=$winNameStr iBin_qxqy_MLR vs qBin_qxqy_MLR
521                        AppendToGraph/W=$winNameStr iBin_qxqy_MTB vs qBin_qxqy_MTB
522                        ModifyGraph/W=$winNameStr mode=4
523                        ModifyGraph/W=$winNameStr marker=19
524                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_MLR)=(65535,0,0),rgb(iBin_qxqy_MTB)=(1,16019,65535)
525                        ModifyGraph/W=$winNameStr msize=2
526                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_MLR)={0,2}
527                        ModifyGraph/W=$winNameStr grid=1
528                        ModifyGraph/W=$winNameStr log=1
529                        ModifyGraph/W=$winNameStr mirror=2
530                        Label/W=$winNameStr left "Intensity (1/cm)"
531                        Label/W=$winNameStr bottom "Q (1/A)"
532                endif   
533                       
534        endif
535       
536        if(binType==3)
537// clear EVERYTHING
538                ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr)
539                ClearIQIfDisplayed_AllFldr("MLR",winNameStr)
540                ClearIQIfDisplayed_AllFldr("MTB",winNameStr)            //this returns to root:
541                ClearIQIfDisplayed_AllFldr("MT",winNameStr)     
542                ClearIQIfDisplayed_AllFldr("ML",winNameStr)     
543                ClearIQIfDisplayed_AllFldr("MR",winNameStr)     
544                ClearIQIfDisplayed_AllFldr("MB",winNameStr)             
545       
546//              ClearIQIfDisplayed_AllFldr("MLR")
547//              ClearIQIfDisplayed_AllFldr("MTB")       
548//              ClearIQIfDisplayed_AllFldr("MT")       
549//              ClearIQIfDisplayed_AllFldr("ML")       
550//              ClearIQIfDisplayed_AllFldr("MR")       
551//              ClearIQIfDisplayed_AllFldr("MB")       
552       
553                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
554                CheckDisplayed/W=$winNameStr iBin_qxqy_MLRTB
555               
556                if(V_flag==0)
557                        AppendtoGraph/W=$winNameStr iBin_qxqy_MLRTB vs qBin_qxqy_MLRTB
558                        ModifyGraph/W=$winNameStr mode=4
559                        ModifyGraph/W=$winNameStr marker=19
560                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_MLRTB)=(65535,0,0)
561                        ModifyGraph/W=$winNameStr msize=2
562                        ModifyGraph/W=$winNameStr grid=1
563                        ModifyGraph/W=$winNameStr log=1
564                        ModifyGraph/W=$winNameStr mirror=2
565                        Label/W=$winNameStr left "Intensity (1/cm)"
566                        Label/W=$winNameStr bottom "Q (1/A)"
567                endif   
568                       
569        endif
570
571        if(binType==4)          // slit aperture binning - MT, ML, MR, MB are averaged
572// clear EVERYTHING
573                ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr)
574                ClearIQIfDisplayed_AllFldr("MLR",winNameStr)
575                ClearIQIfDisplayed_AllFldr("MTB",winNameStr)            //this returns to root:
576                ClearIQIfDisplayed_AllFldr("MT",winNameStr)     
577                ClearIQIfDisplayed_AllFldr("ML",winNameStr)     
578                ClearIQIfDisplayed_AllFldr("MR",winNameStr)     
579                ClearIQIfDisplayed_AllFldr("MB",winNameStr)             
580       
581       
582//              ClearIQIfDisplayed_AllFldr("MLRTB")
583//              ClearIQIfDisplayed_AllFldr("MLR")
584//              ClearIQIfDisplayed_AllFldr("MTB")
585               
586                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
587                CheckDisplayed/W=$winNameStr iBin_qxqy_ML
588               
589                if(V_flag==0)
590                        AppendToGraph/W=$winNameStr iBin_qxqy_ML vs qBin_qxqy_ML
591                        AppendToGraph/W=$winNameStr iBin_qxqy_MR vs qBin_qxqy_MR
592                        AppendToGraph/W=$winNameStr iBin_qxqy_MT vs qBin_qxqy_MT
593                        AppendToGraph/W=$winNameStr iBin_qxqy_MB vs qBin_qxqy_MB
594                        ModifyGraph/W=$winNameStr mode=4
595                        ModifyGraph/W=$winNameStr marker=19
596                        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)
597                        ModifyGraph/W=$winNameStr msize=2
598                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MB)={0,2},muloffset(iBin_qxqy_MR)={0,8}
599                        ModifyGraph/W=$winNameStr grid=1
600                        ModifyGraph/W=$winNameStr log=1
601                        ModifyGraph/W=$winNameStr mirror=2
602                endif           
603                       
604        endif
605       
606        SetDataFolder root:
607End
608
609//
610// duplicated from Middle_IQ_Graph from VCALC
611// but plotted in a standalone graph window and not the VCALC subwindow
612//
613// V_1D_Data
614//
615// TODO
616// x- need to set binType
617// x- currently  hard-wired == 1
618//
619//
620Proc V_Front_IQ_Graph(type,binType,winNameStr)
621        String type
622        Variable binType
623        String winNameStr
624
625
626//      binType = V_GetBinningPopMode()
627        SetDataFolder $("root:Packages:NIST:VSANS:"+type)
628
629// clear EVERYTHING
630//              ClearIQIfDisplayed_AllFldr("FLRTB")
631//             
632//              ClearIQIfDisplayed_AllFldr("FLR")
633//              ClearIQIfDisplayed_AllFldr("FTB")
634//
635//              ClearIQIfDisplayed_AllFldr("FT")       
636//              ClearIQIfDisplayed_AllFldr("FL")       
637//              ClearIQIfDisplayed_AllFldr("FR")       
638//              ClearIQIfDisplayed_AllFldr("FB")
639               
640        if(binType==1)
641                ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr)
642               
643                ClearIQIfDisplayed_AllFldr("FLR",winNameStr)
644                ClearIQIfDisplayed_AllFldr("FTB",winNameStr)
645
646                ClearIQIfDisplayed_AllFldr("FT",winNameStr)     
647                ClearIQIfDisplayed_AllFldr("FL",winNameStr)     
648                ClearIQIfDisplayed_AllFldr("FR",winNameStr)     
649                ClearIQIfDisplayed_AllFldr("FB",winNameStr)
650                               
651                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
652                CheckDisplayed/W=$winNameStr iBin_qxqy_FL
653               
654                if(V_flag==0)
655                        AppendtoGraph/W=$winNameStr iBin_qxqy_FL vs qBin_qxqy_FL
656                        AppendToGraph/W=$winNameStr iBin_qxqy_FR vs qBin_qxqy_FR
657                        AppendToGraph/W=$winNameStr iBin_qxqy_FT vs qBin_qxqy_FT
658                        AppendToGraph/W=$winNameStr iBin_qxqy_FB vs qBin_qxqy_FB
659                        ModifyGraph/W=$winNameStr mode=4
660                        ModifyGraph/W=$winNameStr marker=19
661                        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)
662                        ModifyGraph/W=$winNameStr msize=2
663                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_FL)={0,4},muloffset(iBin_qxqy_FB)={0,2},muloffset(iBin_qxqy_FR)={0,8}
664                        ModifyGraph/W=$winNameStr grid=1
665                        ModifyGraph/W=$winNameStr log=1
666                        ModifyGraph/W=$winNameStr mirror=2
667                endif           
668        endif
669       
670        if(binType==2)
671        // clear EVERYTHING
672                ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr)
673               
674                ClearIQIfDisplayed_AllFldr("FLR",winNameStr)
675                ClearIQIfDisplayed_AllFldr("FTB",winNameStr)
676
677                ClearIQIfDisplayed_AllFldr("FT",winNameStr)     
678                ClearIQIfDisplayed_AllFldr("FL",winNameStr)     
679                ClearIQIfDisplayed_AllFldr("FR",winNameStr)     
680                ClearIQIfDisplayed_AllFldr("FB",winNameStr)
681//              ClearIQIfDisplayed_AllFldr("FLRTB")
682//              ClearIQIfDisplayed_AllFldr("FT")       
683//              ClearIQIfDisplayed_AllFldr("FL")       
684//              ClearIQIfDisplayed_AllFldr("FR")       
685//              ClearIQIfDisplayed_AllFldr("FB")       
686
687                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
688                CheckDisplayed/W=$winNameStr iBin_qxqy_FLR
689               
690                if(V_flag==0)
691                        AppendtoGraph/W=$winNameStr iBin_qxqy_FLR vs qBin_qxqy_FLR
692                        AppendToGraph/W=$winNameStr iBin_qxqy_FTB vs qBin_qxqy_FTB
693                        ModifyGraph/W=$winNameStr mode=4
694                        ModifyGraph/W=$winNameStr marker=19
695                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FLR)=(39321,26208,1),rgb(iBin_qxqy_FTB)=(2,39321,1)
696                        ModifyGraph/W=$winNameStr msize=2
697                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_FLR)={0,2}
698                        ModifyGraph/W=$winNameStr grid=1
699                        ModifyGraph/W=$winNameStr log=1
700                        ModifyGraph/W=$winNameStr mirror=2
701                        Label/W=$winNameStr left "Intensity (1/cm)"
702                        Label/W=$winNameStr bottom "Q (1/A)"
703                endif   
704                       
705        endif
706       
707        if(binType==3)
708// clear EVERYTHING
709                ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr)
710               
711                ClearIQIfDisplayed_AllFldr("FLR",winNameStr)
712                ClearIQIfDisplayed_AllFldr("FTB",winNameStr)
713
714                ClearIQIfDisplayed_AllFldr("FT",winNameStr)     
715                ClearIQIfDisplayed_AllFldr("FL",winNameStr)     
716                ClearIQIfDisplayed_AllFldr("FR",winNameStr)     
717                ClearIQIfDisplayed_AllFldr("FB",winNameStr)     
718       
719//              ClearIQIfDisplayed_AllFldr("FLR")
720//              ClearIQIfDisplayed_AllFldr("FTB")       
721//              ClearIQIfDisplayed_AllFldr("FT")       
722//              ClearIQIfDisplayed_AllFldr("FL")       
723//              ClearIQIfDisplayed_AllFldr("FR")       
724//              ClearIQIfDisplayed_AllFldr("FB")       
725       
726                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
727                CheckDisplayed/W=$winNameStr iBin_qxqy_FLRTB
728               
729                if(V_flag==0)
730                        AppendtoGraph/W=$winNameStr iBin_qxqy_FLRTB vs qBin_qxqy_FLRTB
731                        ModifyGraph/W=$winNameStr mode=4
732                        ModifyGraph/W=$winNameStr marker=19
733                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FLRTB)=(39321,26208,1)
734                        ModifyGraph/W=$winNameStr msize=2
735                        ModifyGraph/W=$winNameStr grid=1
736                        ModifyGraph/W=$winNameStr log=1
737                        ModifyGraph/W=$winNameStr mirror=2
738                        Label/W=$winNameStr left "Intensity (1/cm)"
739                        Label/W=$winNameStr bottom "Q (1/A)"
740                endif   
741                       
742        endif
743
744        if(binType==4)          // slit aperture binning - MT, ML, MR, MB are averaged
745// clear EVERYTHING
746                ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr)
747               
748                ClearIQIfDisplayed_AllFldr("FLR",winNameStr)
749                ClearIQIfDisplayed_AllFldr("FTB",winNameStr)
750
751                ClearIQIfDisplayed_AllFldr("FT",winNameStr)     
752                ClearIQIfDisplayed_AllFldr("FL",winNameStr)     
753                ClearIQIfDisplayed_AllFldr("FR",winNameStr)     
754                ClearIQIfDisplayed_AllFldr("FB",winNameStr)     
755       
756       
757//              ClearIQIfDisplayed_AllFldr("FLRTB")
758//              ClearIQIfDisplayed_AllFldr("FLR")
759//              ClearIQIfDisplayed_AllFldr("FTB")
760               
761                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
762                CheckDisplayed/W=$winNameStr iBin_qxqy_FL
763               
764                if(V_flag==0)
765                        AppendtoGraph/W=$winNameStr iBin_qxqy_FL vs qBin_qxqy_FL
766                        AppendToGraph/W=$winNameStr iBin_qxqy_FR vs qBin_qxqy_FR
767                        AppendToGraph/W=$winNameStr iBin_qxqy_FT vs qBin_qxqy_FT
768                        AppendToGraph/W=$winNameStr iBin_qxqy_FB vs qBin_qxqy_FB
769                        ModifyGraph/W=$winNameStr mode=4
770                        ModifyGraph/W=$winNameStr marker=19
771                        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)
772                        ModifyGraph/W=$winNameStr msize=2
773                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_FL)={0,4},muloffset(iBin_qxqy_FB)={0,2},muloffset(iBin_qxqy_FR)={0,8}
774                        ModifyGraph/W=$winNameStr grid=1
775                        ModifyGraph/W=$winNameStr log=1
776                        ModifyGraph/W=$winNameStr mirror=2
777                endif           
778                       
779        endif
780       
781        SetDataFolder root:
782End
783
784
785// TODO
786// x- need to set binType
787// x- currently  hard-wired == 1
788//
789//
790//      type = the data folder
791// binType = numerical index of the bin type (1->4)
792//  one;two;four;slit
793// winNameStr = the name of the target window
794//
795////////////to plot the back panel I(q)
796Proc V_Back_IQ_Graph(type,binType,winNameStr)
797        String type
798        Variable binType
799        String winNameStr
800       
801//      SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_B
802
803//      Variable binType
804
805//      binType = V_GetBinningPopMode()
806       
807
808        SetDataFolder $("root:Packages:NIST:VSANS:"+type)       
809
810        if(binType==1 || binType==2 || binType==3)
811       
812                ClearIQIfDisplayed_AllFldr("B",winNameStr)
813                SetDataFolder $("root:Packages:NIST:VSANS:"+type)       
814                CheckDisplayed/W=$winNameStr iBin_qxqy_B
815               
816                if(V_flag==0)
817                        AppendtoGraph/W=$winNameStr iBin_qxqy_B vs qBin_qxqy_B
818                        ModifyGraph/W=$winNameStr mode=4
819                        ModifyGraph/W=$winNameStr marker=19
820                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_B)=(1,52428,52428)
821                        ModifyGraph/W=$winNameStr msize=2
822                        ModifyGraph/W=$winNameStr grid=1
823                        ModifyGraph/W=$winNameStr log=1
824                        ModifyGraph/W=$winNameStr mirror=2
825                endif
826               
827//              ClearIQIfDisplayed_AllFldr("B")
828//              SetDataFolder $("root:Packages:NIST:VSANS:"+type)       
829//              CheckDisplayed/W=V_1D_Data iBin_qxqy_B
830//             
831//              if(V_flag==0)
832//                      AppendtoGraph/W=V_1D_Data iBin_qxqy_B vs qBin_qxqy_B
833//                      ModifyGraph/W=V_1D_Data mode=4
834//                      ModifyGraph/W=V_1D_Data marker=19
835//                      ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_B)=(1,52428,52428)
836//                      ModifyGraph/W=V_1D_Data msize=2
837//                      ModifyGraph/W=V_1D_Data grid=1
838//                      ModifyGraph/W=V_1D_Data log=1
839//                      ModifyGraph/W=V_1D_Data mirror=2
840//              endif
841               
842        endif
843
844        //nothing different here since there is ony a single detector to display, but for the future...
845        if(binType==4)
846       
847                ClearIQIfDisplayed_AllFldr("B",winNameStr)
848                SetDataFolder $("root:Packages:NIST:VSANS:"+type)       
849                CheckDisplayed/W=$winNameStr iBin_qxqy_B
850               
851                if(V_flag==0)
852                        AppendtoGraph/W=$winNameStr iBin_qxqy_B vs qBin_qxqy_B
853                        ModifyGraph/W=$winNameStr mode=4
854                        ModifyGraph/W=$winNameStr marker=19
855                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_B)=(1,52428,52428)
856                        ModifyGraph/W=$winNameStr msize=2
857                        ModifyGraph/W=$winNameStr grid=1
858                        ModifyGraph/W=$winNameStr log=1
859                        ModifyGraph/W=$winNameStr mirror=2
860                endif
861        endif
862
863       
864        SetDataFolder root:
865End
866
Note: See TracBrowser for help on using the repository browser.