source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Combine_1D.ipf @ 1130

Last change on this file since 1130 was 1099, checked in by srkline, 5 years ago

added Beaucage model to White Beam so that I could model the CFG sample.

cleaned up a few routines to get rid of NaN values in the output I(q) data sets if they were not masked out completely

File size: 19.2 KB
Line 
1#pragma TextEncoding = "MacRoman"
2#pragma rtGlobals=3             // Use modern global access method and strict wave access.
3
4
5
6
7
8//
9// TODO:
10// x- make  the data folder list for the popup
11// x- make the data folder popup do the work of plotting
12//
13// x- (done by invoking the panel)
14//   x-make a button to show the default table, and set up dependencies to link to the graph display
15//
16// -- have an "active" data set to trim, or make duplicates for all of the data sets
17//
18// -- button to convert the points to strings that can be used and written to data files?
19// -- is this really necessary? if the save button is clicked, the strings are automatically generated
20//  -- but what if it's not? What if I do something else to send the strings to a protocol? or to a file?
21//
22// -- find a better way to be sure that the dependency does not generate errors if it is not
23//   properly killed
24//
25// -- help file
26//
27// x- larger panel
28//
29// x- error checking if the binType and the data present don't match. (test for failure)
30// -- do I really need the binType popup? How else would I know what data sets to plot/remove?
31//
32// x- table is continually duplicated
33// -- AutoPosition the windows next to each other
34// x- (different)(not ugly) color for the control bar so it's distinguishable from the regular data plot
35// x- "Done" button that kills the root:ToTrim folder (may need to kill the dependency first)
36//
37Proc V_CombineDataGraph()
38
39// this is the "initialization" step
40        NewDataFolder/O root:ToTrim
41       
42        DoWindow/F V_1D_Combine
43
44        Variable num,ii
45        String detStr
46               
47        if(V_flag==0)
48
49                Display /W=(277,526,879,1069)/N=V_1D_Combine /K=2
50
51                ControlBar 70
52                ModifyGraph cbRGB=(44000,44000,44000)
53               
54//              Button button2,pos={15,5},size={70,20},proc=V_Load_ITX_button,title="Load Data"
55//              Button button2,help={"Load an ITX file"}
56               
57//              PopupMenu popup1,pos={125,5},size={90,20},title="Data Folder"
58//              PopupMenu popup1,help={"data folder"}
59//              PopupMenu popup1,value= GetAList(4),proc=V_DataFolderPlotPop
60               
61                PopupMenu popup0,pos={15,5},size={70,20},title="Bin Type"
62                PopupMenu popup0,help={"binning type"}
63                PopupMenu popup0,value= ksBinTypeStr,proc=V_DataBinTypePlotPop
64
65                Button button3,pos={544.00,5},size={30.00,20.00},title="?"
66                Button button3,help={"help file for combining 1D data"}
67
68                CheckBox check0,pos={18.00,36.00},size={57.00,16.00},proc=V_Plot1D_LogCheckProc,title="Log Axes"
69                CheckBox check0,value= 1
70
71                Button AllQ,pos={100,36},size={70,20},proc=V_AllQ_Plot_1D_ButtonProc,title="All Q"
72                Button AllQ,help={"Show the full q-range of the dataset"}
73
74                Button button1,pos={225,36},size={100,20},proc=V_TrimWaves2StringButton,title="Wave 2 Str"
75                Button button1,help={"Convert the waves to global strings"}
76               
77//              Button button4,pos={388,36},size={90.00,20.00},title="Trim & Save"
78//              Button button4,help={"combine and save 1D data"},proc=V_SaveTrimmed_Button
79               
80                Button button0,pos={524,36},size={70,20},proc=V_DoneCombine1D_ButtonProc,title="Done"
81                Button button0,help={"Close the panel and kill the temporary folder"}
82                               
83                Legend/C/N=text0/J/X=72.00/Y=60.00
84
85        endif   
86       
87
88        //trust that the table is present? No, but don't overwrite the data in the waves
89        // unless any one of the three doesn't exist
90       
91        SetDataFolder root:Packages:NIST:VSANS:Globals:Protocols
92
93        if(exists("PanelNameW") == 0 || exists("Beg_pts") == 0 || exists("End_pts") == 0)
94                Make/O/T/N=(ItemsInList(ksPanelBinTypeList)) PanelNameW
95                Make/O/D/N=(ItemsInList(ksPanelBinTypeList)) Beg_pts
96                Make/O/D/N=(ItemsInList(ksPanelBinTypeList)) End_pts
97       
98                num = ItemsInList(ksPanelBinTypeList)
99                ii=0
100                do
101                        detStr = StringFromList(ii, ksPanelBinTypeList)
102                        Beg_pts[ii]  = NumberByKey(detStr, ksBinTrimBegDefault,"=",";")
103                        End_pts[ii] = NumberByKey(detStr, ksBinTrimEndDefault,"=",";")
104                        PanelNameW[ii] = detStr
105                        ii += 1
106                while(ii<num)
107               
108        endif
109        // now make sure that the table is present
110        DoWindow/F V_TrimPointsTable
111
112        if(V_flag==0)
113                Edit/K=0/N=V_TrimPointsTable PanelNameW,Beg_pts,End_pts         
114        endif
115       
116        // last, set up the dependency (but don't set it up twice!)
117        if(exists("root:Packages:NIST:VSANS:Globals:Protocols:trimUpdate") == 0)
118                Make/O/D/N=1 root:Packages:NIST:VSANS:Globals:Protocols:trimUpdate
119                root:Packages:NIST:VSANS:Globals:Protocols:trimUpdate := V_TrimTestUpdate(Beg_pts, End_pts)
120        else
121                string dependencyStr = GetFormula(root:Packages:NIST:VSANS:Globals:Protocols:trimUpdate)
122                if(strlen(dependencyStr)==0)
123                        root:Packages:NIST:VSANS:Globals:Protocols:trimUpdate := V_TrimTestUpdate(Beg_pts, End_pts)
124                endif
125        endif
126       
127        SetDataFolder root:
128               
129End
130
131
132// function that is a simple dependency, and updates the trimmed waves
133// that are displayed
134//
135// does not actually modify the real data, makes a copy, and is only a visual
136//
137//
138Function V_TrimTestUpdate(Beg_pts, End_pts)
139        Wave Beg_pts,End_pts
140       
141        // trim the data displayed
142        // do this by setting the iBin values to NaN, so it won't display
143        // won't hurt to set twice...
144       
145        Wave/T panelStr = root:Packages:NIST:VSANS:Globals:Protocols:PanelNameW
146        Wave begW = root:Packages:NIST:VSANS:Globals:Protocols:Beg_pts
147        Wave endW = root:Packages:NIST:VSANS:Globals:Protocols:End_pts
148
149        // in case the dependency is still active, and the folder was killed
150        if(DataFolderExists("root:ToTrim") == 0)
151                return(0)
152        endif
153       
154//      SetDataFolder root:ToTrim
155//      ControlInfo/W=V_1D_Combine popup1
156//      String dataFldrStr = S_Value
157        NVAR gIgnoreBackDet = root:Packages:NIST:VSANS:Globals:gIgnoreDetB
158        SVAR curDispType = root:Packages:NIST:VSANS:Globals:gCurDispType
159        String dataFldrStr = "root:Packages:NIST:VSANS:"+curDispType
160       
161        Variable num,ii,p1,p2
162        String str,detStr
163        num=numpnts(panelStr)
164       
165        for(ii=0;ii<num;ii+=1)
166                detStr = panelStr[ii]
167                if(gIgnoreBackDet && cmpstr(detStr,"B") == 0)
168                        // do nothing
169                else
170                        Wave/Z iw = $("root:ToTrim:iBin_qxqy_"+detStr+"_trim")
171                        Wave/Z iw_orig = $(dataFldrStr+":iBin_qxqy_"+detStr)
172        //              Wave/Z iw = $("iBin_qxqy_"+detStr)
173        //              Wave/Z ew = $("eBin_qxqy_"+detStr)
174                        if(WaveExists(iw) && WaveExists(iw_orig))
175                               
176        //                      DeletePoints 0,nBeg, qw,iw,ew
177                                // start fresh
178                                iw = iw_orig
179                                Variable npt
180                                npt = numpnts(iw)
181                                                       
182                                p1 = begW[ii]
183                                if(p1 > 0 && p1 < npt-1)
184                                        iw[0,p1-1] = NaN
185                                endif
186                               
187        //                      DeletePoints npt-nEnd,nEnd, qw,iw,ew
188                                p2 = EndW[ii]
189                               
190                                if(p2 > 0 && p2 < npt-1)
191                                        iw[npt-p2,npt-1] = NaN
192                                endif                   
193                        endif
194                endif
195        endfor
196       
197        SetDataFolder root:
198
199        return(0)
200End
201
202//
203// x- verify that the proper waves exist for the binning type
204//
205// x- the logic here is wrong. if the ToTrim folder is empty (As on startup)
206//  then the waves are always missing - and the function returns an error - every time
207//
208// now works with the "current" data that is displayed, rather than relying on
209// a lot of user input regarding the details of the saved data
210//
211Function V_DataBinTypePlotPop(ctrlName,popNum,popStr) : PopupMenuControl
212        String ctrlName
213        Variable popNum // which item is currently selected (1-based)
214        String popStr           // contents of current popup item as string
215
216
217        String str,winStr="V_1D_Combine"
218        Variable binType,num,ii,err
219
220        binType = V_BinTypeStr2Num(popStr)
221       
222       
223        //  x- need to update this to make sure that the data waves are present before plotting. This
224        //    currently looks in the ToTrim folder, but the binning could be wrong in the data folder
225        //    and will be an error...
226       
227        //dataType now needs to be the full path to the folder
228        // Plot the "real" data. data copy to trim will be plotted later
229        //
230        SVAR dispType = root:Packages:NIST:VSANS:Globals:gCurDispType
231        String collimationStr="pinhole"         //TODO: where do I get this information from ? does it matter here?
232
233// dispatch based on the string, not on the number of selection in the pop string
234        V_QBinAllPanels_Circular(dispType,binType,collimationStr)
235
236        String workTypeStr
237        workTypeStr = "root:Packages:NIST:VSANS:"+dispType
238       
239
240//      dataType = "root:"+popStr
241//     
242//      //remove EVERYTHING from the graph, no matter what
243        String type,list,item
244//      list = TraceNameList(winStr,";",1)
245//      for(ii=0;ii<ItemsInList(list);ii+=1)
246//              item = StringFromList(ii, list, ";")
247////            CheckDisplayed/W=$winStr $(item)
248////            if(V_flag==1)
249//                      RemoveFromGraph/Z/W=$winStr $(item)
250////            endif
251//      endfor 
252//     
253       
254        sprintf str,"(\"%s\",%d,\"%s\")",workTypeStr,binType,winStr
255
256        Execute ("V_Back_IQ_Graph"+str)
257        Execute ("V_Middle_IQ_Graph"+str)
258        Execute ("V_Front_IQ_Graph"+str)
259
260        ModifyGraph marker=8,opaque=1,msize=3           //make the traces open white circles
261
262
263        NewDataFolder/O root:ToTrim
264       
265        //remove all of the "toTrim" data from the graph, if it's there
266        SetDataFolder root:ToTrim
267        for(ii=0;ii<ItemsInList(ksPanelBinTypeList);ii+=1)
268                type = StringFromList(ii, ksPanelBinTypeList, ";")
269                CheckDisplayed/W=$winStr $("iBin_qxqy_"+type+"_trim")
270                if(V_flag==1)
271                        RemoveFromGraph/W=$winStr $("iBin_qxqy_"+type+"_trim")
272                endif
273        endfor 
274        SetDataFolder root:
275
276
277        //then kill the data folder, so it can be duplicated
278       
279//
280//      // duplicate all of the data into the new folder
281        SetDataFolder $workTypeStr
282        list = WaveList("*",";","")             //must be in the correct data folder
283        SetDataFolder root:
284//      Print list     
285        num = ItemsInList(list)
286        for(ii=0;ii<num;ii+=1)
287                str = StringFromList(ii,list)
288                Duplicate/O $(workTypeStr+":"+str), $("root:ToTrim:"+str+"_trim")
289        endfor
290       
291//      // be sure that the data is present in the ToTrim folder before trying to plot
292//      err = V_TrimWavesExist(binType)
293//      if(err)
294//              DoAlert 0,"wrong bin type selected"
295//              return(0)
296//      endif
297       
298       
299        // plot the linked data
300        sprintf str,"(\"%s\",%d,\"%s\")","root:ToTrim",binType,winStr
301
302        Execute ("V_Back_IQ_Graph_trim"+str)
303        Execute ("V_Middle_IQ_Graph_trim"+str)
304        Execute ("V_Front_IQ_Graph_trim"+str)
305        // and link the data to the table with a dependency?
306//      done in the panel macro?
307       
308        // last, force the dependency to update so that the trimmed points are shown
309        Wave w = root:Packages:NIST:VSANS:Globals:Protocols:Beg_pts
310        w[0] += 1
311        w[0] -= 1
312       
313       
314        return(0)       
315End
316
317
318
319//
320// x- verify that the proper waves exist for the binning type
321//
322// x- the logic here is wrong. if the ToTrim folder is empty (As on startup)
323//  then the waves are always missing - and the function returns an error - every time
324//
325// currently unused, in favor of using the current data rather than saved itx data
326//
327Function V_DataFolderPlotPop(ctrlName,popNum,popStr) : PopupMenuControl
328        String ctrlName
329        Variable popNum // which item is currently selected (1-based)
330        String popStr           // contents of current popup item as string
331
332
333        String str,winStr="V_1D_Combine",dataType
334        Variable binType,num,ii
335        ControlInfo popup0
336        binType = V_BinTypeStr2Num(S_Value)
337       
338       
339        //  x- need to update this to make sure that the data waves are present before plotting. This
340        //    currently looks in the ToTrim folder, but the binning could be wrong in the data folder
341        //    and will be an error...
342       
343        // be sure that the data is present in the ToTrim folder before trying to plot
344        Variable err = V_itxWavesExist(popStr,binType)
345        if(err)
346                DoAlert 0,"wrong bin type selected"
347                return(0)
348        endif
349       
350       
351        //dataType now needs to be the full path to the folder
352        // Plot the "real" data. data copy to trim will be plotted later
353        //
354        dataType = "root:"+popStr
355       
356        //remove EVERYTHING from the graph, no matter what
357        String type,list,item
358        list = TraceNameList(winStr,";",1)
359        for(ii=0;ii<ItemsInList(list);ii+=1)
360                item = StringFromList(ii, list, ";")
361//              CheckDisplayed/W=$winStr $(item)
362//              if(V_flag==1)
363                        RemoveFromGraph/Z/W=$winStr $(item)
364//              endif
365        endfor 
366       
367       
368        sprintf str,"(\"%s\",%d,\"%s\")",dataType,binType,winStr
369
370        Execute ("V_Back_IQ_Graph"+str)
371        Execute ("V_Middle_IQ_Graph"+str)
372        Execute ("V_Front_IQ_Graph"+str)
373
374        ModifyGraph marker=8,opaque=1,msize=3           //make the traces open white circles
375
376
377        NewDataFolder/O root:ToTrim
378       
379        //remove all of the "toTrim" data from the graph, if it's there
380        SetDataFolder root:ToTrim
381        for(ii=0;ii<ItemsInList(ksPanelBinTypeList);ii+=1)
382                type = StringFromList(ii, ksPanelBinTypeList, ";")
383                CheckDisplayed/W=$winStr $("iBin_qxqy_"+type+"_trim")
384                if(V_flag==1)
385                        RemoveFromGraph/W=$winStr $("iBin_qxqy_"+type+"_trim")
386                endif
387        endfor 
388        SetDataFolder root:
389
390
391        //then kill the data folder, so it can be duplicated
392       
393//
394//      // duplicate all of the data into the new folder
395        SetDataFolder $dataType
396        list = WaveList("*",";","")             //must be in the correct data folder
397        SetDataFolder root:
398//      Print list     
399        num = ItemsInList(list)
400        for(ii=0;ii<num;ii+=1)
401                str = StringFromList(ii,list)
402                Duplicate/O $(dataType+":"+str), $("root:ToTrim:"+str+"_trim")
403        endfor
404       
405        // be sure that the data is present in the ToTrim folder before trying to plot
406        err = V_TrimWavesExist(binType)
407        if(err)
408                DoAlert 0,"wrong bin type selected"
409                return(0)
410        endif
411       
412       
413        // plot the linked data
414        sprintf str,"(\"%s\",%d,\"%s\")","root:ToTrim",binType,winStr
415
416        Execute ("V_Back_IQ_Graph_trim"+str)
417        Execute ("V_Middle_IQ_Graph_trim"+str)
418        Execute ("V_Front_IQ_Graph_trim"+str)
419        // and link the data to the table with a dependency?
420//      done in the panel macro?
421       
422        // last, force the dependency to update so that the trimmed points are shown
423        Wave w = root:Packages:NIST:VSANS:Globals:Protocols:Beg_pts
424        w[0] += 1
425        w[0] -= 1
426       
427       
428        return(0)       
429End
430
431
432
433// kill the dependency,
434// kill the panel, then the associated ToTrim folder
435// do not kill the beg/end waves
436//
437Function V_DoneCombine1D_ButtonProc(ctrlName) : ButtonControl
438        String ctrlName
439       
440        Wave trimUpdate = root:Packages:NIST:VSANS:Globals:Protocols:trimUpdate
441        trimUpdate = 1          //kills the dependency
442        DoWindow/K V_1D_Combine
443       
444        KillDataFolder/Z root:ToTrim
445       
446        return(0)
447End
448
449// TODO
450// -- verify that this works for all binning cases
451// -- see V_Trim1DDataStr to see if they can be combined
452//
453Function V_SaveTrimmed_Button(ctrlName) : ButtonControl
454        String ctrlName
455       
456        String detListStr,dataType,str
457        Variable bintype,num,ii
458
459        ControlInfo popup0
460        binType = V_BinTypeStr2Num(S_Value)
461       
462       
463        if(binType == 1)
464                detListStr = ksBinType1
465        endif
466        if(binType == 2)
467                detListStr = ksBinType2
468        endif
469        if(binType == 3)
470                detListStr = ksBinType3
471        endif
472        if(binType == 4)
473                detListStr = ksBinType4
474        endif
475        if(strlen(detListStr)==0)
476                DoAlert 0,"error in V_SaveTrimmed_Button"
477                return(0)
478        endif
479
480// set the global strings
481        V_TrimWaves2String()            //in case the button wasn't clicked
482        SVAR gBegPtsStr=root:Packages:NIST:VSANS:Globals:Protocols:gBegPtsStr
483        SVAR gEndPtsStr=root:Packages:NIST:VSANS:Globals:Protocols:gEndPtsStr
484
485// get a fresh copy of the data
486// duplicate all of the data into the new folder
487        ControlInfo popup1
488        dataType = "root:"+S_Value
489
490        SetDataFolder $dataType
491        String list = WaveList("*",";","")              //must be in the correct data folder
492        SetDataFolder root:
493//      Print list     
494        num = ItemsInList(list)
495        for(ii=0;ii<num;ii+=1)
496                str = StringFromList(ii,list)
497                Duplicate/O $(dataType+":"+str), $("root:ToTrim:"+str+"_trim")
498        endfor
499
500       
501// trim each data set
502        Variable nBeg,nEnd,npt
503        String detstr
504       
505        SetDataFolder root:ToTrim
506        num = ItemsInList(detListStr)
507        for(ii=0;ii<num;ii+=1)
508                detStr = StringFromList(ii, detListStr)
509                nBeg = NumberByKey(detStr, gBegPtsStr,"=",";")
510                nEnd = NumberByKey(detStr, gEndPtsStr,"=",";")
511               
512//              V_TrimOneSet(folderStr,detStr,nBeg,nEnd)
513                Wave/Z qw = $("qBin_qxqy_"+detStr+"_trim")
514                Wave/Z iw = $("iBin_qxqy_"+detStr+"_trim")
515                Wave/Z ew = $("eBin_qxqy_"+detStr+"_trim")
516
517                DeletePoints 0,nBeg, qw,iw,ew
518
519                npt = numpnts(qw)
520                DeletePoints npt-nEnd,nEnd, qw,iw,ew
521//             
522        endfor
523
524
525// remove Q=0 from "B" if it's present
526        SetDataFolder root:ToTrim
527        WAVE/Z qBin = qBin_qxqy_B_trim
528        WAVE/Z iBin = iBin_qxqy_B_trim
529        WAVE/Z eBin = eBin_qxqy_B_trim
530//      WAVE/Z nBin = nBin_qxqy_B_trim
531//      WAVE/Z iBin2 = iBin2_qxqy_B_trim
532
533        if(qBin[0] == 0)
534                DeletePoints 0, 1, qBin,iBin,eBin//,nBin,iBin2
535        endif
536
537       
538// concatenate
539        V_1DConcatenate("root:","ToTrim","_trim",binType)
540
541// sort the waves - concatenation creates tmp_q, tmp_i, tmp_s
542// so this call will work (doesn't need the "_trim" tag)
543        V_TmpSort1D("root:","ToTrim")
544
545// write out the data to disk
546
547        Execute "V_GetNameForSave()"
548        SVAR newName = root:saveName
549        String saveName = newName
550
551        //will write out the tmp_q, tmp_i, tmp_s waves
552        V_Write1DData("root:","ToTrim",saveName)                //don't pass the full path, just the name
553
554       
555// put a fresh copy of the data back into the folder since the data was actually trimmed
556// duplicate all of the data into the new folder
557        ControlInfo popup1
558        dataType = "root:"+S_Value
559
560        SetDataFolder $dataType
561        list = WaveList("*",";","")             //must be in the correct data folder
562        SetDataFolder root:
563//      Print list     
564        num = ItemsInList(list)
565        for(ii=0;ii<num;ii+=1)
566                str = StringFromList(ii,list)
567                Duplicate/O $(dataType+":"+str), $("root:ToTrim:"+str+"_trim")
568        endfor
569
570
571        SetDataFolder root:
572       
573        return(0)
574End
575
576
577
578//
579// dialog to select and load an itx format data file
580//
581Function V_Load_ITX_Button(ctrlName) : ButtonControl
582        String ctrlName
583       
584        Execute "V_Load_Data_ITX()"
585       
586        return(0)
587End
588
589
590// TODO
591// -- document
592Function V_TrimWaves2StringButton(ctrlName) : ButtonControl
593        String ctrlName
594       
595        V_TrimWaves2String()
596
597        return(0)
598End
599
600// for each of the binning types, be sure that the corresponding waves in the
601// root:ToTrim folder actually do exist.
602// return 0 for OK, 1 if error
603Function V_TrimWavesExist(binType)
604        Variable binType
605       
606        String binStr="",str
607        Variable num,ii
608       
609        if(binType == 1)
610                binStr = ksBinType1
611        endif
612        if(binType == 2)
613                binStr = ksBinType2
614        endif
615        if(binType == 3)
616                binStr = ksBinType3
617        endif
618        if(binType == 4)
619                binStr = ksBinType4
620        endif
621       
622        num = ItemsInList(binStr)
623        for(ii=0;ii<num;ii+=1)
624                str = StringFromList(ii,binStr)
625                if(exists("root:ToTrim:iBin_qxqy_"+Str+"_trim") == 0)           // not in use = error
626                        return(1)
627                endif
628        endfor
629       
630        return(0)               //everything checked out OK, no error
631
632end
633
634// for each of the binning types, be sure that the corresponding waves in the
635// root:ToTrim folder actually do exist.
636// return 0 for OK, 1 if error
637Function V_itxWavesExist(folderStr,binType)
638        String folderStr
639        Variable binType
640       
641        String binStr="",str
642        Variable num,ii
643       
644        if(binType == 1)
645                binStr = ksBinType1
646        endif
647        if(binType == 2)
648                binStr = ksBinType2
649        endif
650        if(binType == 3)
651                binStr = ksBinType3
652        endif
653        if(binType == 4)
654                binStr = ksBinType4
655        endif
656       
657        num = ItemsInList(binStr)
658        for(ii=0;ii<num;ii+=1)
659                str = StringFromList(ii,binStr)
660                if(exists("root:"+folderStr+":iBin_qxqy_"+Str) == 0)            // not in use = error
661                        return(1)
662                endif
663        endfor
664       
665        return(0)               //everything checked out OK, no error
666
667end
668
669
670
671//
672// take the waves, and convert to strings that can be added to the protocol
673//
674//
675// x- get the variables out of root:, and move it to Protocols
676// x- get the waves out of root:, and move it to Protocols
677// x- be sure that the variables are initialized (done in main initialization
678// x- link this to the panel?
679//
680Function V_TrimWaves2String()
681
682
683        SVAR gBegPtsStr=root:Packages:NIST:VSANS:Globals:Protocols:gBegPtsStr
684        SVAR gEndPtsStr=root:Packages:NIST:VSANS:Globals:Protocols:gEndPtsStr
685
686        Wave/T PanelNameW = root:Packages:NIST:VSANS:Globals:Protocols:PanelNameW
687        Wave Beg_pts = root:Packages:NIST:VSANS:Globals:Protocols:Beg_pts
688        Wave End_pts = root:Packages:NIST:VSANS:Globals:Protocols:End_pts
689       
690// ksPanelBinTypeList = "B;FT;FB;FL;FR;MT;MB;ML;MR;FTB;FLR;MTB;MLR;FLRTB;MLRTB;"
691// ksBinTrimBegDefault = "B=5;FT=6;FB=6;FL=6;FR=6;MT=6;MB=6;ML=6;MR=6;FTB=7;FLR=7;MTB=7;MLR=7;FLRTB=8;MLRTB=8;"
692// ksBinTrimEndDefault
693
694        // wipe out the "old" global strings
695        gBegPtsStr = ksBinTrimBegDefault
696        gEndPtsStr = ksBinTrimEndDefault
697
698        Variable num, ii,nBeg,nEnd
699        String item,panelStr
700       
701        num = numpnts(PanelNameW)
702        for(ii=0;ii<num;ii+=1)
703                panelStr = PanelNameW[ii]
704                gBegPtsStr = ReplaceNumberByKey(panelStr, gBegPtsStr, Beg_pts[ii],"=",";")
705                gEndPtsStr = ReplaceNumberByKey(panelStr, gEndPtsStr, End_pts[ii],"=",";")
706        endfor
707
708        return(0)
709End
710
711
Note: See TracBrowser for help on using the repository browser.