Changeset 838 for sans/Dev/trunk


Ignore:
Timestamp:
Feb 28, 2012 4:51:26 PM (10 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
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Cubes_Includes.ipf

    r836 r838  
    2626        Submenu "Matrix Info" 
    2727                "Number of Points" 
    28                 "Fill Statistics" 
     28//              "Fill Statistics"                       //only valid for concentrated spheres... 
    2929                "Center_to_Center" 
    3030                "Davg_to_Np" 
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Fit_3Cyl_KR.ipf

    r798 r838  
    109109        NVAR FFT_N = root:FFT_N 
    110110        NVAR FFT_SolventSLD = root:FFT_SolventSLD 
    111          
    112         FFT_SolventSLD = trunc(sldSolv*1e6)             //spits back an integer, maybe not correct 
     111        NVAR FFT_delRho = root:FFT_delRho               //the SLD multiplier, should have been initialized to 1e-7 
     112         
     113        FFT_SolventSLD = trunc(sldSolv/FFT_delRho)              //spits back an integer, maybe not correct 
    113114 
    114115// generate the matrix and erase it 
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Panel.ipf

    r836 r838  
    1111// put the SLD multiplier on the panel somewhere - only 2 values are allowed - so use 
    1212// radio buttons, or just display the value of the global, make the change at the command 
    13 // line -- or keep the multiplier at 10^-7 and always use 2 digits 
     13// line -- or keep the multiplier at 10^-7 and always use 2 digits (10^-7 is probably 
     14// better to use, just to allow more flexibility from the start).  
     15 
     16// TO DO: 
     17// -- I need to change a lot of routines (most notably Gizmo) to take "10" as the default SLD 
     18//               rather than "1" 
    1419// 
    1520//////////// 
     
    5156                 
    5257                Variable/G root:FFT_SolventSLD = 0 
    53                 Variable/G root:FFT_delRho = 1e-6                       //multiplier for SLD (other value is 1e-7) 
     58                Variable/G root:FFT_delRho = 1e-7                       //multiplier for SLD (other value is 1e-7) 
    5459                 
    5560                FFT_Qmax :=2*pi/FFT_T 
     
    104109        Button FFTButton_12,disable=2           // hide this button 
    105110        Button FFTButton_13,pos={14,109},size={120,20},proc=FFTFillSolventMatrixProc,title="Solvent Matrix" 
    106         SetVariable FFTSetVar_5,pos={155,111},size={150,15},title="Solvent SLD (10^-6)" 
     111        SetVariable FFTSetVar_5,pos={155,111},size={150,15},title="Solvent SLD (10^-7)" 
    107112        SetVariable FFTSetVar_5,limits={-99,99,1},value= FFT_SolventSLD,live= 1 
    108113        Button FFTButton_15,pos={209,430},size={90,20},proc=Interp2DSliceButton,title="Interp 2D" 
     
    118123                case 2: 
    119124                        // click code here 
    120                         DisplayHelpTopic/Z/K=1 "Real-Space Modeling" 
     125                        DisplayHelpTopic/Z/K=1 "Real-Space Modeling of SANS Data" 
    121126                        if(V_flag !=0) 
    122127                                DoAlert 0,"The Real-Space Modeling Help file could not be found" 
  • sans/Dev/trunk/NCNR_User_Procedures/Common/Packages/PlotManager/PlotUtils2D_v40.ipf

    r794 r838  
    10391039 
    10401040        fDoBinning_QxQy2D(folderStr) 
     1041         
     1042        SetDataFolder $("root:"+folderStr) 
     1043        Display iBin_qxqy vs qBin_qxqy 
     1044        ModifyGraph mirror=2,grid=1,log=1 
     1045        ModifyGraph mode=4,marker=19,msize=2 
     1046        ErrorBars/T=0 iBin_qxqy Y,wave=(eBin2D_qxqy,eBin2D_qxqy) 
     1047        legend 
     1048         
     1049        SetDataFolder root: 
    10411050End 
    10421051 
     
    10521061        SetDataFolder $("root:"+folderStr) 
    10531062         
    1054         WAVE inten = $("smeared_sf2D") 
    1055  
    1056 //      WAVE inten = $(folderStr + "_i") 
     1063//      WAVE inten = $("smeared_sf2D") 
     1064 
     1065        WAVE inten = $(folderStr + "_i") 
    10571066        WAVE iErr = $(folderStr + "_iErr") 
    10581067        WAVE qx = $(folderStr + "_qx") 
  • sans/Dev/trunk/NCNR_User_Procedures/Common/Packages/PlotManager/PlotUtilsMacro_v40.ipf

    r814 r838  
    11941194        list = RemoveFromList("FillYZCircle;FillZCylinder;PadMatrix;RandomFill3DMat;RandomPoints2D;SobolFill3DMat;SphereAtEachPoint;UnConnectedRodFill;XYZV_toByteVoxels;",list,";") 
    11951195        list = RemoveFromList("MakeTriplet;SobolPoints2D;X_CylindersAtPoints;X_CylindersHexagonalGrid;X_CylindersSquareGrid;maxDistance_Threaded;KR_MultiCylinder;",list,";") 
     1196        list = RemoveFromList("X_CoreShellCylinderHexGrid;",list,";") 
    11961197         
    11971198         
  • sans/Dev/trunk/NCNR_User_Procedures/Common/Smear_2D.ipf

    r801 r838  
    412412        pixSize = rw[13]/10             //convert mm to cm (x and y are the same size pixels) 
    413413         
    414 //      qx_val = CalcQx(p+1,q+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10)          //+1 converts to detector coordinate system 
    415 //      qy_val = CalcQy(p+1,q+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10) 
    416          
    417414        qx_val = CalcQx(xx+1,yy+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10)                //+1 converts to detector coordinate system 
    418415        qy_val = CalcQy(xx+1,yy+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10) 
    419416         
    420 //      Redimension/N=(pixelsX*pixelsY) qx_val,qy_val,z_val 
    421  
    422 ///************ 
    423 // do everything to write out the resolution too 
    424         // un-comment these if you want to write out qz_val and qval too, then use the proper save command 
    425         qval = CalcQval(xx+1,yy+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10) 
    426         qz_val = CalcQz(xx+1,yy+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10) 
    427         phi = FindPhi( pixSize*((xx+1)-xctr) , pixSize*((yy+1)-yctr))           //(dx,dy) 
    428         r_dist = sqrt(  (pixSize*((xx+1)-xctr))^2 +  (pixSize*((yy+1)-yctr))^2 )                //radial distance from ctr to pt 
    429 //      Redimension/N=(pixelsX*pixelsY) qz_val,qval,phi,r_dist 
    430         //everything in 1D now 
    431 //      Duplicate/O qval SigmaQX,SigmaQY,fsubS 
    432         Variable SigmaQX,SigmaQY,fsubS 
    433  
    434417        Variable L2 = rw[18] 
    435418        Variable BS = rw[21] 
     
    439422        Variable lambdaWidth = rw[27]    
    440423        Variable usingLenses = rw[28]           //new 2007 
     424         
     425        Variable vz_1 = 3.956e5         //velocity [cm/s] of 1 A neutron 
     426        Variable g = 981.0                              //gravity acceleration [cm/s^2] 
     427        Variable m_h    = 252.8                 // m/h [=] s/cm^2 
     428 
     429        Variable acc,ssd,lambda0,yg_d,qstar 
     430                 
     431        G = 981.  //!   ACCELERATION OF GRAVITY, CM/SEC^2 
     432        acc = vz_1              //      3.956E5 //!     CONVERT WAVELENGTH TO VELOCITY CM/SEC 
     433        SDD = L2        *100    //1317 
     434        SSD = L1        *100    //1627          //cm 
     435        lambda0 = lambda                //              15 
     436        YG_d = -0.5*G*SDD*(SSD+SDD)*(LAMBDA0/acc)^2 
     437        Print "DISTANCE BEAM FALLS DUE TO GRAVITY (CM) = ",YG_d 
     438                Print "Gravity q* = ",-2*pi/lambda0*2*yg_d/sdd 
     439        qstar = -2*pi/lambda0*2*yg_d/sdd 
     440         
     441 
     442// the gravity center is not the resolution center 
     443// gravity center = beam center 
     444// resolution center = offset y = dy + (2)*yg_d 
     445 
     446 
     447        qval = CalcQval(xx+1,yy+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10) 
     448        qz_val = CalcQz(xx+1,yy+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10) 
     449        phi = FindPhi( pixSize*((xx+1)-xctr) , pixSize*((yy+1)-yctr)+(2)*yg_d)          //(dx,dy+yg_d) 
     450        r_dist = sqrt(  (pixSize*((xx+1)-xctr))^2 +  (pixSize*((yy+1)-yctr)+(2)*yg_d)^2 )               //radial distance from ctr to pt 
     451         
     452        Print pixSize*((yy+1)-yctr),pixSize*((yy+1)-yctr)+(2)*yg_d 
     453         
     454//      Redimension/N=(pixelsX*pixelsY) qz_val,qval,phi,r_dist 
     455        //everything in 1D now 
     456//      Duplicate/O qval SigmaQX,SigmaQY,fsubS 
     457        Variable SigmaQX,SigmaQY,fsubS 
    441458 
    442459        //Two parameters DDET and APOFF are instrument dependent.  Determine 
     
    469486        Print "phi, theta",phi,theta 
    470487         
    471         FindQxQy(qval,phi,qx_ret,qy_ret) 
     488//      FindQxQy(qval,phi,qx_ret,qy_ret) 
    472489         
    473490        sx = SigmaQx 
     
    487504        Setscale/I x -nStdDev*maxSig+x0,nStdDev*maxSig+x0,res 
    488505        Setscale/I y -nStdDev*maxSig+y0,nStdDev*maxSig+y0,res 
    489 //      Setscale/I x -nStdDev*sx+x0,nStdDev*sx+x0,res 
    490 //      Setscale/I y -nStdDev*sy+y0,nStdDev*sy+y0,res 
     506/////   Setscale/I x -nStdDev*sx+x0,nStdDev*sx+x0,res 
     507/////   Setscale/I y -nStdDev*sy+y0,nStdDev*sy+y0,res 
    491508         
    492509        Variable xPt,yPt,delx,dely,offx,offy 
  • 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.