Changeset 816


Ignore:
Timestamp:
Jul 13, 2011 3:02:15 PM (11 years ago)
Author:
srkline
Message:

in 2D models, adjusted the point ranges to be integers. non-integer values occasionally causes issues.

changed names of polarization procedures to start with "Pol_" so that they are easier to locate.

added MixedDumbbell_FFT model as another example of a FFT fitting function.

Location:
sans/Dev/trunk/NCNR_User_Procedures
Files:
5 added
4 deleted
9 edited

Legend:

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

    r798 r816  
    838838// make a lookup table to get from rho@xyz to the index 
    839839        Variable maxSLD = WaveMax(SLD_id) 
    840         Make/O/D/N=(maxSLD+1) SLDlookup 
     840        Variable minSLD = abs(WaveMin(SLD_id)) 
     841//      Make/O/D/N=(maxSLD+1) SLDlookup 
     842        Make/O/D/N=(maxSLD+minSLD+1) SLDlookup 
    841843        SLDLookup = NaN 
    842844        ii=0 
    843845        do 
    844                 SLDLookup[SLD_id[ii]] = ii 
     846                SLDLookup[SLD_id[ii]+minSLD] = ii 
    845847                ii+=1 
    846848        while(ii<numpnts(SLD_id)) 
     
    880882                rhoi = rho[ii] 
    881883                // find the Nij. Not sure if these are what I really need... 
    882                 PSFIndex = psf_id_mat[ SLDLookup[rhoi] ][ SLDlookup[rhoi] ] 
     884                PSFIndex = psf_id_mat[ SLDLookup[rhoi+minSLD] ][ SLDlookup[rhoi+minSLD] ] 
    883885                Nij[PSFIndex] += 1                      //these are just the Ni counts 
    884886        endfor 
     
    887889//      t1 = ticks 
    888890         
    889 // this is the double loop that has been XOPed   
     891////// this is the double loop that has been XOPed       
    890892//      for(ii=0;ii<num;ii+=1) 
    891893//              for(kk=(ii+1);kk<num;kk+=1) 
     
    898900//                              rhoi = rho[ii] 
    899901//                              rhok = rho[kk] 
    900 //                              PSFIndex = psf_id_mat[ SLDLookup[rhoi] ][ SLDlookup[rhok] ] 
     902//                              PSFIndex = psf_id_mat[ SLDLookup[rhoi+minSLD] ][ SLDlookup[rhok+minSLD] ] 
    901903//                              binMatrix[binIndex][PSFIndex] += 1 
    902904//                               
     
    907909// binMatrix is returned 
    908910 
     911 
     912 
    909913        nthreads=ThreadProcessorCount 
    910914        if(nthreads == 1) 
    911                 binSLDDistanceX(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, grid, binWidth,0,numpnts(xv)) 
     915                binSLDDistanceX(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, minSLD, grid, binWidth,0,numpnts(xv)) 
    912916        else 
    913                 binSLDDistance_SLD_Threaded(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, grid, binWidth) 
    914         endif 
     917                binSLDDistance_SLD_Threaded(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, minSLD, grid, binWidth) 
     918        endif 
     919 
     920 
    915921         
    916922//      Printf "binned the distances and SLDs = %g seconds\r",(ticks-t1)/60.15 
     
    960966        // now add up everything to get the intensity 
    961967        // use the psf_id_mat[][] to get the Gij index 
     968        // 
     969        // 
    962970         
    963971        vol=4*Pi/3*rval*rval*rval 
     
    972980                        index = psf_id_mat[ii][ii] 
    973981                         
    974                         F2Q = fQR*fQR*SLD_id[ii]*SLD_id[ii]*vol*vol 
     982//                      F2Q = fQR*fQR*(SLD_id[ii]-solventSLD)*(SLD_id[ii]-solventSLD)*vol*vol 
     983                        F2Q = fQR*fQR*(SLD_id[ii])*(SLD_id[ii])*vol*vol 
    975984                         
    976985                        Iqr[kk] += Nij[index]*F2Q                       //these are just the "ii" numbers 
     
    981990                                WAVE Sij = $("root:Sij"+num2str(index))         //switch the Sij 
    982991                                 
    983                                 Iqr[kk] += fQR*fQR*SLD_id[ii]*SLD_id[jj]*vol*vol*Sij[kk]                                //factor of 2 removed, not sure why 
     992//                              Iqr[kk] += fQR*fQR*(SLD_id[ii]-solventSLD)*(SLD_id[jj]-solventSLD)*vol*vol*Sij[kk]                              //factor of 2 removed, not sure why 
     993                                Iqr[kk] += fQR*fQR*(SLD_id[ii])*(SLD_id[jj])*vol*vol*Sij[kk]                            //factor of 2 removed, not sure why 
    984994                                 
    985995                        endfor 
     
    9951005 
    9961006// support up to 8 threads at this time 
    997 Function binSLDDistance_SLD_Threaded(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, grid, binWidth) 
     1007Function binSLDDistance_SLD_Threaded(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, minSLD, grid, binWidth) 
    9981008        Wave xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat 
    999         Variable grid, binWidth 
     1009        Variable minSLD, grid, binWidth 
    10001010         
    10011011        Variable nthreads,mt,left,right 
     
    10321042                        //Print (ii*num/nthreads),((ii+1)*num/nthreads) 
    10331043                        //ThreadStart mt,ii,binDistance_WF(xv, yv, zv, binMatrix0, grid, binWidth,(ii*num/nthreads),((ii+1)*num/nthreads)) 
    1034                         ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix0, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num) 
     1044                        ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix0, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 
    10351045                endif 
    10361046                if(ii==1) 
    10371047                        Wave binMatrix1 
    10381048                        binMatrix1 = 0 
    1039                         ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix1, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num) 
     1049                        ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix1, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 
    10401050                endif 
    10411051                if(ii==2) 
    10421052                        Wave binMatrix2 
    10431053                        binMatrix2 = 0 
    1044                         ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix2, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num) 
     1054                        ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix2, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 
    10451055                endif 
    10461056                if(ii==3) 
    10471057                        Wave binMatrix3 
    10481058                        binMatrix3 = 0 
    1049                         ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix3, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num) 
     1059                        ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix3, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 
    10501060                endif 
    10511061                if(ii==4) 
    10521062                        Wave binMatrix4 
    10531063                        binMatrix4 = 0 
    1054                         ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix4, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num) 
     1064                        ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix4, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 
    10551065                endif 
    10561066                if(ii==5) 
    10571067                        Wave binMatrix5 
    10581068                        binMatrix5 = 0 
    1059                         ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix5, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num) 
     1069                        ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix5, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 
    10601070                endif 
    10611071                if(ii==6) 
    10621072                        Wave binMatrix6 
    10631073                        binMatrix6 = 0 
    1064                         ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix6, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num) 
     1074                        ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix6, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 
    10651075                endif 
    10661076                if(ii==7) 
    10671077                        Wave binMatrix7 
    10681078                        binMatrix7 = 0 
    1069                         ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix7, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num) 
     1079                        ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix7, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 
    10701080                endif 
    10711081                 
     
    11161126 
    11171127// this is just a worker function to get the ThreadStart operation to compile 
    1118 ThreadSafe Function binDistance_SLD_WF(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, grid, binWidth, p1,p2) 
     1128ThreadSafe Function binDistance_SLD_WF(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, minSLD, grid, binWidth, p1,p2) 
    11191129        Wave xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat 
    1120         Variable grid, binWidth, p1,p2 
     1130        Variable minSLD, grid, binWidth, p1,p2 
    11211131 
    11221132        Variable ret 
    1123         ret = binSLDDistanceX(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, grid, binWidth, p1,p2) 
     1133        ret = binSLDDistanceX(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, minSLD, grid, binWidth, p1,p2) 
    11241134 
    11251135        return(0) 
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/Models_2D/CoreShellCyl2D_v40.ipf

    r794 r816  
    339339         
    340340        for(i=0;i<nthreads;i+=1) 
    341 //              Print (i*npt/nthreads),((i+1)*npt/nthreads-1) 
    342                 ThreadStart mt,i,SmearedCoreShellCylinder2D_T(s.coefW,s.xw[0],s.xw[1],s.qz,s.sQpl,s.sQpp,s.fs,s.zw,wt,xi,(i*npt/nthreads),((i+1)*npt/nthreads-1),nord) 
     341//              Print trunc(i*npt/nthreads),trunc((i+1)*npt/nthreads-1) 
     342                ThreadStart mt,i,SmearedCoreShellCylinder2D_T(s.coefW,s.xw[0],s.xw[1],s.qz,s.sQpl,s.sQpp,s.fs,s.zw,wt,xi,trunc(i*npt/nthreads),trunc((i+1)*npt/nthreads-1),nord) 
    343343        endfor 
    344344 
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/Models_2D/Cylinder_2D_v40.ipf

    r794 r816  
    374374         
    375375        for(i=0;i<nthreads;i+=1) 
    376 //              Print (i*npt/nthreads),((i+1)*npt/nthreads-1) 
    377                 ThreadStart mt,i,SmearedCylinder2D_T(s.coefW,s.xw[0],s.xw[1],s.qz,s.sQpl,s.sQpp,s.fs,s.zw,wt,xi,(i*npt/nthreads),((i+1)*npt/nthreads-1),nord) 
     376//              Print trunc(i*npt/nthreads),trunc((i+1)*npt/nthreads-1) 
     377                ThreadStart mt,i,SmearedCylinder2D_T(s.coefW,s.xw[0],s.xw[1],s.qz,s.sQpl,s.sQpp,s.fs,s.zw,wt,xi,trunc(i*npt/nthreads),trunc((i+1)*npt/nthreads-1),nord) 
    378378        endfor 
    379379 
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/Models_2D/Ellipsoid2D_v40.ipf

    r794 r816  
    333333         
    334334        for(i=0;i<nthreads;i+=1) 
    335 //              Print (i*npt/nthreads),((i+1)*npt/nthreads-1) 
    336                 ThreadStart mt,i,SmearedEllipsoid2D_T(s.coefW,s.xw[0],s.xw[1],s.qz,s.sQpl,s.sQpp,s.fs,s.zw,wt,xi,(i*npt/nthreads),((i+1)*npt/nthreads-1),nord) 
     335//              Print trunc(i*npt/nthreads),trunc((i+1)*npt/nthreads-1) 
     336                ThreadStart mt,i,SmearedEllipsoid2D_T(s.coefW,s.xw[0],s.xw[1],s.qz,s.sQpl,s.sQpp,s.fs,s.zw,wt,xi,trunc(i*npt/nthreads),trunc((i+1)*npt/nthreads-1),nord) 
    337337        endfor 
    338338 
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/Models_2D/EllipticalCylinder2D_v40.ipf

    r794 r816  
    336336         
    337337        for(i=0;i<nthreads;i+=1) 
    338 //              Print (i*npt/nthreads),((i+1)*npt/nthreads-1) 
    339                 ThreadStart mt,i,SmearedEllipticalCyl2D_T(s.coefW,s.xw[0],s.xw[1],s.qz,s.sQpl,s.sQpp,s.fs,s.zw,wt,xi,(i*npt/nthreads),((i+1)*npt/nthreads-1),nord) 
     338//              Print trunc(i*npt/nthreads),trunc((i+1)*npt/nthreads-1) 
     339                ThreadStart mt,i,SmearedEllipticalCyl2D_T(s.coefW,s.xw[0],s.xw[1],s.qz,s.sQpl,s.sQpp,s.fs,s.zw,wt,xi,trunc(i*npt/nthreads),trunc((i+1)*npt/nthreads-1),nord) 
    340340        endfor 
    341341 
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/Models_2D/PeakGauss2D_v40.ipf

    r800 r816  
    284284        Variable t1=StopMSTimer(-2) 
    285285         
     286//      print "npt = ",npt 
    286287        for(i=0;i<nthreads;i+=1) 
    287         //      Print (i*npt/nthreads),((i+1)*npt/nthreads-1) 
    288                 ThreadStart mt,i,SmearPeakGauss2D_T(s.coefW,s.xw[0],s.xw[1],s.qz,s.sQpl,s.sQpp,s.fs,s.zw,wt,xi,(i*npt/nthreads),((i+1)*npt/nthreads-1),nord) 
     288//              Print trunc(i*npt/nthreads),trunc((i+1)*npt/nthreads-1) 
     289                ThreadStart mt,i,SmearPeakGauss2D_T(s.coefW,s.xw[0],s.xw[1],s.qz,s.sQpl,s.sQpp,s.fs,s.zw,wt,xi,trunc(i*npt/nthreads),trunc((i+1)*npt/nthreads-1),nord) 
    289290        endfor 
    290291 
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/Models_2D/Sphere_2D_v40.ipf

    r794 r816  
    303303         
    304304        for(i=0;i<nthreads;i+=1) 
    305 //              Print (i*npt/nthreads),((i+1)*npt/nthreads-1) 
    306                 ThreadStart mt,i,SmearedSphere2D_T(s.coefW,s.xw[0],s.xw[1],s.qz,s.sQpl,s.sQpp,s.fs,s.zw,wt,xi,(i*npt/nthreads),((i+1)*npt/nthreads-1),nord) 
     305//              Print trunc(i*npt/nthreads),trunc((i+1)*npt/nthreads-1) 
     306                ThreadStart mt,i,SmearedSphere2D_T(s.coefW,s.xw[0],s.xw[1],s.qz,s.sQpl,s.sQpp,s.fs,s.zw,wt,xi,trunc(i*npt/nthreads),trunc((i+1)*npt/nthreads-1),nord) 
    307307        endfor 
    308308 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Include_Polarization.ipf

    r805 r816  
    88// JUN 2011 SRK 
    99         
    10 #include "PolCorr" 
    11 #include "PolarizationPanels" 
    12 #include "PolarizationCorrection" 
    13 #include "FlipperPanel" 
     10//#include "Pol_PolCorr" 
     11#include "Pol_PolarizationPanels" 
     12#include "Pol_PolarizationCorrection" 
     13#include "Pol_FlipperPanel" 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MultScatter_MonteCarlo_2D.ipf

    r813 r816  
    15591559        NVAR ctTime = root:Packages:NIST:SAS:gCntTime 
    15601560 
     1561        // make the error wave, if data is exported as qxqy 
     1562        Duplicate/O linear_data root:Packages:NIST:SAS:linear_data_error 
     1563        WAVE linear_data_error = root:Packages:NIST:SAS:linear_data_error 
     1564        linear_data_error = 1 + sqrt(linear_data + 0.75)                 
     1565         
    15611566        if(!rawCts)                     //go ahead and do the abs scaling to the linear_data 
    15621567                linear_data = linear_data / kappa 
    15631568                linear_data /= detectorEff 
     1569                linear_data_error /= kappa 
    15641570        endif 
    15651571         
Note: See TracChangeset for help on using the changeset viewer.