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/NCNR_Utils.ipf

    r683 r708  
    153153End 
    154154 
    155 // 
    156 // 
    157 //      this should end up in FACILITY_Utils once it's fully functional 
    158 // 
    159 // lots of unnecessary junk... 
     155 
    160156// 
    161157//********************** 
    162 // 2D resolution function calculation - in terms of X and Y 
     158// 2D resolution function calculation - ***NOT*** in terms of X and Y 
     159// but written in terms of Parallel and perpendicular to the Q vector at each point 
     160// 
     161// -- it must be written this way since the 2D function is an ellipse with its major 
     162// axis pointing in the direction of Q_parallel. Hence there is no way to properly define the  
     163// elliptical gaussian in terms of sigmaX and sigmaY 
    163164// 
    164165// based on notes from David Mildner, 2008 
     166// 
    165167// 
    166168// - 21 MAR 07 uses projected BS diameter on the detector 
     
    187189        Variable vz_1 = 3.956e5         //velocity [cm/s] of 1 A neutron 
    188190        Variable g = 981.0                              //gravity acceleration [cm/s^2] 
    189         Variable h_m = 3995                             // h/m [=] A*m/s 
     191        Variable m_h    = 252.8                 // m/h [=] s/cm^2 
    190192 
    191193        String results 
     
    251253//      endif 
    252254 
    253         Variable kap,a_val 
     255        Variable kap,a_val,a_val_L2 
    254256         
    255257        kap = 2*pi/lambda 
    256         a_val = (L1+L2)*g/2/(h_m)^2 
    257  
    258 //      lambdaWidth = 0.5        
    259         SigmaQX = 3*(S1/L1)^2 + 3*(S2/LP)^2 + 2*(DDet/L2)^2 + 2*(r_dist/L2)^2*(lambdaWidth)^2*(cos(phi))^2 
    260  
    261         SigmaQY = 3*(S1/L1)^2 + 3*(S2/LP)^2 + 2*(DDet/L2)^2 + 2*(r_dist/L2)^2*(lambdaWidth)^2*(sin(phi))^2 + 8*(a_val/L2)^2*lambda^4*lambdaWidth^2 
    262 //      SigmaQY = 3*(S1/L1)^2 + 3*(S2/LP)^2 + 2*(DDet/L2)^2 + 2*(r_dist/L2)^2*(lambdaWidth)^2*(sin(phi))^2 
    263  
    264         SigmaQX = sqrt(kap*kap/12*SigmaQX) 
    265         SigmaQy = sqrt(kap*kap/12*SigmaQY) 
    266  
     258        a_val = L2*(L1+L2)*g/2*(m_h)^2 
     259        a_val_L2 = a_val/L2*1e-16               //convert 1/cm^2 to 1/A^2 
     260 
     261 
     262///////// in terms of Q_parallel ("x") and Q_perp ("y") - this works, since parallel is in the direction of Q and I 
     263// can calculate that from the QxQy (I just need the projection) 
     264 
     265 
     266// for test case with no gravity, set a_val = 0 
     267// note that gravity has no wavelength dependence. the lambda^4 cancels out. 
     268// 
     269//      a_val = 0 
     270 
     271        // the detector pixel is square, so correct for phi 
     272        DDet = DDet*cos(phi) + DDet*sin(phi) 
     273         
     274        // this is really sigma_Q_parallel 
     275        SigmaQX = kap*kap/12* (3*(S1/L1)^2 + 3*(S2/LP)^2 + (DDet/L2)^2 + (del_r/L2)^2 + (sin(phi))^2*8*(a_val_L2)^2*lambda^4*lambdaWidth^2) 
     276        SigmaQX += inQ*inQ*v_lambda 
     277 
     278        //this is really sigma_Q_perpendicular 
     279        SigmaQY = 3*(S1/L1)^2 + 3*(S2/LP)^2 + (DDet/L2)^2 + (del_r/L2)^2 + (cos(phi))^2*8*(a_val_L2)^2*lambda^4*lambdaWidth^2 
     280        SigmaQY *= kap*kap/12 
     281         
     282        SigmaQX = sqrt(SigmaQX) 
     283        SigmaQy = sqrt(SigmaQY) 
     284         
     285         
    267286        results = "success" 
    268287        Return results 
     
    13701389        Return filename 
    13711390End 
     1391 
     1392 
Note: See TracChangeset for help on using the changeset viewer.