Changeset 1004


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.

Location:
sans/Dev/trunk/NCNR_User_Procedures/Reduction
Files:
3 edited

Legend:

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

    r901 r1004  
    201201        Wave/T Filenames = $"root:myGlobals:CatVSHeaderInfo:Filenames" 
    202202        Variable lastPoint 
     203         
     204        if(numpnts(w) == 0) 
     205                return(0) 
     206        endif 
     207         
    203208        lastPoint = numpnts(Filenames) 
    204209        InsertPoints lastPoint,numpnts(w),Filenames 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_PatchFiles.ipf

    r1003 r1004  
    438438                Abort "wrong number of checkboxes GetEditedSetVarBoxes()" 
    439439        Endif 
     440         
    440441        //pass all as a text wave - so only one wave has to be passed (conversion 2x, though) 
    441442        //global is set to the changed value when entered. read others directly from the control 
     443         
    442444        //make sure the text label is exactly 60 characters long, to match VAX field length 
    443445        SVAR dum=root:Packages:NIST:VSANS:Globals:Patch:gPS1 
    444         String str60="", junk="junk"  
    445         str60 = PadString(junk,60,0x20) 
    446         if(strlen(dum) <= 60) 
    447                 if(strlen(dum) == 60) 
    448                    str60 = dum 
    449                 else 
    450                    str60 = PadString(dum,60,0x20) 
    451                 Endif 
    452         else 
    453                 //too long, truncate 
    454                 str60[0,59] = dum[0,59] 
    455         Endif 
    456          
    457         wt[0] = str60 
    458          
     446//      String str60="", junk="junk"  
     447//      str60 = PadString(junk,60,0x20) 
     448//      if(strlen(dum) <= 60) 
     449//              if(strlen(dum) == 60) 
     450//                 str60 = dum 
     451//              else 
     452//                 str60 = PadString(dum,60,0x20) 
     453//              Endif 
     454//      else 
     455//              //too long, truncate 
     456//              str60[0,59] = dum[0,59] 
     457//      Endif 
     458//       
     459//      wt[0] = str60 
     460        wt[0] = dum                     //with Nexus, no need to enforce 60 character field 
     461//       
    459462        Variable ii 
    460463        String baseStr="PV" 
  • 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.