source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_FileCatalog.ipf @ 1246

Last change on this file since 1246 was 1246, checked in by srkline, 3 years ago

A large number of changes to the size of panels to enable "Laptop Mode" where all of the panels and controls are scaled down so that they fit on screen and are still in correct proportion. For the laptop I'm using for testing, the resolution is 1920x1080. For this, a scaling of 0.7 seems to work. The on/off of the "laptop Mode" is controlled by a checkbox in the preference panel (under the General tab).

There are still more panels to update in the next commit.

  • Property svn:executable set to *
File size: 38.3 KB
RevLine 
[1002]1#pragma rtGlobals=1             // Use modern global access method.
2#pragma version=5.0
[1242]3#pragma IgorVersion = 7.00
[1002]4
5//
[1082]6// UPDATED for VSANS -
[1002]7// June 2016  SRK
[1082]8// more columns + improved handling Jan 2018
9//
[1002]10// included ANSTO sort panel from david m
11//
12
[1082]13// Adding columns to the table now means:
14// 1-Make the wave in V_BuildCatVeryShortTable
15// 2-Declare the wave in V_GetHeaderInfoToWave, and read/fill in the value
16//
[1002]17
[1082]18
[1002]19//
20// TODO
[1044]21// x- clean up and remove all of the references to other facilities, since they will not have VSANS modules
[1082]22// x- add in more appropriate and some missing fields more useful to VSANS (intent, multiple beam centers, etc.)
[1023]23// -- can I make the choice of columns customizable? There are "sets" of columns that are not used for
24//    some experiments (magnetic, rotation, temperature scans, etc.) but are necessary for others.
[1082]25// x- SortColumns operation may be of help in managing the long list of files to sort
[1002]26//
[1073]27// (DONE):
[1002]28// x- clean up the list of files that now accumulates in the RawVSANS folder!!! Everything is there, including
29//    files that are NOT RAW VSANS data (MASK and DIV, but these are HDF)
30// x- WHY -- because if I PATCH anything, then re-run the catalog, the changes are NOT shown, since the
[1023]31//    reader will go to the LOCAL copy first! So maybe I need to clear the folder out before I start the
[1002]32//    file catalog
[1023]33// x- maybe it's a good thing to wipe out the RawVSANS folder before an Experiment SAVE (to save a LOT of
[1002]34//    space on disk and a potentially VERY long save
35// x- see V_CleanOutRawVSANS() in V_Utilities_General for the start of this (this is now called in
36//    V_BuildCatVeryShortTable(), the starting point for generating the table.)
37//
38// NEW for VSANS
39// clear out the folders in the RawVSANS folder, otherwise any changes/patches written to disk
40// will not be read in, the "bad" local copy will be read in.
[1073]41// (DONE)
[1044]42//  x- this *may* be a very slow operation. Warn users. Give them a choice to keep local copies. If
[1002]43//     the "patched" values are written locally too, then maybe the update from disk is not needed.
44//     But typically, I'd like to see that the disk version really did get updated...
[1073]45// x- (NO)make a background task to periodically "kill" a few of the files? maybe too dangerous.
46// x- (NO)change the V_GetHeaderInfoToWave function to allow "refreshing" of a single row, say after
[1034]47//    a file has been patched - then the disk and local copies are in sync
48//
49// -- run a profiler on the catalog to see if there is an obvious place to speed up the process
50//
[1002]51
[1034]52Function catalogProfiler()
53        V_BuildCatVeryShortTable()
54End
[1023]55
[1002]56//
57//      SRK modified 30 JAN07 to include Rotation angle, Temperature, and B-field in the table (at the end)
58//
59
60//**************
61// Vers 1.2 090401
62//
63// Procedures for creating the Catalog listings of the SANS datafiles in the folder
64// specified by catPathName.
65// Header information from each of the dataifles is organized in a table for
66// easy identification of each file. CatVSANSTable is the preferred invocation,
67// although CatVSNotebook and CatNotebook can also be used.
68// Files in the folder that are not RAW SANS data are appended to the end of the listing.
69//**************
70
71//this main procedure does all the work, obtaining the folder path,
72//parsing the filenames in the list and (dispatching) to write out the
73//appropriate information to the growing (table) of data. V_GetHeaderInfoToWave() does the individual reads
74Function V_BuildCatVeryShortTable()
75       
76        Variable err
77        Variable t1 = ticks
78       
79        PathInfo catPathName
80        if(v_flag==0)
81                err = V_PickPath()              //sets the local path to the data (catPathName)
82                if(err)
83                        Abort "no path to data was selected, no catalog can be made - use PickPath button"
84                Endif
85        Endif
[1082]86
87//
88// WaveList will list waves in the order that they were created - so at a first pass,
89// create the waves in the order that I want them in the table.
90// The user can rearrange the columns, but likely won't
91//     
[1002]92        DoWindow/F CatVSANSTable
93       
94        Make/O/T/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames"
95        Make/O/T/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Labels"
96        Make/O/T/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:DateAndTime"
[1082]97        Make/O/T/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent"
98        Make/O/T/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Purpose"
99        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Group_ID"
[1113]100
101        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Lambda"
102        Make/O/T/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:nGuides"
103        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:CntTime"
104
105
106        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Transmission"
107        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Thickness"
108               
[1082]109        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:SDD_F"
110        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:TotCnts_F"
111        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:CntRate_F"     
112       
113        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:SDD_M"
114        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:TotCnts_M"
115        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:CntRate_M"     
116       
117        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:SDD_B"
118        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:TotCnts_B"
119        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:CntRate_B"
120               
[1023]121//      Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:XCenter"
122//      Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:YCenter"
[1082]123
[1002]124        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:NumAttens"
[1082]125        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:MCR"            //added Mar 2008
126        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Pos"            //added Mar 2010
127
[1002]128        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:RotAngle"
129        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Temperature"
130        Make/O/D/N=0 $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Field"
131
132
[1082]133
134
[1002]135        WAVE/T Filenames = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames"
136        WAVE/T Labels = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Labels"
137        WAVE/T DateAndTime = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:DateAndTime"
[1023]138//      WAVE SDD = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:SDD"
[1002]139        WAVE Lambda = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Lambda"
140        WAVE CntTime = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:CntTime"
141        WAVE Transmission = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Transmission"
142        WAVE Thickness = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Thickness"
[1023]143//      WAVE XCenter = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:XCenter"
144//      WAVE YCenter = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:YCenter"
[1002]145
146        WAVE/T nGuides = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:nGuides"
147        WAVE NumAttens = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:NumAttens"
148        WAVE RotAngle = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:RotAngle"
149        WAVE Temperature = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Temperature"
150        WAVE Field = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Field"
151        WAVE MCR = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:MCR"              //added Mar 2008
152        WAVE Pos = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Pos"
[1023]153        WAVE/T Intent = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent"
[1063]154        WAVE/T Purpose = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Purpose"
[1023]155        WAVE Group_ID = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Group_ID"
[1002]156
157       
158        If(V_Flag==0)
159                V_BuildTableWindow()
160                ModifyTable width(root:Packages:NIST:VSANS:CatVSHeaderInfo:Lambda)=40
161                ModifyTable width(root:Packages:NIST:VSANS:CatVSHeaderInfo:CntTime)=50
162                ModifyTable width(root:Packages:NIST:VSANS:CatVSHeaderInfo:Transmission)=40
163                ModifyTable width(root:Packages:NIST:VSANS:CatVSHeaderInfo:Thickness)=40
[1023]164//              ModifyTable width(root:Packages:NIST:VSANS:CatVSHeaderInfo:XCenter)=40
165//              ModifyTable width(root:Packages:NIST:VSANS:CatVSHeaderInfo:YCenter)=40
[1002]166                ModifyTable width(root:Packages:NIST:VSANS:CatVSHeaderInfo:NumAttens)=30
167                ModifyTable width(root:Packages:NIST:VSANS:CatVSHeaderInfo:RotAngle)=50
168                ModifyTable width(root:Packages:NIST:VSANS:CatVSHeaderInfo:Field)=50
169                ModifyTable width(root:Packages:NIST:VSANS:CatVSHeaderInfo:MCR)=50
170
171                ModifyTable width(root:Packages:NIST:VSANS:CatVSHeaderInfo:nGuides)=40
172                ModifyTable width(root:Packages:NIST:VSANS:CatVSHeaderInfo:Pos)=30
173                ModifyTable sigDigits(root:Packages:NIST:VSANS:CatVSHeaderInfo:Pos)=3                   //to make the display look nice, given the floating point values from ICE
174                ModifyTable sigDigits(root:Packages:NIST:VSANS:CatVSHeaderInfo:Lambda)=3                //may not work in all situations, but an improvement
[1023]175//              ModifyTable sigDigits(root:Packages:NIST:VSANS:CatVSHeaderInfo:SDD)=5
[1002]176                ModifyTable trailingZeros(root:Packages:NIST:VSANS:CatVSHeaderInfo:Temperature)=1
177                ModifyTable sigDigits(root:Packages:NIST:VSANS:CatVSHeaderInfo:Temperature)=4
178
179                ModifyTable width(Point)=0              //JUN04, remove point numbers - confuses users since point != run
[1023]180
[1073]181// (DONE)
[1044]182//  x- experimental hook with contextual menu
[1023]183//             
184                SetWindow kwTopWin hook=V_CatTableHook, hookevents=1    // mouse down events
185
[1002]186        Endif
187
188
189// NEW for VSANS
190// clear out the folders in the RawVSANS folder, otherwise any changes/patches written to disk
[1023]191// will not be read in, the "bad" local copy will be read in for any subsequent operations.
[1073]192// (DONE)
[1044]193//  x- this *may* be a very slow operation. Warn users. Give them a choice to keep local copies? If
[1002]194//     the "patched" values are written locally too, then maybe the update from disk is not needed.
195//     But typically, I'd like to see that the disk version really did get updated...
196//
[1003]197        //      V_CleanOutRawVSANS()
198// This will display a progress bar
[1023]199        Variable numToClean
200        numToClean = V_CleanupData_w_Progress(0,1)
[1002]201
[1023]202        Print "Cleaned # files = ",numToClean
203        Print "Cleanup time (s) = ",(ticks - t1)/60.15
204        Variable cleanupTime = (ticks - t1)/60.15
[1002]205
206        //get a list of all files in the folder, some will be junk version numbers that don't exist     
207        String list,partialName,tempName,temp=""
208        list = IndexedFile(catPathName,-1,"????")       //get all files in folder
209        Variable numitems,ii,ok
210       
211        numitems = ItemsInList(list,";")
[1246]212        Variable sc=1
213        NVAR gLaptopMode = root:Packages:NIST:VSANS:Globals:gLaptopMode
214        if(gLaptopMode == 1)
215                sc = 0.7
216        endif
[1002]217       
[1073]218        // show a progress bar for filling the file catalog
219        Variable indefinite=0,useIgorDraw=1
[1246]220        NewPanel /N=ProgressPanel /W=(285*sc,111*sc,739*sc,193*sc)
221        ValDisplay valdisp0,win=ProgressPanel,pos={sc*18,32*sc},size={sc*342,18*sc},limits={0,numitems,0},barmisc={0,0}
[1073]222        ValDisplay valdisp0,win=ProgressPanel,value= _NUM:0
[1246]223        DrawText 20*sc,24*sc,"Refreshing file catalog... Please Wait..."
[1073]224
225        if( indefinite )
226                ValDisplay valdisp0,win=ProgressPanel,mode= 4   // candy stripe
227        else
228                ValDisplay valdisp0,win=ProgressPanel,mode= 3   // bar with no fractional part
229        endif
230        if( useIgorDraw )
231                ValDisplay valdisp0,win=ProgressPanel,highColor=(49535,1000,1000)               //(0,65535,0)
232        endif
[1246]233        Button bStop,win=ProgressPanel,pos={sc*375,32*sc},size={sc*50,20*sc},title="Stop"
[1073]234        DoUpdate /W=ProgressPanel /E=1  // mark this as our progress window
235       
236       
[1002]237        //loop through all of the files in the list, reading CAT/SHORT information if the file is RAW SANS
238        String str,fullName
239        Variable lastPoint
240        ii=0
241       
242        Make/T/O/N=0 notRAWlist
243        do
244       
245                //get current item in the list
246                partialName = StringFromList(ii, list, ";")
247                //get a valid file based on this partialName and catPathName
248                tempName = V_FindValidFilename(partialName)
249               
250               
251                If(cmpstr(tempName,"")==0)              //a null string was returned
252                        //write to notebook that file was not found
253                        //if string is not a number, report the error
254                        if(numtype(str2num(partialName)) == 2)
255                                str = "this file was not found: "+partialName+"\r\r"
256                                //Notebook CatWin,font="Times",fsize=12,text=str
257                        Endif
258                else
259                        //prepend path to tempName for read routine
260                        PathInfo catPathName
261                        FullName = S_path + tempName
262                        //make sure the file is really a RAW data file
263                        ok = V_CheckIfRawData(fullName)
264               
265                        if (!ok)
266                                //write to notebook that file was not a RAW SANS file
267                                lastPoint = numpnts(notRAWlist)
268                                InsertPoints lastPoint,1,notRAWlist
269                                notRAWlist[lastPoint]=tempname
270                        else
271                                //go write the header information to the Notebook
272                                V_GetHeaderInfoToWave(fullName,tempName)
273                        Endif
274                Endif
275                ii+=1
[1073]276               
277                ValDisplay valdisp0,win=ProgressPanel,value= _NUM:ii
278                DoUpdate /W=ProgressPanel
279               
[1002]280        while(ii<numitems)
[1073]281       
282        KillWindow ProgressPanel
283
[1002]284//Now sort them all based on some criterion that may be facility dependent (aim is to order them as collected)
285        V_SortWaves()
[1073]286       
[1002]287//Append the files that are not raw files to the list
288        V_AppendNotRAWFiles(notRAWlist)
289        KillWaves/Z notRAWlist
290//
[1023]291        Print "Total time (s) = ",(ticks - t1)/60.15
[1064]292        Print "Time per raw data file (without cleanup time) (s) = ",( (ticks - t1)/60.15 - cleanupTime)/(numpnts(labels))
[1037]293        // (don't use numpnts(notRawList) to normalize, these aren't all raw data files)
[1002]294        //
295        // clean out again, so that the file SAVE is not slow due to the large experiment size
[1073]296        // (DONE) x- decide if this is really necessary (not necessary at this point)
[1002]297//     
298//      V_CleanOutRawVSANS()
299                       
300                       
301        return(0)
302End
303
[1023]304//
305// TODO:
[1024]306//  this is experimental...not been tested by any users yet
307// -- what else to add to the menu? (MSK and DIV now work)
[1023]308// -- add directly to WORK files?
[1044]309// -- "set" as some special file type, intent, use? (quick "patch" operations)
[1023]310// -- "check" the reduction protocol for completeness?
311//
312// x- seems to not "let go" of a selection (missing the mouse up?)
313//    (possibly) less annoying if I only handle mouseup and present a menu then.
314//
315Function V_CatTableHook(infoStr)
316        String infoStr
317        String event= StringByKey("EVENT",infoStr)
[1144]318       
319        Variable ii
320       
[1023]321//      Print "EVENT= ",event
322        strswitch(event)
323                case "mouseup":
324//                      Variable xpix= NumberByKey("MOUSEX",infoStr)
325//                      Variable ypix= NumberByKey("MOUSEY",infoStr)
326//                      PopupContextualMenu/C=(xpix, ypix) "yes;no;maybe;"
[1144]327                        PopupContextualMenu "Load RAW;Load MSK;Load DIV;-;Send to MRED;"
[1024]328                       
329                        WAVE/T Filenames = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames"
330                        Variable err
[1023]331                        strswitch(S_selection)
332                                case "Load RAW":
333                                        GetSelection table,CatVSANSTable,1
334//                                      Print V_flag, V_startRow, V_startCol, V_endRow, V_endCol
335                                        Print "Loading " + FileNames[V_StartRow]
[1024]336                                        err = V_LoadHDF5Data(FileNames[V_StartRow],"RAW")
[1023]337                                        if(!err)                //directly from, and the same steps as DisplayMainButtonProc(ctrlName)
338                                                SVAR hdfDF = root:file_name                     // last file loaded, may not be the safest way to pass
339                                                String folder = StringFromList(0,hdfDF,".")
340                                               
341                                                // this (in SANS) just passes directly to fRawWindowHook()
[1025]342                                                V_UpdateDisplayInformation("RAW")               // plot the data in whatever folder type
343                                                                                               
[1023]344                                                // set the global to display ONLY if the load was called from here, not from the
345                                                // other routines that load data (to read in values)
346                                                SVAR gLast = root:Packages:NIST:VSANS:Globals:gLastLoadedFile
347                                                gLast = hdfDF
348                                               
349                                        endif
[1144]350                                        break
[1024]351                                       
352                                case "Load MSK":
353                                        GetSelection table,CatVSANSTable,1
354//                                      Print V_flag, V_startRow, V_startCol, V_endRow, V_endCol
355                                        Print "Loading " + FileNames[V_StartRow]
356                                        err = V_LoadHDF5Data(FileNames[V_StartRow],"MSK")
357                                       
[1144]358                                        break
[1024]359                                       
360                                case "Load DIV":
361                                        GetSelection table,CatVSANSTable,1
362//                                      Print V_flag, V_startRow, V_startCol, V_endRow, V_endCol
363                                        Print "Loading " + FileNames[V_StartRow]
364                                        err = V_LoadHDF5Data(FileNames[V_StartRow],"DIV")
365
[1144]366                                        break
367                                case "Send to MRED":
368                                        //
369                                        SVAR/Z numList=root:Packages:NIST:VSANS:Globals:MRED:gFileNumList
370                                        if(SVAR_Exists(numList))
371                                                GetSelection table,CatVSANSTable,1
372                                                for(ii=V_StartRow;ii<=V_endRow;ii+=1)
373        //                                              Print "selected " + FileNames[ii]
374                                                        numList += fileNames[ii] + ","
375                                                endfor
376                                                // pop the menu on the mred panel
377                                                V_MREDPopMenuProc("",1,"")
378                                        endif
379                                        break
[1024]380                                       
381                        endswitch               //popup selection
382        endswitch       // event
383       
[1023]384        return 0
385End
386
387
388
[1002]389//appends the list of files that are not RAW SANS data to the filename wave (1st column)
390//for display in the table. Note that the filenames column will now be longer than all other
391//waves in the table
[1064]392//
393// skip this step if there are no files to tack on
[1002]394Function V_AppendNotRAWFiles(w)
395        Wave/T w
[1064]396        if(numpnts(w) != 0)
397                Wave/T Filenames = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames"
398                Variable lastPoint
399                lastPoint = numpnts(Filenames)
400                InsertPoints lastPoint,numpnts(w),Filenames
401                Filenames[lastPoint,numpnts(Filenames)-1] = w[p-lastPoint]
402        endif
[1002]403        return(0)
404End
405
[1073]406//
[1082]407// this is called BEFORE the notRAWfiles are added to the fileNames wave
408// so that the waves are still all the same length and can properly be sorted.
409//
[1002]410Function V_SortWaves()
[1082]411//      Wave/T GFilenames = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames"
412////    Wave/T GSuffix = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Suffix"
413//      Wave/T GLabels = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Labels"
414//      Wave/T GDateTime = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:DateAndTime"
415////    Wave GSDD = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:SDD"
416//      Wave GLambda = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Lambda"
417//      Wave GCntTime = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:CntTime"
418//      Wave GTotCnts = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:TotCnts"
419//      Wave GCntRate = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:CntRate"
420//      Wave GTransmission = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Transmission"
421//      Wave GThickness = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Thickness"
422////    Wave GXCenter = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:XCenter"
423////    Wave GYCenter = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:YCenter"
424//
425//      Wave/T GNumGuides = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:nGuides"
426//      Wave GNumAttens = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:NumAttens"
427////    Wave GRunNumber = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:RunNumber"
428////    Wave GIsTrans = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:IsTrans"
429//      Wave GRot = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:RotAngle"
430//      Wave GTemp = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Temperature"
431//      Wave GField = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Field"
432//      Wave GMCR = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:MCR"             //added Mar 2008
433//      Wave GPos = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Pos"
434//      Wave/T GIntent = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent"
435//      Wave/T GPurpose = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Purpose"
436//      Wave G_ID = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Group_ID"
437//
438//
439//// DONE
440//// x- the default sort is by SUFFIX, which does not exist for VSANS. So decide on a better key
441////     now, the sort is by FileName by default
442////    Sort GFilenames, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR,GPos,gNumGuides
443//
444//      Sort GFilenames, GFilenames, GLabels, GDateTime,  GIntent, GPurpose, G_ID, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness,   GNumAttens,GRot,GTemp,GField,GMCR,GPos,gNumGuides
[1002]445
[1082]446        SetDataFolder root:Packages:NIST:VSANS:CatVSHeaderInfo:
447       
448        String list = WaveList("*",",","")
449        String cmd
450       
451        list = list[0,strlen(list)-2]           //remove the trailing comma or "invalid column name" error
452       
453        sprintf cmd, "Sort Filenames, %s", list
454//      Print cmd                       // For debugging
455       
456        Execute cmd
457       
458        SetDataFolder root:
[1002]459        return(0)
460End
461
462//function to create the CAT/VSTable to display the header information
463//this table is just like any other table
464Function V_BuildTableWindow()
465
[1082]466        SetDataFolder root:Packages:NIST:VSANS:CatVSHeaderInfo:
467       
468        String list = WaveList("*",",","")
469        String cmd
470       
471        list = list[0,strlen(list)-2]           //remove the trailing comma or "invalid column name" error
472       
473        sprintf cmd, "Edit %s", list
474//      Print cmd                       // For debugging
475       
476        Execute cmd
[1002]477
[1082]478        String name="CatVSANSTable"
479        DoWindow/C $name
480       
481        SetDataFolder root:
482       
483//      Wave/T Filenames = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames"
484//      Wave/T Labels = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Labels"
485//      Wave/T DateAndTime = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:DateAndTime"
486////    Wave SDD = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:SDD"
487//      Wave Lambda = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Lambda"
488//      Wave CntTime = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:CntTime"
489//      Wave TotCnts = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:TotCnts"
490//      Wave CntRate = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:CntRate"
491//      Wave Transmission = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Transmission"
492//      Wave Thickness = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Thickness"
493////    Wave XCenter = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:XCenter"
494////    Wave YCenter = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:YCenter"
495//
496//      Wave/T NumGuides = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:nGuides"
497//      Wave NumAttens = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:NumAttens"
498//      Wave RotAngle =  $"root:Packages:NIST:VSANS:CatVSHeaderInfo:RotAngle"
499//      Wave Temperature = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Temperature"
500//      Wave Field= $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Field"
501//      Wave MCR = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:MCR"              //added Mar 2008
502//      Wave Pos = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Pos"
503//      Wave/T Intent = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent"
504//      Wave/T Purpose = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Purpose"
505//      Wave Group_ID = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Group_ID"
506//
507//// original order, magnetic at the end
508////    Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR as "Data File Catalog"
509//// with numGuides
510////    Edit Filenames, Labels, DateAndTime, SDD, Lambda, numGuides, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR, Pos as "Data File Catalog"
[1002]511
[1082]512//      Edit Filenames, Labels, DateAndTime,  Intent, Purpose, Group_ID, Lambda, numGuides, CntTime, TotCnts, CntRate, Transmission, Thickness, NumAttens, RotAngle, Temperature, Field, MCR, Pos as "Data File Catalog"
[1002]513
[1082]514
[1002]515        return(0)
516End
517
518//reads header information and puts it in the appropriate waves for display in the table.
519//fname is the full path for opening (and reading) information from the file
520//which alreay was found to exist. sname is the file;vers to be written out,
521//avoiding the need to re-extract it from fname.
522Function V_GetHeaderInfoToWave(fname,sname)
523        String fname,sname
524       
525
526        Variable lastPoint,ctime,detcnt,cntrate
527
528        Wave/T GFilenames = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames"
[1023]529//      Wave/T GSuffix = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Suffix"
[1002]530        Wave/T GLabels = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Labels"
531        Wave/T GDateTime = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:DateAndTime"
532
[1082]533        WAVE sdd_f = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:SDD_F"
534        WAVE sdd_m = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:SDD_M"
535        WAVE sdd_b = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:SDD_B"
536
[1002]537        Wave GLambda = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Lambda"
538        Wave GCntTime = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:CntTime"
[1082]539
540        Wave TotCnts_F = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:TotCnts_F"
541        Wave CntRate_F = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:CntRate_F"
542        Wave TotCnts_M = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:TotCnts_M"
543        Wave CntRate_M = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:CntRate_M"
544        Wave TotCnts_B = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:TotCnts_B"
545        Wave CntRate_B = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:CntRate_B"
546       
[1002]547        Wave GTransmission = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Transmission"
548        Wave GThickness = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Thickness"
[1023]549//      Wave GXCenter = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:XCenter"
550//      Wave GYCenter = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:YCenter"
[1002]551        Wave/T GNumGuides = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:nGuides"
552        Wave GNumAttens = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:NumAttens"
[1023]553//      Wave GRunNumber = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:RunNumber"
554//      Wave GIsTrans = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:IsTrans"
[1002]555        Wave GRot = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:RotAngle"
556        Wave GTemp = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Temperature"
557        Wave GField = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Field"
558        Wave GMCR = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:MCR"
559        Wave GPos = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Pos"
[1023]560        Wave/T GIntent = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent"
[1063]561        Wave/T GPurpose = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Purpose"
[1023]562        Wave G_ID = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Group_ID"
[1002]563
564        lastPoint = numpnts(GLambda)
565               
566        //filename
567        InsertPoints lastPoint,1,GFilenames
568        GFilenames[lastPoint]=sname
569       
[1023]570//      //read the file alphanumeric suffix
[1073]571//      // (DONE) x- this does not exist for VSANS - so is there an equivalent, or delete? ((delete))
[1023]572//      InsertPoints lastPoint,1,GSuffix
573//      GSuffix[lastPoint]="unknown"
[1002]574
575        //read the counting time (integer)
576        InsertPoints lastPoint,1,GCntTime
577        ctime = V_getCount_time(fname)
578        GCntTime[lastPoint]=ctime
579       
580        //read the file creation date (string)
581        InsertPoints lastPoint,1,GDateTime
582        GDateTime[lastPoint]=V_getDataStartTime(fname)
583
584        // read the sample.label text field (string)
585        InsertPoints lastPoint,1,GLabels
586        GLabels[lastPoint]=V_getSampleDescription(fname)
587       
588               
589        //read the reals
590        //detector count and (derived) count rate
591        detcnt = V_getDet_IntegratedCount(fname,"FL")
[1082]592        detcnt += V_getDet_IntegratedCount(fname,"FR")
593        detcnt += V_getDet_IntegratedCount(fname,"FT")
594        detcnt += V_getDet_IntegratedCount(fname,"FB")
[1176]595
[1002]596        cntrate = detcnt/ctime
[1082]597        InsertPoints lastPoint,1,TotCnts_F
598        TotCnts_F[lastPoint]=detcnt
599        InsertPoints lastPoint,1,CntRate_F
600        CntRate_F[lastPoint]=cntrate
601
602        detcnt = V_getDet_IntegratedCount(fname,"ML")
603        detcnt += V_getDet_IntegratedCount(fname,"MR")
604        detcnt += V_getDet_IntegratedCount(fname,"MT")
605        detcnt += V_getDet_IntegratedCount(fname,"MB")
[1176]606
[1082]607        cntrate = detcnt/ctime
608        InsertPoints lastPoint,1,TotCnts_M
609        TotCnts_M[lastPoint]=detcnt
610        InsertPoints lastPoint,1,CntRate_M
611        CntRate_M[lastPoint]=cntrate
[1002]612       
[1082]613        detcnt = V_getDet_IntegratedCount(fname,"B")
614        cntrate = detcnt/ctime
615        InsertPoints lastPoint,1,TotCnts_B
616        TotCnts_B[lastPoint]=detcnt
617        InsertPoints lastPoint,1,CntRate_B
618        CntRate_B[lastPoint]=cntrate
619               
620               
[1002]621        //Attenuators
[1073]622        // (DONE) x- this is the "number" of the attenuator
[1002]623        InsertPoints lastPoint,1,GNumAttens
[1053]624        GNumAttens[lastPoint]=V_getAtten_number(fname)
[1002]625       
626        //Transmission
627        InsertPoints lastPoint,1,GTransmission
628        GTransmission[lastPoint]=V_getSampleTransmission(fname)
629       
630        //Thickness
631        InsertPoints lastPoint,1,GThickness
632        GThickness[lastPoint]=V_getSampleThickness(fname)
633
[1023]634//      // TODO --  the x and y center have different meaning, since there are multiple panels
635//      // TODO -- remove the hard-wiring
636//      String detStr = "FL"
637//      //XCenter of beam on detector
638//      InsertPoints lastPoint,1,GXCenter
639//      GXCenter[lastPoint]=V_getDet_beam_center_x(fname,detStr)
640//     
641//      // TODO --  the x and y center have different meaning, since there are multiple panels
642//      //YCenter
643//      InsertPoints lastPoint,1,GYCenter
644//      GYCenter[lastPoint]=V_getDet_beam_center_y(fname,detStr)
[1002]645
[1082]646//       there are multiple distances to report
[1023]647//      //SDD
[1082]648        InsertPoints lastPoint,1,sdd_f
649        sdd_f[lastPoint]=V_getDet_ActualDistance(fname,"FL")
650
651        InsertPoints lastPoint,1,sdd_m
652        sdd_m[lastPoint]=V_getDet_ActualDistance(fname,"ML")
[1002]653       
[1082]654        InsertPoints lastPoint,1,sdd_b
655        sdd_b[lastPoint]=V_getDet_ActualDistance(fname,"B")
656               
[1002]657        //wavelength
658        InsertPoints lastPoint,1,GLambda
659        GLambda[lastPoint]=V_getWavelength(fname)
660       
661        //Rotation Angle
662        InsertPoints lastPoint,1,GRot
663        GRot[lastPoint]=V_getSampleRotationAngle(fname)
664       
665        //Sample Temperature
[1133]666        // this reads sample:temperature which is the average temperature reading (may be affected by noise)
[1002]667        InsertPoints lastPoint,1,GTemp
[1044]668        GTemp[lastPoint]=V_getSampleTemperature(fname)
[1002]669
670        // TODO -- this is not yet implemented
671        //Sample Field
672        InsertPoints lastPoint,1,GField
[1044]673        GField[lastPoint]=-999
[1082]674               
[1002]675        // Monitor Count Rate
676        InsertPoints lastPoint,1,GMCR
[1106]677        GMCR[lastPoint]  = V_getBeamMonNormData(fname)/ctime            //total monitor count / total count time
[1002]678
679
680// number of guides and sample position, only for NCNR (a string now)
681        InsertPoints lastPoint,1,GNumGuides
682        GNumGuides[lastPoint]  = V_getNumberOfGuides(fname)
683
684// TODO -- maybe this is better to convert to a text wave?     
685        //Sample Position (== number position in 10CB)
686        InsertPoints lastPoint,1,GPos
687        GPos[lastPoint] = str2num(V_getSamplePosition(fname))
688
[1023]689// Intent (text)
690        InsertPoints lastPoint,1,GIntent
691        GIntent[lastPoint] = V_getReduction_intent(fname)
[1063]692
693// Purpose (text)
694        InsertPoints lastPoint,1,GPurpose
695        GPurpose[lastPoint] = V_getReduction_purpose(fname)
696               
[1023]697// group_id (sample)
698        InsertPoints lastPoint,1,G_ID
[1034]699        G_ID[lastPoint] = V_getSample_groupID(fname)
[1023]700
[1002]701        return(0)
702End
703
704
705
706// just to call the function to generate the panel
[1024]707Proc V_Catalog_Sort()
[1002]708        V_BuildCatSortPanel()
709End
710
711// [davidm] create CAT Sort-Panel
712function V_BuildCatSortPanel()
713
714        // check if CatVSANSTable exists
715        DoWindow CatVSANSTable
716        if (V_flag==0)
717                DoAlert 0,"There is no File Catalog table. Use the File Catalog button to create one."
718                return 0
719        endif
720       
721        // bring CatSortPanel to front
722        DoWindow/F CatSortPanel
723        if (V_flag != 0)
724                return 0
725        endif
726       
727        print "Creating CAT Sort-Panel..."
[1246]728
729        Variable sc = 1
730       
731        NVAR gLaptopMode = root:Packages:NIST:VSANS:Globals:gLaptopMode
[1002]732               
[1246]733        if(gLaptopMode == 1)
734                sc = 0.7
735        endif
736               
[1002]737        //PauseUpdate
[1246]738        NewPanel /W=(600*sc,360*sc,790*sc,730*sc)/K=1 as "CAT - Sort Panel"
[1002]739        DoWindow/C CatSortPanel
740        ModifyPanel fixedSize=1, cbRGB = (42919, 53970, 60909)
741       
[1246]742        Button SortFilenamesButton,             pos={sc*25, 8*sc},              size={sc*140,24*sc},proc=V_CatVSANSTable_SortProc,title="Filenames"
743        Button SortLabelsButton,                        pos={sc*25,38*sc},              size={sc*140,24*sc},proc=V_CatVSANSTable_SortProc,title="Labels"
744        Button SortDateAndTimeButton,   pos={sc*25,68*sc},              size={sc*140,24*sc},proc=V_CatVSANSTable_SortProc,title="Date and Time"
745        Button SortIntentButton,                        pos={sc*25,98*sc},              size={sc*140,24*sc},proc=V_CatVSANSTable_SortProc,title="Intent"
746        Button SortPurposeButton,               pos={sc*25,128*sc},     size={sc*140,24*sc},proc=V_CatVSANSTable_SortProc,title="Purpose"
747        Button SortIDButton,                    pos={sc*25,158*sc},     size={sc*140,24*sc},proc=V_CatVSANSTable_SortProc,title="Group ID"
748        Button SortLambdaButton,                        pos={sc*25,188*sc},     size={sc*140,24*sc},proc=V_CatVSANSTable_SortProc,title="Lambda"
749        Button SortCountTimButton,              pos={sc*25,218*sc},     size={sc*140,24*sc},proc=V_CatVSANSTable_SortProc,title="Count Time"
750        Button SortSDDFButton,          pos={sc*25,248*sc},     size={sc*140,24*sc},proc=V_CatVSANSTable_SortProc,title="SDD F"
751        Button SortCountRateFButton,            pos={sc*25,278*sc},     size={sc*140,24*sc},proc=V_CatVSANSTable_SortProc,title="Count Rate F"
752        Button SortMonitorCountsButton, pos={sc*25,308*sc},     size={sc*140,24*sc},proc=V_CatVSANSTable_SortProc,title="Monitor Counts"
753        Button SortTransmissionButton,  pos={sc*25,338*sc},     size={sc*140,24*sc},proc=V_CatVSANSTable_SortProc,title="Transmission"
[1002]754
755end
756
757Proc V_CatVSANSTable_SortProc(ctrlName) : ButtonControl // added by [davidm]
758        String ctrlName
759       
760        // check if CatVSANSTable exists
761        DoWindow CatVSANSTable
762        if (V_flag==0)
763                DoAlert 0,"There is no File Catalog table. Use the File Catalog button to create one."
764                return
765        endif
766               
767        // have to use function
768        V_CatVSANSTable_SortFunction(ctrlName)
769       
770end
771
772function V_CatVSANSTable_SortFunction(ctrlName) // added by [davidm]
773        String ctrlName
774
[1082]775// still need to declare these to access notRaw files and to get count of length
[1002]776        Wave/T GFilenames = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames"
777        Wave/T GLabels = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Labels"
778
[1082]779//      Wave/T GDateTime = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:DateAndTime"
780////    Wave GSDD = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:SDD"
781//      Wave GLambda = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Lambda"
782//      Wave GCntTime = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:CntTime"
783//      Wave GTotCnts = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:TotCnts"
784//      Wave GCntRate = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:CntRate"
785//      Wave GTransmission = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Transmission"
786//      Wave GThickness = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Thickness"
787////    Wave GXCenter = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:XCenter"
788////    Wave GYCenter = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:YCenter"
789//      Wave/T GNumGuides = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:nGuides"
790//      Wave GNumAttens = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:NumAttens"
791////    Wave GRunNumber = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:RunNumber"
792////    Wave GIsTrans = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:IsTrans"
793//      Wave GRot = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:RotAngle"
794//      Wave GTemp = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Temperature"
795//      Wave GField = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Field"
796//      Wave GMCR = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:MCR"
797//      Wave GPos = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Pos"
798//      Wave/T GIntent = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent"
799//      Wave/T GPurpose = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Purpose"
800//      Wave G_ID = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Group_ID"
801
[1002]802       
803        // take out the "not-RAW-Files"
804        Variable fileCount = numpnts(GFilenames)
805        Variable rawCount = numpnts(GLabels)
806        Variable notRAWcount = fileCount - rawCount
807       
808        if (notRAWcount > 0)
809                Make/T/O/N=(notRAWcount) notRAWlist
810                notRAWlist[0, notRAWcount-1] = GFilenames[p+rawCount]
811                DeletePoints rawCount, notRAWcount, GFilenames
812        endif
[1082]813
814
815// get the list
816        SetDataFolder root:Packages:NIST:VSANS:CatVSHeaderInfo:
[1002]817       
[1082]818        String list = WaveList("*",",",""),sortKey=""
819        String cmd
820       
821        list = list[0,strlen(list)-2]           //remove the trailing comma or "invalid column name" error
822       
823// set the sortKey string       
[1002]824        strswitch (ctrlName)
825       
826                case "SortFilenamesButton":
[1023]827//                      Sort GFilenames, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR
[1082]828//                      Sort GFilenames,  GPurpose, GFilenames, GLabels, GDateTime,  GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness,   GNumAttens,   GRot, GTemp, GField, GMCR, GIntent, G_ID
829                        sortKey = "Filenames"
[1002]830                        break
831                       
832                case "SortLabelsButton":
[1023]833//                      Sort GLabels, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR
[1082]834//                      Sort GLabels,  GPurpose, GFilenames, GLabels, GDateTime,  GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness,   GNumAttens,   GRot, GTemp, GField, GMCR, GIntent, G_ID
835                        sortKey = "Labels"
[1002]836                        break
837                       
838                case "SortDateAndTimeButton":
[1023]839//                      Sort GDateTime, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR
[1082]840//                      Sort GDateTime,  GPurpose, GFilenames, GLabels, GDateTime,  GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness,   GNumAttens,   GRot, GTemp, GField, GMCR, GIntent, G_ID
841                        sortKey = "DateAndTime"
[1023]842
[1002]843                        break
844                       
[1023]845                case "SortIntentButton":
[1082]846//                      Sort GIntent,  GPurpose, GFilenames, GLabels, GDateTime,  GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness,   GNumAttens,   GRot, GTemp, GField, GMCR, GIntent, G_ID
847                        sortKey = "Intent"
848
[1002]849                        break
850                       
[1023]851                case "SortIDButton":
[1082]852//                      Sort G_ID,  GPurpose, GFilenames, GLabels, GDateTime,  GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness,   GNumAttens,   GRot, GTemp, GField, GMCR, GIntent, G_ID
853                        sortKey = "Group_ID"
854
[1002]855                        break
856                       
857                case "SortLambdaButton":
[1023]858//                      Sort GLambda, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR
[1082]859//                      Sort GLambda,  GPurpose, GFilenames, GLabels, GDateTime,  GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness,   GNumAttens,   GRot, GTemp, GField, GMCR, GIntent, G_ID
860                        sortKey = "Lambda"
[1023]861
[1002]862                        break
863                       
864                case "SortCountTimButton":
[1023]865//                      Sort GCntTime, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR
[1082]866//                      Sort GCntTime,  GPurpose, GFilenames, GLabels, GDateTime,  GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness,   GNumAttens,   GRot, GTemp, GField, GMCR, GIntent, G_ID
867                        sortKey = "CntTime"
[1023]868
[1002]869                        break
870                       
[1148]871                case "SortSDDFButton":
[1023]872//                      Sort GTotCnts, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR
[1082]873//                      Sort GTotCnts,  GPurpose, GFilenames, GLabels, GDateTime,  GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness,   GNumAttens,   GRot, GTemp, GField, GMCR, GIntent, G_ID
[1148]874                        sortKey = "SDD_F"
[1023]875
[1002]876                        break
877                       
[1148]878                case "SortCountRateFButton":
[1023]879//                      Sort GCntRate, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR
[1082]880//                      Sort GCntRate,  GPurpose, GFilenames, GLabels, GDateTime,  GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness,   GNumAttens,   GRot, GTemp, GField, GMCR, GIntent, G_ID
[1148]881                        sortKey = "CntRate_F"
[1023]882
[1002]883                        break
884                       
885                case "SortMonitorCountsButton":
[1105]886                        sortKey = "MCR"
887
[1002]888                        break
889                       
890                case "SortTransmissionButton":
[1023]891//                      Sort GTransmission, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR
[1082]892//                      Sort GTransmission,  GPurpose, GFilenames, GLabels, GDateTime,  GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness,   GNumAttens,   GRot, GTemp, GField, GMCR, GIntent, G_ID
893                        sortKey = "Transmission"
[1023]894
[1002]895                        break
896                       
[1063]897                case "SortPurposeButton":
[1023]898//                      Sort GThickness, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR
[1082]899//                      Sort GPurpose,  GPurpose, GFilenames, GLabels, GDateTime,  GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness,   GNumAttens,   GRot, GTemp, GField, GMCR, GIntent, G_ID
900                        sortKey = "Purpose"
[1023]901
[1002]902                        break
903       
904        endswitch
905       
[1082]906        //do the sort
[1148]907//      sprintf cmd, "Sort %s, %s", sortKey,list
908// use braces and second key to keep anything with the same first "key" value in numerical run number order
909        sprintf cmd, "Sort {%s,Filenames} %s", sortKey,list
[1082]910//      Print cmd                       // For debugging
911       
912        Execute cmd
913       
914       
[1002]915        // insert the "not-RAW-Files" again
916        if (notRAWcount > 0)
917                InsertPoints rawCount, notRAWcount, GFilenames
918                GFilenames[rawCount, fileCount-1] = notRAWlist[p-rawCount]
919        endif
[1082]920       
921        SetDataFolder root:
922
[1063]923end
924
Note: See TracBrowser for help on using the repository browser.