Ignore:
Timestamp:
Jul 2, 2013 2:38:09 PM (10 years ago)
Author:
srkline
Message:

Changes to the panel sizes to accommodate smaller screens on laptops. Resized some panels and reorganized some of the controls. Help files have been updated to reflect these changes.

Added function to rename raw data files by copying file on disk, then writing in the new file number to the header. Solves the ICE problem of duplicated run numbers. In NCNR_DataReadWrite. See RenumberRunNumber?

Added new functions to the EventModeProcessing? to split large files (stream mode) and decimate when they are read back in. Added features to the event editing to automatically detect steps, and to show the differential with the data. Panel has improved layout. Still in the beta phase with these new features.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_DataReadWrite.ipf

    r886 r916  
    19451945// 
    19461946// seems to work correctly byte for byte 
    1947 // compression has bee implmented also, for complete replication of the format (n>32767 in a cell) 
     1947// compression has been implmented also, for complete replication of the format (n>32767 in a cell) 
    19481948// 
    19491949// SRK 29JAN09 
     
    31113111 
    31123112////////end of ProDiv() specifics 
     3113 
     3114 
     3115// JUL 2013 
     3116// Yet another fix for an ICE issue. Here the issue is when the run number gets "magically" 
     3117// reset during an experiment. Then there are duplicate run numbers. When procedures key on the run number, 
     3118// the *first* file in the OS file listing is the one that's found. Simply renaming the file with a  
     3119// different number is not sufficient, as the file name embedded in the header must be used (typically from 
     3120// marquee operations) where there is a disconnect between the file load and the function - leading to  
     3121// cases where the current data is "unknown", except for textRead. 
     3122// 
     3123// Hence more patching procedures to re-write files with new file names in the header and the OS. 
     3124// 
     3125Proc RenumberRunNumber(add) 
     3126        Variable add 
     3127 
     3128        fRenumberRunNumber(add) 
     3129 
     3130End 
     3131 
     3132Proc CheckFileNames(firstFile,lastFile) 
     3133        Variable firstFile=1,lastFile=100 
     3134         
     3135        fCheckFileNames(firstFile,lastFile) 
     3136End 
     3137 
     3138 
     3139// will read the 21 character file name and put any spaces at the front of the string 
     3140// like the VAX does. Should have absolutely no effect if there are spaces at the 
     3141// beginning of the string, as the VAX does. 
     3142Function fRenumberRunNumber(add) 
     3143        Variable add 
     3144         
     3145        Variable ii,numItems 
     3146        String item,runStr,list 
     3147        String curFile,newRunStr,newFileStr 
     3148        String pathStr 
     3149        PathInfo catPathName 
     3150        pathStr = S_path 
     3151         
     3152// get a list of all of the files in the folder 
     3153        list = IndexedFile(catPathName,-1,"????")       //get all files in folder 
     3154        numItems = ItemsInList(list,";")                //get the new number of items in the list 
     3155 
     3156// for each file 
     3157        for(ii=0;ii<numItems;ii+=1) 
     3158                curFile = StringFromList(ii, list  ,";" ) 
     3159                runStr = GetRunNumStrFromFile(curFile) 
     3160                 
     3161                if(cmpstr(runStr,"ABC") != 0)           // weed out error if run number can't be found 
     3162                        newRunStr = num2str( str2num(runStr) + add ) 
     3163                        newFileStr = ReplaceString(runStr, curFile, newRunStr ) 
     3164                // change the file name on disk to have a new number (+add) 
     3165                        Printf "Old = %s\t\tNew = %s\r",curFile,newFileStr 
     3166                         
     3167                // copy the file, saving with the new name 
     3168                        CopyFile/I=0/O/P=catPathName curFile as newFileStr 
     3169                         
     3170                // change the run number in the file header to have the new number (writing just the necessary characters) 
     3171                        WriteTextToHeader(pathStr+newFileStr,newRunStr,7)               //start at byte 7 
     3172                endif 
     3173                                         
     3174        endfor 
     3175         
     3176        return(0) 
     3177End 
     3178 
     3179// simple utility to read the file name stored in the file header (and the suffix) 
     3180Function fCheckFileNames(lo,hi) 
     3181        Variable lo,hi 
     3182         
     3183        String file,fileName,suffix,fileInHdr,fileOnDisk 
     3184        Variable ii 
     3185         
     3186        for(ii=lo;ii<=hi;ii+=1) 
     3187                file = FindFileFromRunNumber(ii) 
     3188                if(strlen(file) != 0) 
     3189                        fileOnDisk = ParseFilePath(0, file, ":", 1, 0) 
     3190                        fileInHdr = getFileName(file) 
     3191//                      suffix = getSuffix(file) 
     3192                        printf "File %d:  File on disk = %s\t\tFile in Hdr = %s\r",ii,fileOnDisk,fileInHdr 
     3193                else 
     3194                        printf "run number %d not found\r",ii 
     3195                endif 
     3196        endfor 
     3197         
     3198        return(0) 
     3199End 
     3200 
Note: See TracChangeset for help on using the changeset viewer.