Ignore:
Timestamp:
Jul 11, 2016 2:59:08 PM (6 years ago)
Author:
srkline
Message:

changes to handle an arbitrary run number, rather than insisting on 3 or 4 digits.

fix to SANS file catalog where the last file name was cleared from the table, if there are no extra non-raw data files present. not a typical case, but it can happen.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Utilities_General.ipf

    r1003 r1004  
    504504//filtered out. 
    505505// 
     506// 
     507// -- with the run numbers incrementing from 1, there is no need to add leading zeros to the 
     508//    file names. simply add the number and go. 
     509// 
    506510// called by Buttons.ipf and Transmission.ipf, and locally by parsing routines 
    507511// 
     
    510514         
    511515        String fullName="",partialName="",item="" 
    512         //get list of raw data files in folder that match "num" (add leading zeros) 
    513         if( (num>9999) || (num<=0) ) 
    514                 Print "error in  FindFileFromRunNumber(num), file number too large or too small" 
    515                 Return ("") 
    516         Endif 
    517         //make a four character string of the run number 
     516        //get list of raw data files in folder that match "num" 
     517//      if( (num>9999) || (num<=0) ) 
     518//              Print "error in  FindFileFromRunNumber(num), file number too large or too small" 
     519//              Return ("") 
     520//      Endif 
    518521        String numStr="" 
    519         if(num<10) 
    520                 numStr = "000"+num2str(num) 
    521         else 
    522                 if(num<100) 
    523                         numStr = "00"+num2str(num) 
    524                 else 
    525                         if(num<1000) 
    526                                 numstr = "0"+num2str(num) 
    527                         else 
    528                                 numStr = num2str(num) 
    529                         endif 
    530                 Endif 
    531         Endif 
     522        numStr = num2str(num) 
     523//      if(num<10) 
     524//              numStr = "000"+num2str(num) 
     525//      else 
     526//              if(num<100) 
     527//                      numStr = "00"+num2str(num) 
     528//              else 
     529//                      if(num<1000) 
     530//                              numstr = "0"+num2str(num) 
     531//                      else 
     532//                              numStr = num2str(num) 
     533//                      endif 
     534//              Endif 
     535//      Endif 
    532536        //Print "numstr = ",numstr 
    533537         
     
    636640//given a filename of a VSANS data filename of the form 
    637641// sansNNNN.nxs.ngv 
    638 //returns the run number "NNNN" as a STRING of FOUR characters 
     642//returns the run number "NNNN" as a STRING of (x) characters 
     643// 
     644// -- the run number incements from 1, so the number of digits is UNKNOWN 
     645// -- number starts at position [4] (the 5th character) 
     646// -- number ends with the character prior to the first "." 
     647// 
    639648//returns "ABCD" as an invalid file number 
    640649// 
     
    654663                return (invalid) 
    655664        else 
    656                 //found, get the four characters preceeding it 
    657                 if (pos <= numChar-1) 
     665                //found, get the characters preceeding it, but still after the "sans" characters 
     666                if (pos-1 <= 4) 
    658667                        //not enough characters 
    659668                        return (invalid) 
    660669                else 
    661                         runStr = item[pos-numChar,pos-1] 
     670                        runStr = item[4,pos-1] 
    662671                        return (runStr) 
    663672                Endif 
Note: See TracChangeset for help on using the changeset viewer.