Changeset 569 for trunk/GSASIImath.py
 Timestamp:
 Apr 23, 2012 4:17:29 PM (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIImath.py
r568 r569 581 581 return mapData 582 582 583 def find Roll(SGData,rho,Fhkl):583 def findOffset(SGData,rho,Fhkl): 584 584 mapShape = rho.shape 585 585 hklShape = Fhkl.shape 586 586 mapHalf = np.array(mapShape)/2 587 Fmax = np.max(np.absolute(Fhkl)) 587 588 hklHalf = np.array(hklShape)/2 588 mapMax = np.unravel_index(np.argmax(rho),mapShape) 589 print mapMax,rho[mapMax],mapHalf 590 hklMax = np.unravel_index(np.argmax(Fhkl),hklShape) 591 print hklMax,Fhkl[hklMax],hklMaxhklHalf,hklHalf 589 sortHKL = np.argsort(Fhkl.flatten()) 590 Fdict = {} 591 for hkl in sortHKL: 592 HKL = np.unravel_index(hkl,hklShape) 593 F = Fhkl[HKL[0]][HKL[1]][HKL[2]] 594 if F == 0.: 595 break 596 Fdict['%.6f'%(np.absolute(F))] = hkl 597 Flist = np.flipud(np.sort(Fdict.keys())) 598 F = str(1.e6) 599 i = 0 600 while float(F) > 0.5*Fmax: 601 F = Flist[i] 602 hkl = np.unravel_index(Fdict[F],hklShape) 603 iabsnt,mulp,Uniq,phi = G2spc.GenHKLf(list(hklhklHalf),SGData) 604 Uniq = np.array(Uniq,dtype='i') 605 Uniq = np.concatenate((Uniq,Uniq))+hklHalf 606 phi = np.concatenate((phi,phi)) 607 print hklhklHalf 608 for j,H in enumerate(Uniq): 609 Fh = Fhkl[H[0],H[1],H[2]] 610 h,k,l = HhklHalf 611 print '(%3d,%3d,%3d) %5.2f %9.5f'%(h,k,l,phi[j],np.angle(Fh,deg=True)) 612 i += 1 613 614 592 615 593 616 return [0,0,0] … … 663 686 print 'No.cycles = ',Ncyc,'Residual Rcf =%8.3f%s'%(Rcf,'%') 664 687 CErho = np.real(fft.fftn(fft.fftshift(CEhkl))) 665 roll = find Roll(SGData,CErho,CEhkl)688 roll = findOffset(SGData,CErho,CEhkl) 666 689 mapData['rho'] = np.roll(np.roll(np.roll(CErho,roll[0],axis=0),roll[1],axis=1),roll[2],axis=2) 667 690 mapData['rhoMax'] = max(np.max(mapData['rho']),np.min(mapData['rho']))
Note: See TracChangeset
for help on using the changeset viewer.