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

Last change on this file since 1242 was 1242, checked in by srkline, 2 years ago

updating the IgorVersion? pragma to v7.0 for all files to be consistent.

File size: 19.6 KB
Line 
1#pragma TextEncoding = "MacRoman"
2#pragma rtGlobals=3             // Use modern global access method and strict wave access.
3#pragma IgorVersion = 7.00
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,proc=V_ShowCombine1DHelp,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={140,20},proc=V_TrimWaves2StringButton,title="Save Trim Points"
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
132Function V_ShowCombine1DHelp(ctrlName) : ButtonControl
133        String ctrlName
134        DisplayHelpTopic/Z/K=1 "VSANS Data Reduction Documentation[Combine 1D Files]"
135        if(V_flag !=0)
136                DoAlert 0,"The VSANS Data Reduction Tutorial Help file could not be found"
137        endif
138        return(0)
139End
140
141// function that is a simple dependency, and updates the trimmed waves
142// that are displayed
143//
144// does not actually modify the real data, makes a copy, and is only a visual
145//
146//
147Function V_TrimTestUpdate(Beg_pts, End_pts)
148        Wave Beg_pts,End_pts
149       
150        // trim the data displayed
151        // do this by setting the iBin values to NaN, so it won't display
152        // won't hurt to set twice...
153       
154        Wave/T panelStr = root:Packages:NIST:VSANS:Globals:Protocols:PanelNameW
155        Wave begW = root:Packages:NIST:VSANS:Globals:Protocols:Beg_pts
156        Wave endW = root:Packages:NIST:VSANS:Globals:Protocols:End_pts
157
158        // in case the dependency is still active, and the folder was killed
159        if(DataFolderExists("root:ToTrim") == 0)
160                return(0)
161        endif
162       
163//      SetDataFolder root:ToTrim
164//      ControlInfo/W=V_1D_Combine popup1
165//      String dataFldrStr = S_Value
166        NVAR gIgnoreBackDet = root:Packages:NIST:VSANS:Globals:gIgnoreDetB
167        SVAR curDispType = root:Packages:NIST:VSANS:Globals:gCurDispType
168        String dataFldrStr = "root:Packages:NIST:VSANS:"+curDispType
169       
170        Variable num,ii,p1,p2
171        String str,detStr
172        num=numpnts(panelStr)
173       
174        for(ii=0;ii<num;ii+=1)
175                detStr = panelStr[ii]
176                if(gIgnoreBackDet && cmpstr(detStr,"B") == 0)
177                        // do nothing
178                else
179                        Wave/Z iw = $("root:ToTrim:iBin_qxqy_"+detStr+"_trim")
180                        Wave/Z iw_orig = $(dataFldrStr+":iBin_qxqy_"+detStr)
181        //              Wave/Z iw = $("iBin_qxqy_"+detStr)
182        //              Wave/Z ew = $("eBin_qxqy_"+detStr)
183                        if(WaveExists(iw) && WaveExists(iw_orig))
184                               
185        //                      DeletePoints 0,nBeg, qw,iw,ew
186                                // start fresh
187                                iw = iw_orig
188                                Variable npt
189                                npt = numpnts(iw)
190                                                       
191                                p1 = begW[ii]
192                                if(p1 > 0 && p1 < npt-1)
193                                        iw[0,p1-1] = NaN
194                                endif
195                               
196        //                      DeletePoints npt-nEnd,nEnd, qw,iw,ew
197                                p2 = EndW[ii]
198                               
199                                if(p2 > 0 && p2 < npt-1)
200                                        iw[npt-p2,npt-1] = NaN
201                                endif                   
202                        endif
203                endif
204        endfor
205       
206        SetDataFolder root:
207
208        return(0)
209End
210
211//
212// x- verify that the proper waves exist for the binning type
213//
214// x- the logic here is wrong. if the ToTrim folder is empty (As on startup)
215//  then the waves are always missing - and the function returns an error - every time
216//
217// now works with the "current" data that is displayed, rather than relying on
218// a lot of user input regarding the details of the saved data
219//
220Function V_DataBinTypePlotPop(ctrlName,popNum,popStr) : PopupMenuControl
221        String ctrlName
222        Variable popNum // which item is currently selected (1-based)
223        String popStr           // contents of current popup item as string
224
225
226        String str,winStr="V_1D_Combine"
227        Variable binType,num,ii,err
228
229        binType = V_BinTypeStr2Num(popStr)
230       
231       
232        //  x- need to update this to make sure that the data waves are present before plotting. This
233        //    currently looks in the ToTrim folder, but the binning could be wrong in the data folder
234        //    and will be an error...
235       
236        //dataType now needs to be the full path to the folder
237        // Plot the "real" data. data copy to trim will be plotted later
238        //
239        SVAR dispType = root:Packages:NIST:VSANS:Globals:gCurDispType
240        String collimationStr="pinhole"         //TODO: where do I get this information from ? does it matter here?
241
242// dispatch based on the string, not on the number of selection in the pop string
243        V_QBinAllPanels_Circular(dispType,binType,collimationStr)
244
245        String workTypeStr
246        workTypeStr = "root:Packages:NIST:VSANS:"+dispType
247       
248
249//      dataType = "root:"+popStr
250//     
251//      //remove EVERYTHING from the graph, no matter what
252        String type,list,item
253//      list = TraceNameList(winStr,";",1)
254//      for(ii=0;ii<ItemsInList(list);ii+=1)
255//              item = StringFromList(ii, list, ";")
256////            CheckDisplayed/W=$winStr $(item)
257////            if(V_flag==1)
258//                      RemoveFromGraph/Z/W=$winStr $(item)
259////            endif
260//      endfor 
261//     
262       
263        sprintf str,"(\"%s\",%d,\"%s\")",workTypeStr,binType,winStr
264
265        Execute ("V_Back_IQ_Graph"+str)
266        Execute ("V_Middle_IQ_Graph"+str)
267        Execute ("V_Front_IQ_Graph"+str)
268
269        ModifyGraph marker=8,opaque=1,msize=3           //make the traces open white circles
270
271
272        NewDataFolder/O root:ToTrim
273       
274        //remove all of the "toTrim" data from the graph, if it's there
275        SetDataFolder root:ToTrim
276        for(ii=0;ii<ItemsInList(ksPanelBinTypeList);ii+=1)
277                type = StringFromList(ii, ksPanelBinTypeList, ";")
278                CheckDisplayed/W=$winStr $("iBin_qxqy_"+type+"_trim")
279                if(V_flag==1)
280                        RemoveFromGraph/W=$winStr $("iBin_qxqy_"+type+"_trim")
281                endif
282        endfor 
283        SetDataFolder root:
284
285
286        //then kill the data folder, so it can be duplicated
287       
288//
289//      // duplicate all of the data into the new folder
290        SetDataFolder $workTypeStr
291        list = WaveList("*",";","")             //must be in the correct data folder
292        SetDataFolder root:
293//      Print list     
294        num = ItemsInList(list)
295        for(ii=0;ii<num;ii+=1)
296                str = StringFromList(ii,list)
297                Duplicate/O $(workTypeStr+":"+str), $("root:ToTrim:"+str+"_trim")
298        endfor
299       
300//      // be sure that the data is present in the ToTrim folder before trying to plot
301//      err = V_TrimWavesExist(binType)
302//      if(err)
303//              DoAlert 0,"wrong bin type selected"
304//              return(0)
305//      endif
306       
307       
308        // plot the linked data
309        sprintf str,"(\"%s\",%d,\"%s\")","root:ToTrim",binType,winStr
310
311        Execute ("V_Back_IQ_Graph_trim"+str)
312        Execute ("V_Middle_IQ_Graph_trim"+str)
313        Execute ("V_Front_IQ_Graph_trim"+str)
314        // and link the data to the table with a dependency?
315//      done in the panel macro?
316       
317        // last, force the dependency to update so that the trimmed points are shown
318        Wave w = root:Packages:NIST:VSANS:Globals:Protocols:Beg_pts
319        w[0] += 1
320        w[0] -= 1
321       
322       
323        return(0)       
324End
325
326
327
328//
329// x- verify that the proper waves exist for the binning type
330//
331// x- the logic here is wrong. if the ToTrim folder is empty (As on startup)
332//  then the waves are always missing - and the function returns an error - every time
333//
334// currently unused, in favor of using the current data rather than saved itx data
335//
336Function V_DataFolderPlotPop(ctrlName,popNum,popStr) : PopupMenuControl
337        String ctrlName
338        Variable popNum // which item is currently selected (1-based)
339        String popStr           // contents of current popup item as string
340
341
342        String str,winStr="V_1D_Combine",dataType
343        Variable binType,num,ii
344        ControlInfo popup0
345        binType = V_BinTypeStr2Num(S_Value)
346       
347       
348        //  x- need to update this to make sure that the data waves are present before plotting. This
349        //    currently looks in the ToTrim folder, but the binning could be wrong in the data folder
350        //    and will be an error...
351       
352        // be sure that the data is present in the ToTrim folder before trying to plot
353        Variable err = V_itxWavesExist(popStr,binType)
354        if(err)
355                DoAlert 0,"wrong bin type selected"
356                return(0)
357        endif
358       
359       
360        //dataType now needs to be the full path to the folder
361        // Plot the "real" data. data copy to trim will be plotted later
362        //
363        dataType = "root:"+popStr
364       
365        //remove EVERYTHING from the graph, no matter what
366        String type,list,item
367        list = TraceNameList(winStr,";",1)
368        for(ii=0;ii<ItemsInList(list);ii+=1)
369                item = StringFromList(ii, list, ";")
370//              CheckDisplayed/W=$winStr $(item)
371//              if(V_flag==1)
372                        RemoveFromGraph/Z/W=$winStr $(item)
373//              endif
374        endfor 
375       
376       
377        sprintf str,"(\"%s\",%d,\"%s\")",dataType,binType,winStr
378
379        Execute ("V_Back_IQ_Graph"+str)
380        Execute ("V_Middle_IQ_Graph"+str)
381        Execute ("V_Front_IQ_Graph"+str)
382
383        ModifyGraph marker=8,opaque=1,msize=3           //make the traces open white circles
384
385
386        NewDataFolder/O root:ToTrim
387       
388        //remove all of the "toTrim" data from the graph, if it's there
389        SetDataFolder root:ToTrim
390        for(ii=0;ii<ItemsInList(ksPanelBinTypeList);ii+=1)
391                type = StringFromList(ii, ksPanelBinTypeList, ";")
392                CheckDisplayed/W=$winStr $("iBin_qxqy_"+type+"_trim")
393                if(V_flag==1)
394                        RemoveFromGraph/W=$winStr $("iBin_qxqy_"+type+"_trim")
395                endif
396        endfor 
397        SetDataFolder root:
398
399
400        //then kill the data folder, so it can be duplicated
401       
402//
403//      // duplicate all of the data into the new folder
404        SetDataFolder $dataType
405        list = WaveList("*",";","")             //must be in the correct data folder
406        SetDataFolder root:
407//      Print list     
408        num = ItemsInList(list)
409        for(ii=0;ii<num;ii+=1)
410                str = StringFromList(ii,list)
411                Duplicate/O $(dataType+":"+str), $("root:ToTrim:"+str+"_trim")
412        endfor
413       
414        // be sure that the data is present in the ToTrim folder before trying to plot
415        err = V_TrimWavesExist(binType)
416        if(err)
417                DoAlert 0,"wrong bin type selected"
418                return(0)
419        endif
420       
421       
422        // plot the linked data
423        sprintf str,"(\"%s\",%d,\"%s\")","root:ToTrim",binType,winStr
424
425        Execute ("V_Back_IQ_Graph_trim"+str)
426        Execute ("V_Middle_IQ_Graph_trim"+str)
427        Execute ("V_Front_IQ_Graph_trim"+str)
428        // and link the data to the table with a dependency?
429//      done in the panel macro?
430       
431        // last, force the dependency to update so that the trimmed points are shown
432        Wave w = root:Packages:NIST:VSANS:Globals:Protocols:Beg_pts
433        w[0] += 1
434        w[0] -= 1
435       
436       
437        return(0)       
438End
439
440
441
442// kill the dependency,
443// kill the panel, then the associated ToTrim folder
444// do not kill the beg/end waves
445//
446Function V_DoneCombine1D_ButtonProc(ctrlName) : ButtonControl
447        String ctrlName
448       
449        Wave trimUpdate = root:Packages:NIST:VSANS:Globals:Protocols:trimUpdate
450        trimUpdate = 1          //kills the dependency
451        DoWindow/K V_1D_Combine
452       
453        KillDataFolder/Z root:ToTrim
454       
455        return(0)
456End
457
458// TODO
459// -- verify that this works for all binning cases
460// -- see V_Trim1DDataStr to see if they can be combined
461//
462Function V_SaveTrimmed_Button(ctrlName) : ButtonControl
463        String ctrlName
464       
465        String detListStr,dataType,str
466        Variable bintype,num,ii
467
468        ControlInfo popup0
469        binType = V_BinTypeStr2Num(S_Value)
470       
471       
472        if(binType == 1)
473                detListStr = ksBinType1
474        endif
475        if(binType == 2)
476                detListStr = ksBinType2
477        endif
478        if(binType == 3)
479                detListStr = ksBinType3
480        endif
481        if(binType == 4)
482                detListStr = ksBinType4
483        endif
484        if(strlen(detListStr)==0)
485                DoAlert 0,"error in V_SaveTrimmed_Button"
486                return(0)
487        endif
488
489// set the global strings
490        V_TrimWaves2String()            //in case the button wasn't clicked
491        SVAR gBegPtsStr=root:Packages:NIST:VSANS:Globals:Protocols:gBegPtsStr
492        SVAR gEndPtsStr=root:Packages:NIST:VSANS:Globals:Protocols:gEndPtsStr
493
494// get a fresh copy of the data
495// duplicate all of the data into the new folder
496        ControlInfo popup1
497        dataType = "root:"+S_Value
498
499        SetDataFolder $dataType
500        String list = WaveList("*",";","")              //must be in the correct data folder
501        SetDataFolder root:
502//      Print list     
503        num = ItemsInList(list)
504        for(ii=0;ii<num;ii+=1)
505                str = StringFromList(ii,list)
506                Duplicate/O $(dataType+":"+str), $("root:ToTrim:"+str+"_trim")
507        endfor
508
509       
510// trim each data set
511        Variable nBeg,nEnd,npt
512        String detstr
513       
514        SetDataFolder root:ToTrim
515        num = ItemsInList(detListStr)
516        for(ii=0;ii<num;ii+=1)
517                detStr = StringFromList(ii, detListStr)
518                nBeg = NumberByKey(detStr, gBegPtsStr,"=",";")
519                nEnd = NumberByKey(detStr, gEndPtsStr,"=",";")
520               
521//              V_TrimOneSet(folderStr,detStr,nBeg,nEnd)
522                Wave/Z qw = $("qBin_qxqy_"+detStr+"_trim")
523                Wave/Z iw = $("iBin_qxqy_"+detStr+"_trim")
524                Wave/Z ew = $("eBin_qxqy_"+detStr+"_trim")
525
526                DeletePoints 0,nBeg, qw,iw,ew
527
528                npt = numpnts(qw)
529                DeletePoints npt-nEnd,nEnd, qw,iw,ew
530//             
531        endfor
532
533
534// remove Q=0 from "B" if it's present
535        SetDataFolder root:ToTrim
536        WAVE/Z qBin = qBin_qxqy_B_trim
537        WAVE/Z iBin = iBin_qxqy_B_trim
538        WAVE/Z eBin = eBin_qxqy_B_trim
539//      WAVE/Z nBin = nBin_qxqy_B_trim
540//      WAVE/Z iBin2 = iBin2_qxqy_B_trim
541
542        if(qBin[0] == 0)
543                DeletePoints 0, 1, qBin,iBin,eBin//,nBin,iBin2
544        endif
545
546       
547// concatenate
548        V_1DConcatenate("root:","ToTrim","_trim",binType)
549
550// sort the waves - concatenation creates tmp_q, tmp_i, tmp_s
551// so this call will work (doesn't need the "_trim" tag)
552        V_TmpSort1D("root:","ToTrim")
553
554// write out the data to disk
555
556        Execute "V_GetNameForSave()"
557        SVAR newName = root:saveName
558        String saveName = newName
559
560        //will write out the tmp_q, tmp_i, tmp_s waves
561        V_Write1DData("root:","ToTrim",saveName)                //don't pass the full path, just the name
562
563       
564// put a fresh copy of the data back into the folder since the data was actually trimmed
565// duplicate all of the data into the new folder
566        ControlInfo popup1
567        dataType = "root:"+S_Value
568
569        SetDataFolder $dataType
570        list = WaveList("*",";","")             //must be in the correct data folder
571        SetDataFolder root:
572//      Print list     
573        num = ItemsInList(list)
574        for(ii=0;ii<num;ii+=1)
575                str = StringFromList(ii,list)
576                Duplicate/O $(dataType+":"+str), $("root:ToTrim:"+str+"_trim")
577        endfor
578
579
580        SetDataFolder root:
581       
582        return(0)
583End
584
585
586
587//
588// dialog to select and load an itx format data file
589//
590Function V_Load_ITX_Button(ctrlName) : ButtonControl
591        String ctrlName
592       
593        Execute "V_Load_Data_ITX()"
594       
595        return(0)
596End
597
598
599// TODO
600// -- document
601Function V_TrimWaves2StringButton(ctrlName) : ButtonControl
602        String ctrlName
603       
604        V_TrimWaves2String()
605
606        return(0)
607End
608
609// for each of the binning types, be sure that the corresponding waves in the
610// root:ToTrim folder actually do exist.
611// return 0 for OK, 1 if error
612Function V_TrimWavesExist(binType)
613        Variable binType
614       
615        String binStr="",str
616        Variable num,ii
617       
618        if(binType == 1)
619                binStr = ksBinType1
620        endif
621        if(binType == 2)
622                binStr = ksBinType2
623        endif
624        if(binType == 3)
625                binStr = ksBinType3
626        endif
627        if(binType == 4)
628                binStr = ksBinType4
629        endif
630       
631        num = ItemsInList(binStr)
632        for(ii=0;ii<num;ii+=1)
633                str = StringFromList(ii,binStr)
634                if(exists("root:ToTrim:iBin_qxqy_"+Str+"_trim") == 0)           // not in use = error
635                        return(1)
636                endif
637        endfor
638       
639        return(0)               //everything checked out OK, no error
640
641end
642
643// for each of the binning types, be sure that the corresponding waves in the
644// root:ToTrim folder actually do exist.
645// return 0 for OK, 1 if error
646Function V_itxWavesExist(folderStr,binType)
647        String folderStr
648        Variable binType
649       
650        String binStr="",str
651        Variable num,ii
652       
653        if(binType == 1)
654                binStr = ksBinType1
655        endif
656        if(binType == 2)
657                binStr = ksBinType2
658        endif
659        if(binType == 3)
660                binStr = ksBinType3
661        endif
662        if(binType == 4)
663                binStr = ksBinType4
664        endif
665       
666        num = ItemsInList(binStr)
667        for(ii=0;ii<num;ii+=1)
668                str = StringFromList(ii,binStr)
669                if(exists("root:"+folderStr+":iBin_qxqy_"+Str) == 0)            // not in use = error
670                        return(1)
671                endif
672        endfor
673       
674        return(0)               //everything checked out OK, no error
675
676end
677
678
679
680//
681// take the waves, and convert to strings that can be added to the protocol
682//
683//
684// x- get the variables out of root:, and move it to Protocols
685// x- get the waves out of root:, and move it to Protocols
686// x- be sure that the variables are initialized (done in main initialization
687// x- link this to the panel?
688//
689Function V_TrimWaves2String()
690
691
692        SVAR gBegPtsStr=root:Packages:NIST:VSANS:Globals:Protocols:gBegPtsStr
693        SVAR gEndPtsStr=root:Packages:NIST:VSANS:Globals:Protocols:gEndPtsStr
694
695        Wave/T PanelNameW = root:Packages:NIST:VSANS:Globals:Protocols:PanelNameW
696        Wave Beg_pts = root:Packages:NIST:VSANS:Globals:Protocols:Beg_pts
697        Wave End_pts = root:Packages:NIST:VSANS:Globals:Protocols:End_pts
698       
699// ksPanelBinTypeList = "B;FT;FB;FL;FR;MT;MB;ML;MR;FTB;FLR;MTB;MLR;FLRTB;MLRTB;"
700// 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;"
701// ksBinTrimEndDefault
702
703        // wipe out the "old" global strings
704        gBegPtsStr = ksBinTrimBegDefault
705        gEndPtsStr = ksBinTrimEndDefault
706
707        Variable num, ii,nBeg,nEnd
708        String item,panelStr
709       
710        num = numpnts(PanelNameW)
711        for(ii=0;ii<num;ii+=1)
712                panelStr = PanelNameW[ii]
713                gBegPtsStr = ReplaceNumberByKey(panelStr, gBegPtsStr, Beg_pts[ii],"=",";")
714                gEndPtsStr = ReplaceNumberByKey(panelStr, gEndPtsStr, End_pts[ii],"=",";")
715        endfor
716
717        return(0)
718End
719
720
Note: See TracBrowser for help on using the repository browser.