Ignore:
Timestamp:
Apr 4, 2011 11:12:38 AM (12 years ago)
Author:
srkline
Message:

Lots of changes:
-2D resolution smearing
-2D error propagation

1) 2D resolution smearing has been corrected to use sigma (perp) correctly
rather than phi. This shows up in the quadrature loop in all of the 2D models
and in the Smear_2D "generic" function.

2) 1D resolutionn smearing is now corrected to account for the integration
range of +/- 3 sigma (99.73% of distribution). Now the result is divided by
0.9973 to rescale it to the correct value.

3) Smeared models are now AAO to improve speed and to allow easier use with
functions that are inherently AAO. No changes are needed, since the call is
behind the scenes, replacing Smear_Model_N() with Smear_Model_N_AAO().

4) in PlotUtils_2D added functions to re-bin the QxQy? data into a 1D format
BinQxQy_to_1D(). This also re-bins the errors in two ways, adding the per-pixel
errors in quadrature, or the deviation from the mean of the intensity. Manually
editing the intensity declaration allows 2D->1D binning of smeared models.

5) Per-pixel propagation of errors has been added through the entire data
reduction sequence. Data errors are generated on loading using Poisson
statistics (specifically tailored for accuracy at low counts) and then is
propagated through each manipulation of the data using standard error
propagation. The error matrix is linear_data_error. As a by-product, all of
the math operations on data are explicitly done on linear_data, to avoid
any potential mistakes of log/linear scaling. Results of this propagation
largely match J. Barker's /ERROR routines from the VAX, with some differences
at low data count values (as expected) and at higher count values near the
beam stop (somewhat unexpected). This per-pixel error is ouput in the QxQy_ASCII
data files. NO CHANGE has been made to the 1D data, which uses the deviation from
the mean as the error - since this is correct.

6) Added tables for the uncertainty in attenuator transmission (from JGB)

7) added two more REAL values to the VAX header to store information
necessary for error propagation. These are couting error that are part of
the transmission error and of the absolute scaling error. These add Read/Write?
functions in NCNR_DataReadWrite

The transmission error (one standard deviation) is written at byte 396 (4 bytes)

RealsRead?[41]

The Box Sum error (one standard deviation) is written at byte 400 (4 bytes)

RealsRead?[42]

File:
1 edited

Legend:

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

    r762 r794  
    419419        //labelWave[19] = "ASCII data created " +date()+" "+time() 
    420420        PathInfo catPathName 
    421         String sfPath = S_Path+StringFromList(0,samfiles,";") 
     421        String sfPath = S_Path+RemoveAllSpaces(StringFromList(0,samfiles,";"))          //make sure there are no leading spaces in the file name 
    422422        print sfPath 
    423423        labelWave[19] = "RAW SAM FILE "+StringFromList(0, samfiles  , ";")+ " TIMESTAMP: "+getFileCreationDate(sfPath) 
     
    675675         
    676676        Wave data=$(destStr+typeStr) 
     677        Wave data_err=$(destStr+":linear_data_error") 
    677678        WAVE intw=$(destStr + ":integersRead") 
    678679        WAVE rw=$(destStr + ":realsRead") 
     
    691692        If(!(WaveExists(data))) 
    692693                Abort "data DNExist QxQy_Export()" 
     694        Endif 
     695        If(!(WaveExists(data_err))) 
     696                Abort "linear data error DNExist QxQy_Export()" 
    693697        Endif 
    694698        If(!(WaveExists(intw))) 
     
    813817//********************* 
    814818 
    815         // generate my own error wave for I(qx,qy) 
    816         Duplicate/O z_val sw 
    817         sw = sqrt(z_val)                //assumes Poisson statistics for each cell (counter) 
    818         //      sw = 0.05*sw            // uniform 5% error? tends to favor the low intensity too strongly 
    819         // get rid of the "bad" errorsby replacing the NaN, Inf, and zero with V_avg 
    820         // THIS IS EXTREMEMLY IMPORTANT - if this is not done, there are some "bad" values in the  
    821         // error wave (things that are not numbers) - and this wrecks the smeared model fitting. 
    822         // It appears to have no effect on the unsmeared model. 
    823         WaveStats/Q sw 
    824         sw = numtype(sw[p]) == 0 ? sw[p] : V_avg 
    825         sw = sw[p] != 0 ? sw[p] : V_avg 
    826          
     819//      // generate my own error wave for I(qx,qy) 
     820//      Duplicate/O z_val sw 
     821//      sw = sqrt(z_val)                //assumes Poisson statistics for each cell (counter) 
     822//      //      sw = 0.05*sw            // uniform 5% error? tends to favor the low intensity too strongly 
     823//      // get rid of the "bad" errorsby replacing the NaN, Inf, and zero with V_avg 
     824//      // THIS IS EXTREMEMLY IMPORTANT - if this is not done, there are some "bad" values in the  
     825//      // error wave (things that are not numbers) - and this wrecks the smeared model fitting. 
     826//      // It appears to have no effect on the unsmeared model. 
     827//      WaveStats/Q sw 
     828//      sw = numtype(sw[p]) == 0 ? sw[p] : V_avg 
     829//      sw = sw[p] != 0 ? sw[p] : V_avg 
     830         
     831        // now use the properly propagated 2D error 
     832        Duplicate/O data_err sw 
     833        Redimension/N=(pixelsX*pixelsY) sw 
     834 
     835 
    827836 
    828837        //not demo-compatible, but approx 8x faster!!    
Note: See TracChangeset for help on using the changeset viewer.