Ignore:
Timestamp:
Mar 16, 2010 5:50:17 PM (13 years ago)
Author:
srkline
Message:

A variety of changes to get some of the basic reduction functions working with HFIR raw data files.

Patch now works correctly without duplicating file names in the popup list.

Transmissions can be assigned and calculated now that I've changed the critera for deciding if a file is a transmission file. Hopefully this will always work - it's based on the beamstop y-position being less than 30 mm for all four beam stops.

When checking for a DIV file, it returns an OK if the extension is .xml, since the raw data and div files can't be distinguished like the binary VAX data.

The file catalog is correct, but still excruciatingly slow.

File:
1 edited

Legend:

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

    r572 r641  
    5050        Endif 
    5151         
     52        Variable t1=ticks 
    5253         
    5354        variable error 
     
    8990        KillWaves/Z M_listAttr, nsList,W_xmlcontentnodes 
    9091         
     92        Print "Time to load and display (s) = ",(ticks-t1)/60.15 
    9193        Return(0)               //Do not change. 
    9294End 
     
    127129        //Open/R refNum as fname 
    128130        STRING/G errorMsg        
    129         Variable refNum 
     131        Variable refNum,t1=ticks 
    130132        //print "Loading", filename, "..."       
    131133        if (stringmatch(filename,"*.xml") <1) 
     
    216218        //data =0 
    217219         
     220//      Print "Time to open (s) = ",(ticks-t1)/60.15 
    218221 
    219222        //ORNL HFIR SANS DATA 
    220223        String tempheadhfir 
    221224        tempheadhfir = "" 
    222        ReadHFIRSansRaw(refNum,curFolder,tempheadhfir)  
     225         
     226        ReadHFIRSansRaw(refNum,curFolder,tempheadhfir)  
    223227        
    224        i=0 
    225        do        
    226         //Take the file name from "actual file name", not from the header: (JC found some cases that those are different.) 
    227         //This DOLOOP can be removed where the problem is solved.... 
    228         textw[0]=stringfromlist(i,filename,":")  
    229         if (stringmatch(textw[0],"*.xml")>0)                     
    230                 break 
    231         endif 
    232         i +=1 
    233        while (1) 
     228        i=0 
     229        do       
     230                //Take the file name from "actual file name", not from the header: (JC found some cases that those are different.) 
     231                //This DOLOOP can be removed where the problem is solved.... 
     232                textw[0]=stringfromlist(i,filename,":")  
     233                if (stringmatch(textw[0],"*.xml")>0)                     
     234                        break 
     235                endif 
     236                i +=1 
     237        while (1) 
    234238         
    235239        //return the data folder to root 
     
    605609                return 0                                //Not a xml file. Do nothing... 
    606610        endif 
    607  
     611         
    608612        //ORNL HFIR SANS strings meta DATA 
    609613       vresult=ReadVFromHHead(refNum,wantedterm,unit)  
    610          
     614        
    611615        //return the data folder to root 
    612616        //SetDataFolder root: 
     
    641645        String fname 
    642646         
    643         return(getRealValueFromHeader(fname,"attenuation","percent")) //in unit od percents 
     647        return(getRealValueFromHeader(fname,"attenuation","percent")) //in unit of percents 
    644648end 
    645649 
     
    989993//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
    990994Function ReadHFIRSansRaw(refNum,curFolder,tempheadhfir) 
    991       Variable refNum 
    992       String curFolder,tempheadhfir 
     995        Variable refNum 
     996        String curFolder,tempheadhfir 
    993997       
    994       String curPath="root:Packages:NIST:"+curFolder 
    995       SetDataFolder curPath 
     998        String curPath="root:Packages:NIST:"+curFolder 
     999        SetDataFolder curPath 
    9961000        Make/O/N=23 $(curPath+":IntegersRead") 
    9971001        Make/O/N=52 $(curPath+":RealsRead") 
     
    10051009        Variable pixnumx=0,pixnumy=0 
    10061010        String val = ""// numerical and text values 
    1007         Variable value 
     1011        Variable value,t1=ticks 
    10081012 
    10091013        //Initialize wave values          
     
    10431047                endfor     
    10441048        //endif 
    1045          
     1049//      Print "Time to list attributes (s) = ",(ticks-t1)/60.15 
    10461050         
    10471051        XMLelemlist(refNum) 
    10481052        WAVE/T W_ElementList 
     1053//      Print "Time to list elements (s) = ",(ticks-t1)/60.15 
    10491054 
    10501055        for (ind = 0; ind<DimSize(W_ElementList,0); ind +=1) 
     
    11791184                 
    11801185       endfor 
    1181  
     1186        
     1187//      Print "Time to loop over elements (s) = ",(ticks-t1)/60.15 
     1188 
     1189       //If the data is a sensitivity scan, normalize so that the average =1. 
     1190       print curFolder 
     1191        if (stringmatch(curFolder,"DIV") >0) 
     1192                WaveStats/Z/Q data 
     1193                data /= V_avg 
     1194        endif 
    11821195        //keep a string with the filename in the RAW folder 
    11831196         
     
    12131226         
    12141227        SetDataFolder curPath 
    1215         Killwaves/Z nsList,M_listAttr,M_xmlContent,W_ElementList,M_listXPath,W_xmlcontentnodes 
     1228         
     1229//      Print "Time to exit reader (s) = ",(ticks-t1)/60.15 
     1230                 
     1231//      Killwaves/Z nsList,M_listAttr,M_xmlContent,W_ElementList,M_listXPath,W_xmlcontentnodes 
     1232        return(0) 
     1233         
    12161234End 
    12171235 
Note: See TracChangeset for help on using the changeset viewer.