Changeset 3893
- Timestamp:
- Apr 12, 2019 3:35:08 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r3888 r3893 3651 3651 3652 3652 def getRhos(XYZ,rho): 3653 ''' get scattering density at a point by 8-point interpolation3653 ''' get scattering density at an array of point by 8-point interpolation 3654 3654 param xyz: array coordinates to be probed Nx3 3655 3655 param: rho: array copy of map (NB: don't use original!) … … 3657 3657 :returns: density at xyz 3658 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) 3659 rollMap = lambda rho,roll: np.roll(np.roll(np.roll(rho,roll[0],axis=0),roll[1],axis=1),roll[2],axis=2)[:2,:2,:2] 3660 3660 mapShape = np.array(rho.shape) 3661 3661 mapStep = 1./mapShape 3662 3662 X = XYZ%1. #get into unit cell 3663 3663 I = np.array(np.rint(X*mapShape),dtype='int') 3664 R = []3664 R = np.zeros(len(XYZ)) 3665 3665 for i,x in enumerate(X): 3666 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 3667 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)) 3668 RIJ = Rho[0,:2,:2]*(1.-D[0]) 3669 RI = RIJ[0]*(1.-D[1])+RIJ[1]*D[1] 3670 R[i] = RI[0]*(1.-D[2])+RI[1]*D[2] 3676 3671 return R 3677 3672 -
trunk/GSASIIplot.py
r3892 r3893 8707 8707 img, (width, height) = agg.print_to_buffer() 8708 8708 Zimg = np.frombuffer(img, np.uint8).reshape((height, width, 4)) 8709 # Zimg[:,:,3] = 128 #sets alpha to 25%8710 8709 RenderViewPlane(msize*eplane,Zimg,width,height) 8711 8710 8712 # print time.time()-time08713 8711 try: 8714 8712 if Page.context: Page.canvas.SetCurrent(Page.context)
Note: See TracChangeset
for help on using the changeset viewer.