Changeset 4915


Ignore:
Timestamp:
May 26, 2021 7:43:09 AM (4 months ago)
Author:
vondreele
Message:

add some doc strings for profile functions in G2pwd
rename getPowderProfileDervMP as getPowderProfileDerv since it is more generally used than just multiprocessing

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwd.py

    r4880 r4915  
    11261126    return dydb,dyddb,dydpk,dydfb
    11271127
    1128 #use old fortran routine
     1128#### Using old gsas fortran routines for powder peak shapes & derivatives
    11291129def getFCJVoigt3(pos,sig,gam,shl,xdata):
    11301130    '''Compute the Finger-Cox-Jepcoat modified Pseudo-Voigt function for a
     
    11321132    '''
    11331133    Df = pyd.pypsvfcj(len(xdata),xdata-pos,pos,sig,gam,shl)
    1134 #    Df = pyd.pypsvfcjo(len(xdata),xdata-pos,pos,sig,gam,shl)
    11351134    Df /= np.sum(Df)
    11361135    return Df
     
    11411140    '''
    11421141    Df,dFdp,dFds,dFdg,dFdsh = pyd.pydpsvfcj(len(xdata),xdata-pos,pos,sig,gam,shl)
    1143 #    Df,dFdp,dFds,dFdg,dFdsh = pyd.pydpsvfcjo(len(xdata),xdata-pos,pos,sig,gam,shl)
    11441142    return Df,dFdp,dFds,dFdg,dFdsh
    11451143
    11461144def getPsVoigt(pos,sig,gam,xdata):
    1147     'needs a doc string'
     1145    '''Compute the simple Pseudo-Voigt function for a
     1146    small angle Bragg peak in external Fortran routine
     1147    '''
    11481148   
    11491149    Df = pyd.pypsvoigt(len(xdata),xdata-pos,sig,gam)
     
    11521152
    11531153def getdPsVoigt(pos,sig,gam,xdata):
    1154     'needs a doc string'
     1154    '''Compute the simple Pseudo-Voigt function derivatives for a
     1155    small angle Bragg peak peak in external Fortran routine
     1156    '''
    11551157   
    11561158    Df,dFdp,dFds,dFdg = pyd.pydpsvoigt(len(xdata),xdata-pos,sig,gam)
     
    11581160
    11591161def getEpsVoigt(pos,alp,bet,sig,gam,xdata):
    1160     'needs a doc string'
     1162    '''Compute the double exponential Pseudo-Voigt convolution function for a
     1163    neutron TOF & CW pink peak in external Fortran routine
     1164    '''
     1165   
    11611166    Df = pyd.pyepsvoigt(len(xdata),xdata-pos,alp,bet,sig,gam)
    11621167    Df /= np.sum(Df)
     
    11641169   
    11651170def getdEpsVoigt(pos,alp,bet,sig,gam,xdata):
    1166     'needs a doc string'
     1171    '''Compute the double exponential Pseudo-Voigt convolution function derivatives for a
     1172    neutron TOF & CW pink peak in external Fortran routine
     1173    '''
     1174   
    11671175    Df,dFdp,dFda,dFdb,dFds,dFdg = pyd.pydepsvoigt(len(xdata),xdata-pos,alp,bet,sig,gam)
    11681176    return Df,dFdp,dFda,dFdb,dFds,dFdg   
    11691177
    11701178def ellipseSize(H,Sij,GB):
    1171     'Implements r=1/sqrt(sum((1/S)*(q.v)^2) per note from Alexander Brady'
     1179    '''Implements r=1/sqrt(sum((1/S)*(q.v)^2) per note from Alexander Brady
     1180    '''
     1181   
    11721182    HX = np.inner(H.T,GB)
    11731183    lenHX = np.sqrt(np.sum(HX**2))
     
    11781188
    11791189def ellipseSizeDerv(H,Sij,GB):
    1180     'needs a doc string'
     1190    '''Implements r=1/sqrt(sum((1/S)*(q.v)^2) derivative per note from Alexander Brady
     1191    '''
     1192   
    11811193    lenR = ellipseSize(H,Sij,GB)
    11821194    delt = 0.001
  • trunk/GSASIIstrMath.py

    r4914 r4915  
    30613061                            profArgs[iref%G2mp.ncores].append((refl,iref))
    30623062                        else:
    3063                             icod= G2mp.ComputeFobsSqCW(refl,iref)
     3063                            icod = G2mp.ComputeFobsSqCW(refl,iref)
    30643064                            if type(icod) is tuple:
    30653065                                refl[8+im] = icod[0]
     
    30873087                            profArgs[iref%G2mp.ncores].append((refl,iref))
    30883088                        else:
    3089                             icod= G2mp.ComputeFobsSqTOF(refl,iref)
     3089                            icod = G2mp.ComputeFobsSqTOF(refl,iref)
    30903090                            if type(icod) is tuple:
    30913091                                refl[8+im] = icod[0]
     
    31133113                            profArgs[iref%G2mp.ncores].append((refl,iref))
    31143114                        else:
    3115                             icod= G2mp.ComputeFobsSqPink(refl,iref)
     3115                            icod = G2mp.ComputeFobsSqPink(refl,iref)
    31163116                            if type(icod) is tuple:
    31173117                                refl[8+im] = icod[0]
     
    31413141                for iref,refl in enumerate(refDict['RefList']):
    31423142                    Fo = np.sqrt(np.abs(refl[8+im]))
    3143                     Fc = np.sqrt(np.abs(refl[9]+im))
     3143                    Fc = np.sqrt(np.abs(refl[9+im]))
    31443144                    sumFo += Fo
    31453145                    sumFosq += refl[8+im]**2
     
    34223422    return yc,yb
    34233423   
    3424 def getPowderProfileDervMP(args):
     3424def getPowderProfileDerv(args):
    34253425    '''Computes the derivatives of the computed powder pattern with respect to all
    34263426    refined parameters.
    3427     Multiprocessing version.
     3427    Used for single processor & Multiprocessor versions
    34283428    '''
    34293429    import pytexture as ptx
     
    39273927            xB = np.searchsorted(x,Limits[0])
    39283928            xF = np.searchsorted(x,Limits[1])+1
    3929             dMdv,depDerivDict = getPowderProfileDervMP([parmDict,x[xB:xF],
     3929            dMdv,depDerivDict = getPowderProfileDerv([parmDict,x[xB:xF],
    39303930                varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars])
    39313931            G2mv.Dict2Deriv(varylist,depDerivDict,dMdv)
     
    39993999#                    (parmDict,x[xB:xF],varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars,
    40004000#                     i,ncores,histogram) for i in range(ncores)]
    4001 #                for dmdv,depDerivs in MPpool.imap_unordered(getPowderProfileDervMP,profArgs):
     4001#                for dmdv,depDerivs in MPpool.imap_unordered(getPowderProfileDerv,profArgs):
    40024002                # better, use a generator so arg is created as used
    40034003                profGenArgs = (
    40044004                    (parmDict,x[xB:xF],varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars,
    40054005                     i,ncores,histogram) for i in range(ncores))
    4006                 for dmdv,depDerivs in MPpool.imap_unordered(getPowderProfileDervMP,profGenArgs):
     4006                for dmdv,depDerivs in MPpool.imap_unordered(getPowderProfileDerv,profGenArgs):
    40074007                    if dMdvh is None:
    40084008                       dMdvh = dmdv
     
    40134013                MPpool.terminate()
    40144014            else:
    4015                 dMdvh,depDerivDict = getPowderProfileDervMP([parmDict,x[xB:xF],
     4015                dMdvh,depDerivDict = getPowderProfileDerv([parmDict,x[xB:xF],
    40164016                    varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars,0,1,histogram])
    40174017                #dMdvh = getPowderProfileDerv(parmDict,x[xB:xF],
Note: See TracChangeset for help on using the changeset viewer.