Ignore:
Timestamp:
Jun 16, 2010 2:10:47 PM (12 years ago)
Author:
srkline
Message:

SA_Includes_v410 : now include Smear_2D

PeakGauss_2D, Sphere_2D : included threaded resolution smearing calculations for testing

DataSetHandling? : Included a quick and dirty batch converter for XML->6-col. See the top
of the file for the command to run

GaussUtils? : re-define the ResSemear_2D_AAOStruct. Relocated q-value and phi calculations from
RawWindowHook? to this file so they would be available for reduction and analysis

Smear_2D : now has a generic (non-threaded) smearing routine. Threading must be done in
individual functions since FUNCREF can't be passed to threads (plus a few other issues)

PlotUtils_2D : updated loader for new QxQy? columns. Fixes to Wrapper_2D to enable smeared fits

RawWindowHook? : removed Q-value calculation functions and moved these to GaussUtils?

WriteQIS : now writes out 8-columns for QxQy? data, defining the resolution
function in terms of directions parallel and perpendicular to Q. TEMPORARILY in the data
file an error in intensity is generated that is SQRT(I), being careful to
replace any NaN, inf, or zero with an average error value

MultiScatter_MonteCarlo_2D : 4-processor aware

NCNR_Utils : 2D resolution calculation is now in terms of parallel and perpendicular
rather than x and y. Gravity is included in the y-component

File:
1 edited

Legend:

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

    r703 r708  
    641641 
    642642// NEW additions - May 2009 
    643 //ASCII export of data as 7-columns qx-qy-Intensity-qz-sigmaQx-sigmaQy-fShad 
     643//ASCII export of data as 7-columns qx-qy-Intensity-qz-sigmaQ_parall-sigmaQ_perp-fShad 
    644644//limited header information? 
    645645// 
     
    649649// -- when the Qz and resolution are written, be sure to change the tw[15] in the header back to the  
    650650//              proper labels 
    651 // 
     651// - May 2010: 
     652// now the smearing is correct, and is now defined in terms of Q_parallel and Q_perpendicular 
     653// 
     654// - June 2010: 
     655// TEMPORARY - I've added "fake" error that is sqrt(value). It really needs to be propogated 
     656//  in a more correct way, but this is at least a placeholder for the error column 
    652657// 
    653658// - creates the qx and qy data here, based on the data and header information 
     
    736741        labelWave[13] = "" 
    737742        labelWave[14] = "*** Data written from "+type+" folder and may not be a fully corrected data file ***" 
    738         labelWave[15] = "Data columns are Qx - Qy - I(Qx,Qy)" 
    739 //      labelWave[15] = "Data columns are Qx - Qy - I(Qx,Qy) - Qz - SigmaQx - SigmaQy - fSubS(beam stop shadow)" 
    740         labelWave[16] = "" 
     743//      labelWave[15] = "Data columns are Qx - Qy - I(Qx,Qy)" 
     744//      labelWave[15] = "Data columns are Qx - Qy - I(Qx,Qy) - Qz - SigmaQ_parall - SigmaQ_perp - fSubS(beam stop shadow)" 
     745        labelWave[15] = "Data columns are Qx - Qy - I(Qx,Qy) - err(I) - Qz - SigmaQ_parall - SigmaQ_perp - fSubS(beam stop shadow)" 
     746        labelWave[16] = "ERROR WAVE IS ONLY AN ESTIMATE  - 6/2010" 
    741747        labelWave[17] = "ASCII data created " +date()+" "+time() 
    742748        //strings can be too long to print-- must trim to 255 chars 
     
    812818//********************* 
    813819 
     820        // generate my own error wave for I(qx,qy) 
     821        Duplicate/O z_val sw 
     822        sw = sqrt(z_val)                //assumes Poisson statistics for each cell (counter) 
     823        //      sw = 0.05*sw            // uniform 5% error? tends to favor the low intensity too strongly 
     824        // get rid of the "bad" errorsby replacing the NaN, Inf, and zero with V_avg 
     825        // THIS IS EXTREMEMLY IMPORTANT - if this is not done, there are some "bad" values in the  
     826        // error wave (things that are not numbers) - and this wrecks the smeared model fitting. 
     827        // It appears to have no effect on the unsmeared model. 
     828        WaveStats/Q sw 
     829        sw = numtype(sw[p]) == 0 ? sw[p] : V_avg 
     830        sw = sw[p] != 0 ? sw[p] : V_avg 
     831         
     832 
    814833        //not demo-compatible, but approx 8x faster!!    
    815 #if(cmpstr(stringbykey("IGORKIND",IgorInfo(0),":",";"),"pro") == 0)      
    816         Save/G/M="\r\n" labelWave,qx_val,qy_val,z_val as fullpath       // without resolution 
    817 //      Save/G/M="\r\n" labelWave,qx_val,qy_val,z_val,qz_val,SigmaQx,SigmaQy,fSubS as fullpath  // write out the resolution information 
     834#if(cmpstr(stringbykey("IGORKIND",IgorInfo(0),":",";"),"pro") == 0) 
     835        Duplicate/O qx_val,qx_val_s 
     836        Duplicate/O qy_val,qy_val_s 
     837        Duplicate/O qz_val,qz_val_s 
     838        Duplicate/O z_val,z_val_s 
     839        Duplicate/O SigmaQx,sigmaQx_s 
     840        Duplicate/O SigmaQy,sigmaQy_s 
     841        Duplicate/O fSubS,fSubS_s 
     842        Duplicate/O sw,sw_s 
     843         
     844        //so that double precision is not written ou 
     845        Redimension/S qx_val_s,qy_val_s,qz_val_s,z_val_s,sigmaQx_s,sigmaQy_s,fSubS_s,sw_s 
     846         
     847//      Save/G/M="\r\n" labelWave,qx_val,qy_val,z_val as fullpath       // without resolution 
     848        Save/G/M="\r\n" labelWave,qx_val_s,qy_val_s,z_val_s,sw_s,qz_val_s,SigmaQx_s,SigmaQy_s,fSubS_s as fullpath       // write out the resolution information 
    818849#else 
    819850        Open refNum as fullpath 
    820851        wfprintf refNum,"%s\r\n",labelWave 
    821852        fprintf refnum,"\r\n" 
    822         wfprintf refNum,"%8g\t%8g\t%8g\r\n",qx_val,qy_val,z_val 
     853//      wfprintf refNum,"%8g\t%8g\t%8g\r\n",qx_val,qy_val,z_val 
     854        wfprintf refNum,"%8g\t%8g\t%8g\t%8g\t%8g\t%8g\t%8g\t%8g\r\n",qx_val,qy_val,z_val,sw,qz_val,SigmaQx,SigmaQy,fSubS 
    823855        Close refNum 
    824856#endif 
     857         
     858        KillWaves/Z qx_val_s,qy_val_s,z_val_s,qz_val_s,SigmaQx_s,SigmaQy_s,fSubS_s 
    825859         
    826860        Killwaves/Z spWave,labelWave,qx_val,qy_val,z_val,qval,qz_val,sigmaQx,SigmaQy,fSubS,phi,r_dist 
Note: See TracChangeset for help on using the changeset viewer.