Changeset 1341 for trunk/GSASIIsasd.py


Ignore:
Timestamp:
May 12, 2014 12:32:16 PM (7 years ago)
Author:
vondreele
Message:

SASD smearing now works
some work with SASD plots

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIsasd.py

    r1339 r1341  
    993993    Fin = np.min([rx[-1],x[-1],Limits[1][1],refLimits[1][1]])
    994994    iBeg = np.searchsorted(x,Beg)
    995     iFin = np.searchsorted(x,Fin)
     995    iFin = np.searchsorted(x,Fin)+1        #include last point
    996996    sum = np.sum(y[iBeg:iFin])
    997997    refsum = np.sum(np.interp(x[iBeg:iFin],rx,ry,0,0))
     
    10011001    return (G*P/Rg**P)*np.exp(scsp.gammaln(P/2))
    10021002   
    1003 def SmearData(Ic,Q,slitLen):
    1004     Qtemp = np.concatenate([Q,20*Q])
    1005     Ictemp = np.concatenate([Ic,np.zeros_like(Ic)])
    1006     print Ictemp
    1007     Icsm = np.zeros_like(Qtemp)
     1003def SmearData(Ic,Q,slitLen,Back):
    10081004    Np = Q.shape[0]
     1005    Qtemp = np.concatenate([Q,Q[-1]+20*Q])
     1006    Ictemp = np.concatenate([Ic,Ic[-1]*(1-(Qtemp[Np:]-Qtemp[Np])/(20*Qtemp[Np-1]))])
     1007    Icsm = np.zeros_like(Q)
    10091008    Qsm = 2*slitLen*(np.interp(np.arange(2*Np)/2.,np.arange(Np),Q)-Q[0])/(Q[-1]-Q[0])
    10101009    Sp = np.searchsorted(Qsm,slitLen)
    1011     for i in range(Np):
    1012         Ism = np.interp(np.sqrt(Q[i]**2+Qsm**2),Qtemp,Ictemp)
    1013         print Ism
    1014         raise Exception
    1015         Icsm[i] = np.sum(Ism[:Sp])
     1010    DQsm = np.diff(Qsm)[:Sp]
     1011    Ism = np.interp(np.sqrt(Q[:,np.newaxis]**2+Qsm**2),Qtemp,Ictemp)
     1012    Icsm = np.sum((Ism[:,:Sp]*DQsm),axis=1)
    10161013    Icsm /= slitLen
    1017     return Icsm   #for now
     1014    return Icsm
    10181015   
    10191016###############################################################################
     
    10481045    wtFactor = ProfDict['wtFactor']
    10491046    Ibeg = np.searchsorted(Q,Qmin)
    1050     Ifin = np.searchsorted(Q,Qmax)
     1047    Ifin = np.searchsorted(Q,Qmax)+1        #include last point
    10511048    BinMag = np.zeros_like(Bins)
    10521049    Ic[:] = 0.
     
    12251222        slitLen = Sample['SlitLen']
    12261223        if slitLen:
    1227             Ic = SmearData(Ic,Q,slitLen)
     1224            Ic = SmearData(Ic,Q,slitLen,parmDict['Back'])
    12281225        return Ic
    12291226       
     
    12331230    wtFactor = ProfDict['wtFactor']
    12341231    Ibeg = np.searchsorted(Q,Qmin)
    1235     Ifin = np.searchsorted(Q,Qmax)
     1232    Ifin = np.searchsorted(Q,Qmax)+1    #include last point
    12361233    Ic[:] = 0
    12371234    levelTypes,parmDict,varyList,values = GetModelParms()
     
    13011298    wtFactor = ProfDict['wtFactor']
    13021299    Ibeg = np.searchsorted(Q,Qmin)
    1303     Ifin = np.searchsorted(Q,Qmax)
     1300    Ifin = np.searchsorted(Q,Qmax)+1    #include last point
    13041301    Ib[:] = Back[0]
    13051302    Ic[:] = 0
     
    13771374    slitLen = Sample['SlitLen']
    13781375    if slitLen:
    1379         Ic[Ibeg:Ifin] = SmearData(Ic,Q,slitLen)[Ibeg:Ifin]
     1376        Ic[Ibeg:Ifin] = SmearData(Ic,Q,slitLen,Back[0])[Ibeg:Ifin]
    13801377    sasdData['Size Calc'] = [Rbins,Dist]
    13811378   
Note: See TracChangeset for help on using the changeset viewer.