Ignore:
Timestamp:
Jul 6, 2012 5:29:38 PM (10 years ago)
Author:
srkline
Message:

Added support for reading 4-column data into the 2D reader

Calculation of kappa for ABS now does a specific byte check for ensuring a "good" DIV file. hopefully this will eliminate errors where incorrect DIV files are selected and bad kappa values are generated - and the program thinks (incorrectly) that there is a valid DVI file present, when there really isn't one (and then there is no easy recovery from this)

Added CheckIfDIVData() functions to NCNR_Utils and to FACILITY_Utils, and to other (facility)_Utils

Changed the calls to writing BT5 files after adding so that it could be more easily scripted in the future.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Common/Packages/PlotManager/PlotUtils2D_v40.ipf

    r838 r857  
    9898         
    9999        endif           //8-columns 
    100          
     100 
     101 
     102// the very bad case where users don't supply the error data... 
    101103        if(numCols == 3) 
    102104                // put the names of the 3 loaded waves into local names 
     
    158160         
    159161        endif           //3-columns 
     162 
     163// with 4-columns, assume that they are qx,qy,I, err     
     164        if(numCols == 4) 
     165                // put the names of the 3 loaded waves into local names 
     166                n0 = StringFromList(0, S_waveNames ,";" ) 
     167                n1 = StringFromList(1, S_waveNames ,";" ) 
     168                n2 = StringFromList(2, S_waveNames ,";" ) 
     169                n3 = StringFromList(3, S_waveNames ,";" ) 
     170 
     171                //remove the semicolon AND period from file names 
     172                w0 = CleanupName((S_fileName + "_qx"),0) 
     173                w1 = CleanupName((S_fileName + "_qy"),0) 
     174                w2 = CleanupName((S_fileName + "_i"),0) 
     175                w3 = CleanupName((S_fileName + "_iErr"),0)              //make a name for the error wave, to be generated here 
     176 
     177                String baseStr=w1[0,strlen(w1)-4] 
     178                if(DataFolderExists("root:"+baseStr)) 
     179                                DoAlert 1,"The file "+S_filename+" has already been loaded. Do you want to load the new data file, overwriting the data in memory?" 
     180                                if(V_flag==2)   //user selected No, don't load the data 
     181                                        SetDataFolder root: 
     182                                        KillWaves/Z $n0,$n1,$n2,$n3             // kill the default waveX that were loaded 
     183                                        return          //quits the macro 
     184                                endif 
     185                                SetDataFolder $("root:"+baseStr) 
     186                else 
     187                        NewDataFolder/S $("root:"+baseStr) 
     188                endif 
     189                 
     190                //read in the 18 lines of header (18th line starts w/ ASCII... 19th line is blank) 
     191                Make/O/T/N=18 header 
     192                Variable refnum,ii 
     193                string tmpStr="" 
     194                Open/R refNum  as (path+filename) 
     195                ii=0 
     196                do 
     197                        tmpStr = "" 
     198                        FReadLine refNum, tmpStr 
     199                        header[ii] = tmpStr 
     200                        ii+=1 
     201                while(ii < 18)           
     202                Close refnum             
     203                 
     204                ////overwrite the existing data, if it exists 
     205                Duplicate/O $("root:"+n0), $w0 
     206                Duplicate/O $("root:"+n1), $w1 
     207                Duplicate/O $("root:"+n2), $w2 
     208                Duplicate/O $("root:"+n3), $w3 
     209         
     210        endif           //4-columns      
    160211         
    161212         
Note: See TracChangeset for help on using the changeset viewer.