Changeset 3425
 Timestamp:
 Jun 8, 2018 8:53:57 AM (4 years ago)
 Location:
 trunk
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIphsGUI.py
r3418 r3425 5824 5824 5825 5825 def OnBackColor(event): 5826 drawingData['backColor'] = event.GetValue()5826 drawingData['backColor'] = list(event.GetValue())[:3] 5827 5827 G2plt.PlotStructure(G2frame,data) 5828 5828 … … 5979 5979 5980 5980 def OnPlaneColor(event): 5981 drawingData['Plane'][4] = event.GetValue()5981 drawingData['Plane'][4] = list(event.GetValue())[:3] 5982 5982 G2plt.PlotStructure(G2frame,data) 5983 5983 
trunk/GSASIIplot.py
r3403 r3425 3096 3096 '''Respond to a change in color 3097 3097 ''' 3098 lbl = plotOpt['colorButtons'].get( event.GetEventObject())3098 lbl = plotOpt['colorButtons'].get(list(event.GetEventObject())[:3]) 3099 3099 if lbl is None: 3100 3100 print('Unexpected button',lbl) 
trunk/GSASIIspc.py
r3418 r3425 28 28 npsind = lambda x: np.sin(x*np.pi/180.) 29 29 npcosd = lambda x: np.cos(x*np.pi/180.) 30 nxs = np.newaxis 30 31 DEBUG = False 31 32 … … 1961 1962 return True 1962 1963 1964 def checkHKLextc(HKL,SGData): 1965 Ops = SGData['SGOps'] 1966 OpM = np.array([op[0] for op in Ops]) 1967 OpT = np.array([op[1] for op in Ops]) 1968 HKLS = np.array([HKL,HKL]) #Freidel's Law 1969 DHKL = np.reshape(np.inner(HKLS,OpM)HKL,(1,3)) 1970 PHKL = np.reshape(np.inner(HKLS,OpT),(1,)) 1971 for dhkl,phkl in zip(DHKL,PHKL)[1:]: #skip identity 1972 if dhkl.any(): 1973 continue 1974 else: 1975 if phkl%1.: 1976 return False 1977 return True 1978 1979 def checkMagextc(HKL,SGData): 1980 Ops = SGData['SGOps'] 1981 Spn = SGData['SpnFlp'][:len(Ops)] 1982 OpM = np.array([op[0] for op in Ops]) 1983 OpT = np.array([op[1] for op in Ops]) 1984 Mag = np.array([nl.det(opm) for opm in OpM])*Spn 1985 HKLS = np.array([HKL,HKL]) #Freidel's Law 1986 DHKL = np.reshape(np.inner(HKLS,OpM)*Mag[nxs,:,nxs],(1,3)) 1987 PHKL = np.reshape(np.inner(HKLS,OpT),(1,)) 1988 for dhkl,phkl in zip(DHKL,PHKL)[1:]: #skip identity 1989 if not np.allclose(dhkl,HKL): 1990 continue 1991 else: 1992 print(dhkl,HKL,phkl) 1993 if phkl%1.: 1994 return False 1995 return True 1963 1996 1964 1997 def checkSSextc(HKL,SSGData): … … 2277 2310 2278 2311 def fracCrenel(tau,Toff,Twid): 2279 Tau = (tauToff[:,n p.newaxis])%1.2280 A = np.where(Tau<Twid[:,n p.newaxis],1.,0.)2312 Tau = (tauToff[:,nxs])%1. 2313 A = np.where(Tau<Twid[:,nxs],1.,0.) 2281 2314 return A 2282 2315 … … 2284 2317 SA = np.sin(2.*nH*np.pi*tau) 2285 2318 CB = np.cos(2.*nH*np.pi*tau) 2286 A = SA[n p.newaxis,np.newaxis,:]*fsin[:,:,np.newaxis]2287 B = CB[n p.newaxis,np.newaxis,:]*fcos[:,:,np.newaxis]2319 A = SA[nxs,nxs,:]*fsin[:,:,nxs] 2320 B = CB[nxs,nxs,:]*fcos[:,:,nxs] 2288 2321 return A+B 2289 2322 … … 2291 2324 SA = np.sin(2*nH*np.pi*tau) 2292 2325 CB = np.cos(2*nH*np.pi*tau) 2293 A = SA[n p.newaxis,np.newaxis,:]*psin[:,:,np.newaxis]2294 B = CB[n p.newaxis,np.newaxis,:]*pcos[:,:,np.newaxis]2326 A = SA[nxs,nxs,:]*psin[:,:,nxs] 2327 B = CB[nxs,nxs,:]*pcos[:,:,nxs] 2295 2328 return A+B 2296 2329 2297 2330 def posSawtooth(tau,Toff,slopes): 2298 2331 Tau = (tauToff)%1. 2299 A = slopes[:,n p.newaxis]*Tau2332 A = slopes[:,nxs]*Tau 2300 2333 return A 2301 2334 … … 2380 2413 delt6 = np.eye(6)*0.001 2381 2414 if 'Fourier' in waveType: 2382 dX = posFourier(tau,nH,delt6[:3],delt6[3:]) #+np.array(XYZ)[:,n p.newaxis,np.newaxis]2415 dX = posFourier(tau,nH,delt6[:3],delt6[3:]) #+np.array(XYZ)[:,nxs,nxs] 2383 2416 #3x6x12 modulated position array (X,Spos,tau)& force positive 2384 2417 CSI = [np.zeros((6,3),dtype='i'),np.zeros((6,3))] … … 2402 2435 xsc = np.ones(6,dtype='i') 2403 2436 if 'Fourier' in waveType: 2404 dXT = posFourier(np.sort(tauT),nH,delt6[:3],delt6[3:]) #+np.array(XYZ)[:,n p.newaxis,np.newaxis]2437 dXT = posFourier(np.sort(tauT),nH,delt6[:3],delt6[3:]) #+np.array(XYZ)[:,nxs,nxs] 2405 2438 elif waveType == 'Sawtooth': 2406 dXT = posSawtooth(tauT,delt4[0],delt4[1:])+np.array(XYZ)[:,n p.newaxis,np.newaxis]2439 dXT = posSawtooth(tauT,delt4[0],delt4[1:])+np.array(XYZ)[:,nxs,nxs] 2407 2440 elif waveType == 'ZigZag': 2408 dXT = posZigZag(tauT,delt5[:2],delt5[2:])+np.array(XYZ)[:,n p.newaxis,np.newaxis]2441 dXT = posZigZag(tauT,delt5[:2],delt5[2:])+np.array(XYZ)[:,nxs,nxs] 2409 2442 elif waveType == 'Block': 2410 dXT = posBlock(tauT,delt5[:2],delt5[2:])+np.array(XYZ)[:,n p.newaxis,np.newaxis]2443 dXT = posBlock(tauT,delt5[:2],delt5[2:])+np.array(XYZ)[:,nxs,nxs] 2411 2444 dXT = np.inner(sop[0],dXT.T) # X modulations array(3x6x49) > array(3x49x6) 2412 2445 dXT = np.swapaxes(dXT,1,2) # back to array(3x6x49) … … 2592 2625 else: 2593 2626 delt6 = np.eye(6)*0.001 2594 dM = posFourier(tau,nH,delt6[:3],delt6[3:]) #+np.array(Mxyz)[:,n p.newaxis,np.newaxis]2627 dM = posFourier(tau,nH,delt6[:3],delt6[3:]) #+np.array(Mxyz)[:,nxs,nxs] 2595 2628 #3x6x12 modulated moment array (M,Spos,tau)& force positive 2596 2629 CSI = [np.zeros((6,3),dtype='i'),np.zeros((6,3))] … … 2602 2635 sdet,ssdet,dtau,dT,tauT = getTauT(tau,sop,ssop,XYZ) 2603 2636 msc = np.ones(6,dtype='i') 2604 dMT = posFourier(np.sort(tauT),nH,delt6[:3],delt6[3:]) #+np.array(XYZ)[:,n p.newaxis,np.newaxis]2637 dMT = posFourier(np.sort(tauT),nH,delt6[:3],delt6[3:]) #+np.array(XYZ)[:,nxs,nxs] 2605 2638 dMT = np.inner(sop[0],dMT.T) # X modulations array(3x6x49) > array(3x49x6) 2606 2639 dMT = np.swapaxes(dMT,1,2) # back to array(3x6x49) … … 2893 2926 U = np.inner(A.T,H) 2894 2927 S = np.array(MustrainCoeff(U,SGData)) 2895 Sum = np.sqrt(np.sum(np.multiply(S,Shkl[:,n p.newaxis]),axis=0))2896 rad = np.sqrt(np.sum((Sum[:,n p.newaxis]*H)**2,axis=1))2928 Sum = np.sqrt(np.sum(np.multiply(S,Shkl[:,nxs]),axis=0)) 2929 rad = np.sqrt(np.sum((Sum[:,nxs]*H)**2,axis=1)) 2897 2930 return (muisorad)**2 2898 2931
Note: See TracChangeset
for help on using the changeset viewer.