Ignore:
Timestamp:
Feb 28, 2012 4:51:26 PM (11 years ago)
Author:
srkline
Message:

adding two new help files for real space modeling and description of the 2D resolution function

cleaning up the FFT routines for addition as a beta operation

Location:
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
Files:
3 edited

Legend:

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

    r740 r838  
    3838                "ReBin 1D Data",OpenRebin() 
    3939        End 
    40                 Submenu "2-D Processing" 
     40        Submenu "2-D Processing" 
    4141                "2D Work file Math",Show_WorkMath_Panel() 
    4242                "Tile Raw 2D files",Show_Tile_2D_Panel() 
    4343                "Export 2D ASCII data",Export_RAW_Ascii_Panel() 
     44                "Bin QxQy Data to 1D",BinQxQy_to_1D() 
    4445        End 
    4546        "-" 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_Utils.ipf

    r827 r838  
    190190// but written in terms of Parallel and perpendicular to the Q vector at each point 
    191191// 
    192 // -- it must be written this way since the 2D function is an ellipse with its major 
     192// -- it is more naturally written this way since the 2D function is an ellipse with its major 
    193193// axis pointing in the direction of Q_parallel. Hence there is no way to properly define the  
    194194// elliptical gaussian in terms of sigmaX and sigmaY 
    195195// 
    196 // based on notes from David Mildner, 2008 
     196// For a full description of the gravity effect on the resolution, see: 
     197// 
     198//      "The effect of gravity on the resolution of small-angle neutron diffraction peaks" 
     199//      D.F.R Mildner, J.G. Barker & S.R. Kline J. Appl. Cryst. (2011). 44, 1127-1129. 
     200//      [ doi:10.1107/S0021889811033322 ] 
     201// 
     202//              2/17/12 SRK 
     203//              NOTE: the first 2/3 of this code is the 1D code, copied here just to have the beam stop 
     204//                              calculation here, if I decide to implement it. The real calculation is all at the  
     205//                              bottom and is quite compact 
     206// 
     207// 
    197208// 
    198209// 
     
    324335//      ////// this is all new, inclusion of gravity effect into the parallel component 
    325336//       perpendicular component is purely geometric, no gravity component 
     337// 
     338// the shadow factor is calculated as above -so keep the above calculations, even though 
     339// most of them are redundant. 
     340// 
     341         
    326342////    // 
    327343        Variable yg_d,acc,sdd,ssd,lambda0,DL_L,sig_l 
    328344        Variable var_qlx,var_qly,var_ql,qx,qy,sig_perp,sig_para, sig_para_new 
     345         
    329346        G = 981.  //!   ACCELERATION OF GRAVITY, CM/SEC^2 
    330347        acc = vz_1              //      3.956E5 //!     CONVERT WAVELENGTH TO VELOCITY CM/SEC 
     
    336353        YG_d = -0.5*G*SDD*(SSD+SDD)*(LAMBDA0/acc)^2 
    337354/////   Print "DISTANCE BEAM FALLS DUE TO GRAVITY (CM) = ",YG 
     355//              Print "Gravity q* = ",-2*pi/lambda0*2*yg_d/sdd 
    338356         
    339357        sig_perp = kap*kap/12 * (3*(S1/L1)^2 + 3*(S2/LP)^2 + (proj_DDet/L2)^2) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/WriteQIS.ipf

    r832 r838  
    777777        Redimension/N=(pixelsX*pixelsY) qx_val,qy_val,z_val 
    778778 
    779 ///************ 
    780 // do everything to write out the resolution too 
    781         // un-comment these if you want to write out qz_val and qval too, then use the proper save command 
    782         qval = CalcQval(p+1,q+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10) 
    783         qz_val = CalcQz(p+1,q+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10) 
    784         phi = FindPhi( pixSize*((p+1)-xctr) , pixSize*((q+1)-yctr))             //(dx,dy) 
    785         r_dist = sqrt(  (pixSize*((p+1)-xctr))^2 +  (pixSize*((q+1)-yctr))^2 )          //radial distance from ctr to pt 
    786         Redimension/N=(pixelsX*pixelsY) qz_val,qval,phi,r_dist 
    787         //everything in 1D now 
    788         Duplicate/O qval SigmaQX,SigmaQY,fsubS 
     779 
    789780 
    790781        Variable L2 = rw[18] 
     
    796787        Variable usingLenses = rw[28]           //new 2007 
    797788 
     789        Variable vz_1 = 3.956e5         //velocity [cm/s] of 1 A neutron 
     790        Variable g = 981.0                              //gravity acceleration [cm/s^2] 
     791        Variable m_h    = 252.8                 // m/h [=] s/cm^2 
     792 
     793        Variable acc,ssd,lambda0,yg_d,qstar 
     794                 
     795        G = 981.  //!   ACCELERATION OF GRAVITY, CM/SEC^2 
     796        acc = vz_1              //      3.956E5 //!     CONVERT WAVELENGTH TO VELOCITY CM/SEC 
     797        SDD = L2        *100    //1317 
     798        SSD = L1        *100    //1627          //cm 
     799        lambda0 = lambda                //              15 
     800        YG_d = -0.5*G*SDD*(SSD+SDD)*(LAMBDA0/acc)^2 
     801        Print "DISTANCE BEAM FALLS DUE TO GRAVITY (CM) = ",YG_d 
     802//              Print "Gravity q* = ",-2*pi/lambda0*2*yg_d/sdd 
     803        qstar = -2*pi/lambda0*2*yg_d/sdd 
     804         
     805 
     806// the gravity center is not the resolution center 
     807// gravity center = beam center 
     808// resolution center = offset y = dy + (2)*yg_d 
     809///************ 
     810// do everything to write out the resolution too 
     811        // un-comment these if you want to write out qz_val and qval too, then use the proper save command 
     812        qval = CalcQval(p+1,q+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10) 
     813        qz_val = CalcQz(p+1,q+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10) 
     814//      phi = FindPhi( pixSize*((p+1)-xctr) , pixSize*((q+1)-yctr))             //(dx,dy) 
     815//      r_dist = sqrt(  (pixSize*((p+1)-xctr))^2 +  (pixSize*((q+1)-yctr))^2 )          //radial distance from ctr to pt 
     816        phi = FindPhi( pixSize*((p+1)-xctr) , pixSize*((q+1)-yctr)+(2)*yg_d)            //(dx,dy+yg_d) 
     817        r_dist = sqrt(  (pixSize*((p+1)-xctr))^2 +  (pixSize*((q+1)-yctr)+(2)*yg_d)^2 )         //radial distance from ctr to pt 
     818        Redimension/N=(pixelsX*pixelsY) qz_val,qval,phi,r_dist 
     819        //everything in 1D now 
     820        Duplicate/O qval SigmaQX,SigmaQY,fsubS 
     821         
     822 
     823 
    798824        //Two parameters DDET and APOFF are instrument dependent.  Determine 
    799825        //these from the instrument name in the header. 
     
    819845        // generate my own error wave for I(qx,qy) 
    820846        //      //      sw = 0.05*sw            // uniform 5% error? tends to favor the low intensity too strongly 
    821         // after teh SQRT(),  get rid of the "bad" errors by replacing the NaN, Inf, and zero with V_avg 
     847        // after the SQRT(),  get rid of the "bad" errors by replacing the NaN, Inf, and zero with V_avg 
    822848        // THIS IS EXTREMEMLY IMPORTANT - if this is not done, there are some "bad" values in the  
    823849        // error wave (things that are not numbers) - and this wrecks the smeared model fitting. 
Note: See TracChangeset for help on using the changeset viewer.