Ignore:
Timestamp:
Oct 4, 2010 10:15:08 AM (12 years ago)
Author:
srkline
Message:

Some utility procedures were moved from NSORT to NCNR_Utilities. These changes were previously propogated to ANSTO_Utils, and now are propagated to HFIR and ILL_Util files.

File:
1 edited

Legend:

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

    r710 r750  
    236236// "ABC" returned as an invalid result 
    237237// XXXXSANS_expXX._scan1234_5678.xmp ==> "12345678" 
     238// -- result is an 8-character string 
     239// 
    238240Function/S GetRunNumStrFromFile(item)   //,numposition) 
    239241        String item 
     
    368370End 
    369371 
     372 
     373//make an (N) character string of the run number 
     374//Moved to facility utils 
     375// 
     376// same scheme to get 8-character string as in GetRunNumStrFromFile(item) 
     377// 
     378Function/S RunDigitString(num) 
     379        Variable num 
     380 
     381        String numStr="" 
     382 
     383        //make 8 digit string from run number 
     384        sprintf numStr,"%08u",num 
     385         
     386        if(strlen(numStr) > 8) 
     387                return("") 
     388        else 
     389                return(numstr) 
     390        endif 
     391         
     392End 
     393 
     394//given a filename of a SANS data filename of the form 
     395//TTTTTnnn.SAn_TTT_Txxx 
     396//returns the prefix "TTTTT" as some number of characters 
     397//returns "" as an invalid file prefix 
     398// 
     399// HFIR writes out files with a "prefix" of the following -- since there is really no "prefix"  
     400// like in the VAX scheme: 
     401//                      newFileName = ReplaceString(".xml",textPath[0],"")              //removes 4 chars 
     402//                      newFileName = ReplaceString("SANS",newFileName,"")              //removes 4 more chars = 8 
     403//                      newFileName = ReplaceString("exp",newFileName,"")                       //removes 3 more chars = 11 
     404//                      newFileName = ReplaceString("scan",newFileName,"")              //removes 4 more chars = 15, should be enough? 
     405// 
     406// 
     407// -- so the raw data:          BioSANS_exp9_scan1828_0001.xml 
     408// -- translates to:            Bio_9_1828_0001.AVE      
     409// 
     410// 
     411// NCNR-specifc, does not really belong here - it's a beta procedure used for the 
     412// Combine Files Panel, and I'm not sure of how I'm really going to get this to work properly 
     413// since the .ABS file written is not of the form that NSORT->Set3NSORTFiles(low,med,hi,pref) 
     414// is trying to construct 
     415// 
     416// changed (Oct 2010) the naming for HFIR from ExecuteProtocol to: 
     417//                      newFileName = GetPrefixStrFromFile(textPath[0])+GetRunNumStrFromFile(textPath[0]) 
     418// -- translates to:            BioSANS18280001.AVE 
     419// 
     420Function/S GetPrefixStrFromFile(item) 
     421        String item 
     422        String invalid = ""     //"" is not a valid run prefix, since it's text 
     423        Variable num=-1 
     424         
     425        //find the "dash" 
     426        String runStr="" 
     427        Variable pos = strsearch(item,"_",0) 
     428        if(pos == -1) 
     429                //"dot" not found 
     430                return (invalid) 
     431        else 
     432                //found 
     433                if (pos <=3) 
     434                        //not enough characters 
     435                        return (invalid) 
     436                else 
     437                        runStr = item[0,pos-1] 
     438                        return (runStr) 
     439                Endif 
     440        Endif 
     441End 
     442 
     443 
     444 
    370445//function to test a binary file to see if it is a RAW binary SANS file 
    371446//first checks the total bytes in the file (which for raw data is 33316 bytes) 
Note: See TracChangeset for help on using the changeset viewer.