Changeset 3945


Ignore:
Timestamp:
May 2, 2019 1:02:31 PM (2 years ago)
Author:
vondreele
Message:

fix 4D display of contour maps; now properly track with atom modulations

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r3941 r3945  
    36553655def getRhos(XYZ,rho):
    36563656    ''' get scattering density at an array of point by 8-point interpolation
     3657    this is faster than gerRho which is only used for single points. However, getRhos is
     3658    replaced by scipy.ndimage.interpolation.map_coordinates which does a better job &  is just as fast.
     3659    Thus, getRhos is unused in GSAS-II at this time.
    36573660    param xyz:  array coordinates to be probed Nx3
    36583661    param: rho: array copy of map (NB: don't use original!)
  • trunk/GSASIIplot.py

    r3942 r3945  
    88838883                    RenderPlane(plane,color)
    88848884        if drawingData.get('showSlice',False):
     8885            FourD = False
    88858886            if len(D4mapData.get('rho',[])):        #preferentially select 4D map if there
    8886                 rho = D4mapData['rho'][:,:,:,int(G2frame.tau*10)]   #pick current tau 3D slice
     8887                FourD = True
     8888                modQ = np.array(generalData['SuperVec'][0])
     8889                rho4D = D4mapData['rho']
    88878890            elif len(mapData['rho']):               #ordinary 3D map
    88888891                rho = mapData['rho']
     
    88908893                return
    88918894            Rmax = np.max(rho)*drawingData['contourMax']
     8895            from scipy.ndimage.interpolation import map_coordinates
    88928896            from matplotlib.backends.backend_agg import FigureCanvasAgg
    88938897            import matplotlib.pyplot as plt
     
    89018905            SXYZ = msize*np.dstack((SX,SY,np.zeros_like(SX)))
    89028906            SXYZ = np.reshape(np.inner(SXYZ,invModel[:3,:3].T)+VP[nxs,nxs,:],(-1,3))
    8903             Z = np.reshape(G2mth.getRhos(SXYZ,rho),(npts,npts))
     8907            if FourD:
     8908                SXYZT = np.vstack((SXYZ.T,np.inner(SXYZ,modQ)+G2frame.tau)).T
     8909                Z = np.reshape(map_coordinates(rho4D,(SXYZT*rho4D.shape).T,order=1,mode='wrap'),(npts,npts))
     8910            else:
     8911                Z = np.reshape(map_coordinates(rho,(SXYZ*rho.shape).T,order=1,mode='wrap'),(npts,npts))
    89048912            Z = np.where(Z<=Rmax,Z,Rmax)
    89058913            plt.rcParams['figure.facecolor'] = (1.,1.,1.,.5)
Note: See TracChangeset for help on using the changeset viewer.