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

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

adding to the functionality of the data reduction protocol

getting the 1D plotting to work both as a standalone plot and part of the reduction protocol (where the choices are all made and fed in)

added log/lin toggle to 1D display. abc exponent scaling is fundamentally more messy, and has been shelved for now. Revisit if demand is there.

fixed bug in how raw data files are identified, to prevent .abs files from being incorrectly identified as raw (if same name before extension). Works correctly now, but may need tweak in future if naming scheme changes.

File size: 25.4 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
108        sprintf str,"(\"%s\",%d)",workType,binType
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//
386Function V_BinningModePopup(ctrlName,popNum,popStr) : PopupMenuControl
387        String ctrlName
388        Variable popNum // which item is currently selected (1-based)
389        String popStr           // contents of current popup item as string
390
391        SVAR type = root:Packages:NIST:VSANS:Globals:gCurDispType
392
393        V_QBinAllPanels(type,popNum)
394
395        String str
396        sprintf str,"(\"%s\",%d)",Type,popNum
397
398        Execute ("V_Back_IQ_Graph"+str)
399        Execute ("V_Middle_IQ_Graph"+str)
400        Execute ("V_Front_IQ_Graph"+str)
401               
402//      Execute ("V_Back_IQ_Graph(\""+type+"\")")
403//      Execute ("V_Middle_IQ_Graph(\""+type+"\")")
404//      Execute ("V_Front_IQ_Graph(\""+type+"\")")
405       
406        return(0)       
407End
408
409Function V_GetBinningPopMode()
410
411        Variable binType
412       
413        if(WinType("V_1D_Data")==0)
414                DoAlert 0,"V_1D_Data window is not open, called from V_GetBinningPopMode()"
415                return(0)
416        endif
417       
418        ControlInfo/W=V_1D_Data popup0
419        strswitch(S_Value)      // string switch
420                case "One":
421                        binType = 1
422                        break           // exit from switch
423                case "Two":
424                        binType = 2
425                        break           // exit from switch
426                case "Four":
427                        binType = 3
428                        break           // exit from switch
429                case "Slit Mode":
430                        binType = 4
431                        break           // exit from switch
432
433                default:                        // optional default expression executed
434                        binType = 0
435                        Abort "Binning mode not found in V_GetBinningPopMode() "// when no case matches
436        endswitch
437       
438        return(binType)
439end
440
441//
442// duplicated from Middle_IQ_Graph from VCALC
443// but plotted in a standalone graph window and not the VCALC subwindow
444//
445// V_1D_Data
446//
447// TODO
448// x- need to set binType
449// x- currently  hard-wired == 1
450//
451// input "type" is the data type and defines the folder
452//
453Proc V_Middle_IQ_Graph(type,binType)
454        String type
455        Variable binType
456
457//      binType = V_GetBinningPopMode()
458        SetDataFolder $("root:Packages:NIST:VSANS:"+type)
459
460// clear EVERYTHING
461//              ClearAllIQIfDisplayed("MLRTB")
462//              ClearAllIQIfDisplayed("MLR")
463//              ClearAllIQIfDisplayed("MTB")            //this returns to root:
464//              ClearAllIQIfDisplayed("MT")     
465//              ClearAllIQIfDisplayed("ML")     
466//              ClearAllIQIfDisplayed("MR")     
467//              ClearAllIQIfDisplayed("MB")     
468
469        if(binType==1)
470                ClearAllIQIfDisplayed("MLRTB")
471                ClearAllIQIfDisplayed("MLR")
472                ClearAllIQIfDisplayed("MTB")            //this returns to root:
473                ClearAllIQIfDisplayed("MT")     
474                ClearAllIQIfDisplayed("ML")     
475                ClearAllIQIfDisplayed("MR")     
476                ClearAllIQIfDisplayed("MB")                     
477                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
478                CheckDisplayed/W=V_1D_Data iBin_qxqy_ML
479               
480                if(V_flag==0)
481                        AppendtoGraph/W=V_1D_Data iBin_qxqy_ML vs qBin_qxqy_ML
482                        AppendToGraph/W=V_1D_Data iBin_qxqy_MR vs qBin_qxqy_MR
483                        AppendToGraph/W=V_1D_Data iBin_qxqy_MT vs qBin_qxqy_MT
484                        AppendToGraph/W=V_1D_Data iBin_qxqy_MB vs qBin_qxqy_MB
485                        ModifyGraph/W=V_1D_Data mode=4
486                        ModifyGraph/W=V_1D_Data marker=19
487                        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)
488                        ModifyGraph/W=V_1D_Data msize=2
489                        ModifyGraph/W=V_1D_Data muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MB)={0,2},muloffset(iBin_qxqy_MR)={0,8}
490                        ModifyGraph/W=V_1D_Data grid=1
491                        ModifyGraph/W=V_1D_Data log=1
492                        ModifyGraph/W=V_1D_Data mirror=2
493                endif           
494        endif
495       
496        if(binType==2)
497// clear EVERYTHING
498                ClearAllIQIfDisplayed("MLRTB")
499                ClearAllIQIfDisplayed("MLR")
500                ClearAllIQIfDisplayed("MTB")            //this returns to root:
501                ClearAllIQIfDisplayed("MT")     
502                ClearAllIQIfDisplayed("ML")     
503                ClearAllIQIfDisplayed("MR")     
504                ClearAllIQIfDisplayed("MB")             
505       
506//              ClearAllIQIfDisplayed("MLRTB")
507//              ClearAllIQIfDisplayed("MT")     
508//              ClearAllIQIfDisplayed("ML")     
509//              ClearAllIQIfDisplayed("MR")     
510//              ClearAllIQIfDisplayed("MB")
511       
512
513                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
514                CheckDisplayed/W=V_1D_Data iBin_qxqy_MLR
515               
516                if(V_flag==0)
517                        AppendtoGraph/W=V_1D_Data iBin_qxqy_MLR vs qBin_qxqy_MLR
518                        AppendToGraph/W=V_1D_Data iBin_qxqy_MTB vs qBin_qxqy_MTB
519                        ModifyGraph/W=V_1D_Data mode=4
520                        ModifyGraph/W=V_1D_Data marker=19
521                        ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_MLR)=(65535,0,0),rgb(iBin_qxqy_MTB)=(1,16019,65535)
522                        ModifyGraph/W=V_1D_Data msize=2
523                        ModifyGraph/W=V_1D_Data muloffset(iBin_qxqy_MLR)={0,2}
524                        ModifyGraph/W=V_1D_Data grid=1
525                        ModifyGraph/W=V_1D_Data log=1
526                        ModifyGraph/W=V_1D_Data mirror=2
527                        Label/W=V_1D_Data left "Intensity (1/cm)"
528                        Label/W=V_1D_Data bottom "Q (1/A)"
529                endif   
530                       
531        endif
532       
533        if(binType==3)
534// clear EVERYTHING
535                ClearAllIQIfDisplayed("MLRTB")
536                ClearAllIQIfDisplayed("MLR")
537                ClearAllIQIfDisplayed("MTB")            //this returns to root:
538                ClearAllIQIfDisplayed("MT")     
539                ClearAllIQIfDisplayed("ML")     
540                ClearAllIQIfDisplayed("MR")     
541                ClearAllIQIfDisplayed("MB")             
542       
543//              ClearAllIQIfDisplayed("MLR")
544//              ClearAllIQIfDisplayed("MTB")   
545//              ClearAllIQIfDisplayed("MT")     
546//              ClearAllIQIfDisplayed("ML")     
547//              ClearAllIQIfDisplayed("MR")     
548//              ClearAllIQIfDisplayed("MB")     
549       
550                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
551                CheckDisplayed/W=V_1D_Data iBin_qxqy_MLRTB
552               
553                if(V_flag==0)
554                        AppendtoGraph/W=V_1D_Data iBin_qxqy_MLRTB vs qBin_qxqy_MLRTB
555                        ModifyGraph/W=V_1D_Data mode=4
556                        ModifyGraph/W=V_1D_Data marker=19
557                        ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_MLRTB)=(65535,0,0)
558                        ModifyGraph/W=V_1D_Data msize=2
559                        ModifyGraph/W=V_1D_Data grid=1
560                        ModifyGraph/W=V_1D_Data log=1
561                        ModifyGraph/W=V_1D_Data mirror=2
562                        Label/W=V_1D_Data left "Intensity (1/cm)"
563                        Label/W=V_1D_Data bottom "Q (1/A)"
564                endif   
565                       
566        endif
567
568        if(binType==4)          // slit aperture binning - MT, ML, MR, MB are averaged
569// clear EVERYTHING
570                ClearAllIQIfDisplayed("MLRTB")
571                ClearAllIQIfDisplayed("MLR")
572                ClearAllIQIfDisplayed("MTB")            //this returns to root:
573                ClearAllIQIfDisplayed("MT")     
574                ClearAllIQIfDisplayed("ML")     
575                ClearAllIQIfDisplayed("MR")     
576                ClearAllIQIfDisplayed("MB")             
577       
578       
579//              ClearAllIQIfDisplayed("MLRTB")
580//              ClearAllIQIfDisplayed("MLR")
581//              ClearAllIQIfDisplayed("MTB")
582               
583                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
584                CheckDisplayed/W=V_1D_Data iBin_qxqy_ML
585               
586                if(V_flag==0)
587                        AppendToGraph/W=V_1D_Data iBin_qxqy_ML vs qBin_qxqy_ML
588                        AppendToGraph/W=V_1D_Data iBin_qxqy_MR vs qBin_qxqy_MR
589                        AppendToGraph/W=V_1D_Data iBin_qxqy_MT vs qBin_qxqy_MT
590                        AppendToGraph/W=V_1D_Data iBin_qxqy_MB vs qBin_qxqy_MB
591                        ModifyGraph/W=V_1D_Data mode=4
592                        ModifyGraph/W=V_1D_Data marker=19
593                        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)
594                        ModifyGraph/W=V_1D_Data msize=2
595                        ModifyGraph/W=V_1D_Data muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MB)={0,2},muloffset(iBin_qxqy_MR)={0,8}
596                        ModifyGraph/W=V_1D_Data grid=1
597                        ModifyGraph/W=V_1D_Data log=1
598                        ModifyGraph/W=V_1D_Data mirror=2
599                endif           
600                       
601        endif
602       
603        SetDataFolder root:
604End
605
606//
607// duplicated from Middle_IQ_Graph from VCALC
608// but plotted in a standalone graph window and not the VCALC subwindow
609//
610// V_1D_Data
611//
612// TODO
613// x- need to set binType
614// x- currently  hard-wired == 1
615//
616//
617Proc V_Front_IQ_Graph(type,binType)
618        String type
619        Variable binType
620
621
622//      binType = V_GetBinningPopMode()
623        SetDataFolder $("root:Packages:NIST:VSANS:"+type)
624
625// clear EVERYTHING
626//              ClearAllIQIfDisplayed("FLRTB")
627//             
628//              ClearAllIQIfDisplayed("FLR")
629//              ClearAllIQIfDisplayed("FTB")
630//
631//              ClearAllIQIfDisplayed("FT")     
632//              ClearAllIQIfDisplayed("FL")     
633//              ClearAllIQIfDisplayed("FR")     
634//              ClearAllIQIfDisplayed("FB")
635               
636        if(binType==1)
637                ClearAllIQIfDisplayed("FLRTB")
638               
639                ClearAllIQIfDisplayed("FLR")
640                ClearAllIQIfDisplayed("FTB")
641
642                ClearAllIQIfDisplayed("FT")     
643                ClearAllIQIfDisplayed("FL")     
644                ClearAllIQIfDisplayed("FR")     
645                ClearAllIQIfDisplayed("FB")
646                               
647                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
648                CheckDisplayed/W=V_1D_Data iBin_qxqy_FL
649               
650                if(V_flag==0)
651                        AppendtoGraph/W=V_1D_Data iBin_qxqy_FL vs qBin_qxqy_FL
652                        AppendToGraph/W=V_1D_Data iBin_qxqy_FR vs qBin_qxqy_FR
653                        AppendToGraph/W=V_1D_Data iBin_qxqy_FT vs qBin_qxqy_FT
654                        AppendToGraph/W=V_1D_Data iBin_qxqy_FB vs qBin_qxqy_FB
655                        ModifyGraph/W=V_1D_Data mode=4
656                        ModifyGraph/W=V_1D_Data marker=19
657                        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)
658                        ModifyGraph/W=V_1D_Data msize=2
659                        ModifyGraph/W=V_1D_Data muloffset(iBin_qxqy_FL)={0,4},muloffset(iBin_qxqy_FB)={0,2},muloffset(iBin_qxqy_FR)={0,8}
660                        ModifyGraph/W=V_1D_Data grid=1
661                        ModifyGraph/W=V_1D_Data log=1
662                        ModifyGraph/W=V_1D_Data mirror=2
663                endif           
664        endif
665       
666        if(binType==2)
667        // clear EVERYTHING
668                ClearAllIQIfDisplayed("FLRTB")
669               
670                ClearAllIQIfDisplayed("FLR")
671                ClearAllIQIfDisplayed("FTB")
672
673                ClearAllIQIfDisplayed("FT")     
674                ClearAllIQIfDisplayed("FL")     
675                ClearAllIQIfDisplayed("FR")     
676                ClearAllIQIfDisplayed("FB")
677//              ClearAllIQIfDisplayed("FLRTB")
678//              ClearAllIQIfDisplayed("FT")     
679//              ClearAllIQIfDisplayed("FL")     
680//              ClearAllIQIfDisplayed("FR")     
681//              ClearAllIQIfDisplayed("FB")     
682
683                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
684                CheckDisplayed/W=V_1D_Data iBin_qxqy_FLR
685               
686                if(V_flag==0)
687                        AppendtoGraph/W=V_1D_Data iBin_qxqy_FLR vs qBin_qxqy_FLR
688                        AppendToGraph/W=V_1D_Data iBin_qxqy_FTB vs qBin_qxqy_FTB
689                        ModifyGraph/W=V_1D_Data mode=4
690                        ModifyGraph/W=V_1D_Data marker=19
691                        ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_FLR)=(39321,26208,1),rgb(iBin_qxqy_FTB)=(2,39321,1)
692                        ModifyGraph/W=V_1D_Data msize=2
693                        ModifyGraph/W=V_1D_Data muloffset(iBin_qxqy_FLR)={0,2}
694                        ModifyGraph/W=V_1D_Data grid=1
695                        ModifyGraph/W=V_1D_Data log=1
696                        ModifyGraph/W=V_1D_Data mirror=2
697                        Label/W=V_1D_Data left "Intensity (1/cm)"
698                        Label/W=V_1D_Data bottom "Q (1/A)"
699                endif   
700                       
701        endif
702       
703        if(binType==3)
704// clear EVERYTHING
705                ClearAllIQIfDisplayed("FLRTB")
706               
707                ClearAllIQIfDisplayed("FLR")
708                ClearAllIQIfDisplayed("FTB")
709
710                ClearAllIQIfDisplayed("FT")     
711                ClearAllIQIfDisplayed("FL")     
712                ClearAllIQIfDisplayed("FR")     
713                ClearAllIQIfDisplayed("FB")     
714       
715//              ClearAllIQIfDisplayed("FLR")
716//              ClearAllIQIfDisplayed("FTB")   
717//              ClearAllIQIfDisplayed("FT")     
718//              ClearAllIQIfDisplayed("FL")     
719//              ClearAllIQIfDisplayed("FR")     
720//              ClearAllIQIfDisplayed("FB")     
721       
722                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
723                CheckDisplayed/W=V_1D_Data iBin_qxqy_FLRTB
724               
725                if(V_flag==0)
726                        AppendtoGraph/W=V_1D_Data iBin_qxqy_FLRTB vs qBin_qxqy_FLRTB
727                        ModifyGraph/W=V_1D_Data mode=4
728                        ModifyGraph/W=V_1D_Data marker=19
729                        ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_FLRTB)=(39321,26208,1)
730                        ModifyGraph/W=V_1D_Data msize=2
731                        ModifyGraph/W=V_1D_Data grid=1
732                        ModifyGraph/W=V_1D_Data log=1
733                        ModifyGraph/W=V_1D_Data mirror=2
734                        Label/W=V_1D_Data left "Intensity (1/cm)"
735                        Label/W=V_1D_Data bottom "Q (1/A)"
736                endif   
737                       
738        endif
739
740        if(binType==4)          // slit aperture binning - MT, ML, MR, MB are averaged
741// clear EVERYTHING
742                ClearAllIQIfDisplayed("FLRTB")
743               
744                ClearAllIQIfDisplayed("FLR")
745                ClearAllIQIfDisplayed("FTB")
746
747                ClearAllIQIfDisplayed("FT")     
748                ClearAllIQIfDisplayed("FL")     
749                ClearAllIQIfDisplayed("FR")     
750                ClearAllIQIfDisplayed("FB")     
751       
752       
753//              ClearAllIQIfDisplayed("FLRTB")
754//              ClearAllIQIfDisplayed("FLR")
755//              ClearAllIQIfDisplayed("FTB")
756               
757                SetDataFolder $("root:Packages:NIST:VSANS:"+type)
758                CheckDisplayed/W=V_1D_Data iBin_qxqy_FL
759               
760                if(V_flag==0)
761                        AppendtoGraph/W=V_1D_Data iBin_qxqy_FL vs qBin_qxqy_FL
762                        AppendToGraph/W=V_1D_Data iBin_qxqy_FR vs qBin_qxqy_FR
763                        AppendToGraph/W=V_1D_Data iBin_qxqy_FT vs qBin_qxqy_FT
764                        AppendToGraph/W=V_1D_Data iBin_qxqy_FB vs qBin_qxqy_FB
765                        ModifyGraph/W=V_1D_Data mode=4
766                        ModifyGraph/W=V_1D_Data marker=19
767                        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)
768                        ModifyGraph/W=V_1D_Data msize=2
769                        ModifyGraph/W=V_1D_Data muloffset(iBin_qxqy_FL)={0,4},muloffset(iBin_qxqy_FB)={0,2},muloffset(iBin_qxqy_FR)={0,8}
770                        ModifyGraph/W=V_1D_Data grid=1
771                        ModifyGraph/W=V_1D_Data log=1
772                        ModifyGraph/W=V_1D_Data mirror=2
773                endif           
774                       
775        endif
776       
777        SetDataFolder root:
778End
779
780
781// TODO
782// x- need to set binType
783// x- currently  hard-wired == 1
784//
785////////////to plot the back panel I(q)
786Proc V_Back_IQ_Graph(type,binType)
787        String type
788        Variable binType
789       
790//      SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_B
791
792//      Variable binType
793
794//      binType = V_GetBinningPopMode()
795       
796        SetDataFolder $("root:Packages:NIST:VSANS:"+type)       
797
798        if(binType==1 || binType==2 || binType==3)
799       
800                ClearAllIQIfDisplayed("B")
801                SetDataFolder $("root:Packages:NIST:VSANS:"+type)       
802                CheckDisplayed/W=V_1D_Data iBin_qxqy_B
803               
804                if(V_flag==0)
805                        AppendtoGraph/W=V_1D_Data iBin_qxqy_B vs qBin_qxqy_B
806                        ModifyGraph/W=V_1D_Data mode=4
807                        ModifyGraph/W=V_1D_Data marker=19
808                        ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_B)=(1,52428,52428)
809                        ModifyGraph/W=V_1D_Data msize=2
810                        ModifyGraph/W=V_1D_Data grid=1
811                        ModifyGraph/W=V_1D_Data log=1
812                        ModifyGraph/W=V_1D_Data mirror=2
813                endif
814        endif
815
816        //nothing different here since there is ony a single detector to display, but for the future...
817        if(binType==4)
818       
819                ClearAllIQIfDisplayed("B")
820                SetDataFolder $("root:Packages:NIST:VSANS:"+type)       
821                CheckDisplayed/W=V_1D_Data iBin_qxqy_B
822               
823                if(V_flag==0)
824                        AppendtoGraph/W=V_1D_Data iBin_qxqy_B vs qBin_qxqy_B
825                        ModifyGraph/W=V_1D_Data mode=4
826                        ModifyGraph/W=V_1D_Data marker=19
827                        ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_B)=(1,52428,52428)
828                        ModifyGraph/W=V_1D_Data msize=2
829                        ModifyGraph/W=V_1D_Data grid=1
830                        ModifyGraph/W=V_1D_Data log=1
831                        ModifyGraph/W=V_1D_Data mirror=2
832                endif
833        endif
834
835       
836        SetDataFolder root:
837End
838
Note: See TracBrowser for help on using the repository browser.