Ignore:
Timestamp:
Jul 22, 2009 5:04:51 PM (13 years ago)
Author:
srkline
Message:

Changed T-Wide calculation to be normalized to the monitor counts, hopefully to avoid oddities of MCR fluctuations.

Also handle the case where data greater than 2 degrees is not present. in this case, a warning is presented, and the last 4 points are used, whatever the angles are.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/BT5_Loader.ipf

    r404 r540  
    190190// error value of 1 is returned and wavenote not updated if level is not found 
    191191//  
     192// now normalizes to the monitor counts 
    192193// 
    193194Function FindTWideCts(type) 
     
    196197        SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 
    197198         
    198         Variable levNotFound,levPt,Cts,num,ii 
     199        Variable levNotFound,levPt,Cts,num,ii,sumMonCts 
     200         
    199201        Wave angle = $(USANSFolder+":"+type+":Angle") 
    200202        Wave detCts = $(USANSFolder+":"+type+":DetCts") 
    201203        Wave TransCts = $(USANSFolder+":"+type+":TransCts") 
     204        Wave monCts = $(USANSFolder+":"+type+":MonCts") 
     205         
     206        num=numpnts(TransCts) 
     207 
     208 
    202209        FindLevel/Q/P angle,2           //use angles greater than 2 deg 
    203210        levNotFound=V_Flag              //V_Flag==1 if no pk found 
     211         
    204212        if(levNotFound) 
    205                 return(1) 
     213                //post a warning, and use just the last 4 points... 
     214                DoAlert 0,"You don't have "+type+" data past 2 degrees - so Twide may not be reliable" 
     215                levPt = num-4 
     216        else 
     217                levPt = trunc(V_LevelX)         // in points, force to integer 
    206218        endif 
    207         levPt = trunc(V_LevelX)         // in points, force to integer 
    208219         
    209220        //average the trans cts from levPt to the end of the dataset 
    210         num=numpnts(TransCts) 
    211221        Cts=0 
     222        sumMonCts=0 
     223         
    212224        for(ii=levPt;ii<num;ii+=1) 
    213225                Cts += transCts[ii] 
     226                sumMonCts += monCts[ii] 
    214227        endfor 
     228        // get the average over that number of data points 
     229        sumMonCts /= (num-levPt-1) 
    215230        Cts /= (num-levPt-1) 
    216231         
     232//      Print "cts = ",cts 
     233//      Print "sumMoncts = ",sumMoncts 
     234         
     235        //normalize to the average monitor counts 
     236        Cts /= sumMonCts 
     237         
     238//      Print "normalized counts = ",cts 
     239 
     240 
    217241        //update the note 
    218242        Wave DetCts = $(USANSFolder+":"+type+":DetCts") 
     
    222246        Note/K DetCts 
    223247        Note detCts,str 
    224          
     248 
    225249        return(0) 
    226250End 
Note: See TracChangeset for help on using the changeset viewer.