Changeset 3888 for trunk/GSASIImath.py


Ignore:
Timestamp:
Apr 11, 2019 3:59:48 PM (3 years ago)
Author:
vondreele
Message:

provide contour plot (not finished yet) on structure drawing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r3877 r3888  
    36503650    return R
    36513651       
     3652def getRhos(XYZ,rho):
     3653    ''' get scattering density at a point by 8-point interpolation
     3654    param xyz:  array coordinates to be probed Nx3
     3655    param: rho: array copy of map (NB: don't use original!)
     3656   
     3657    :returns: density at xyz
     3658    '''
     3659    rollMap = lambda rho,roll: np.roll(np.roll(np.roll(rho,roll[0],axis=0),roll[1],axis=1),roll[2],axis=2)
     3660    mapShape = np.array(rho.shape)
     3661    mapStep = 1./mapShape
     3662    X = XYZ%1.    #get into unit cell
     3663    I = np.array(np.rint(X*mapShape),dtype='int')
     3664    R = []
     3665    for i,x in enumerate(X):
     3666        D = x-I[i]*mapStep         #position inside map cell
     3667        D12 = D[0]*D[1]
     3668        D13 = D[0]*D[2]
     3669        D23 = D[1]*D[2]
     3670        D123 = np.prod(D)
     3671        Rho = rollMap(rho,-I[i])    #shifts map so point is in corner
     3672        R.append(Rho[0,0,0]*(1.-np.sum(D))+Rho[1,0,0]*D[0]+Rho[0,1,0]*D[1]+Rho[0,0,1]*D[2]+  \
     3673            Rho[1,1,1]*D123+Rho[0,1,1]*(D23-D123)+Rho[1,0,1]*(D13-D123)+Rho[1,1,0]*(D12-D123)+  \
     3674            Rho[0,0,0]*(D12+D13+D23-D123)-Rho[0,0,1]*(D13+D23-D123)-    \
     3675            Rho[0,1,0]*(D23+D12-D123)-Rho[1,0,0]*(D13+D12-D123))
     3676    return R
     3677       
    36523678def SearchMap(generalData,drawingData,Neg=False):
    36533679    '''Does a search of a density map for peaks meeting the criterion of peak
Note: See TracChangeset for help on using the changeset viewer.