Changeset 658
- Timestamp:
- Jun 28, 2012 9:28:57 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r657 r658 522 522 else: 523 523 return text 524 525 def adjHKLmax(SGData,Hmax): 526 if SGData['SGLaue'] in ['3','3m1','31m','6/m','6/mmm']: 527 Hmax[0] = ((Hmax[0]+3)/6)*6 528 Hmax[1] = ((Hmax[1]+3)/6)*6 529 Hmax[2] = ((Hmax[2]+1)/4)*4 530 else: 531 Hmax[0] = ((Hmax[0]+2)/4)*4 532 Hmax[1] = ((Hmax[1]+2)/4)*4 533 Hmax[2] = ((Hmax[2]+1)/4)*4 524 534 525 535 def FourierMap(data,reflData): … … 535 545 A = G2lat.cell2A(cell[:6]) 536 546 Hmax = np.asarray(G2lat.getHKLmax(dmin,SGData,A),dtype='i')+1 547 adjHKLmax(SGData,Hmax) 537 548 Fhkl = np.zeros(shape=2*Hmax,dtype='c16') 538 549 # Fhkl[0,0,0] = generalData['F000X'] … … 610 621 ## keep this 611 622 612 def findOffset(SGData, rho,Fhkl):623 def findOffset(SGData,Fhkl): 613 624 if SGData['SpGrp'] == 'P 1': 614 625 return [0,0,0] 615 mapShape = rho.shape616 steps = np.array(mapShape)617 626 hklShape = Fhkl.shape 618 mapHalf = np.array(mapShape)/2627 steps = np.array(hklShape) 619 628 Fmax = np.max(np.absolute(Fhkl)) 620 629 hklHalf = np.array(hklShape)/2 … … 646 655 dH = H-hkl 647 656 dang = ang-ang0 648 if np.any(np.abs(dH)- 8> 0): #keep low order DHs657 if np.any(np.abs(dH)-6 > 0): #keep low order DHs 649 658 continue 650 659 DH.append(dH) … … 658 667 chisq = np.min(Mmap) 659 668 DX = -np.array(np.unravel_index(np.argmin(Mmap),Mmap.shape)) 660 print ' map offset chi**2: %.3f, map offset: %d %d %d '%(chisq,DX[0],DX[1],DX[2])669 print ' map offset chi**2: %.3f, map offset: %d %d %d, no. terms: %d'%(chisq,DX[0],DX[1],DX[2],len(DH)) 661 670 return DX 662 671 … … 678 687 Vol = cell[6] 679 688 Hmax = np.asarray(G2lat.getHKLmax(dmin,SGData,A),dtype='i')+1 689 adjHKLmax(SGData,Hmax) 680 690 Ehkl = np.zeros(shape=2*Hmax,dtype='c16') #2X64bits per complex no. 681 691 time0 = time.time() … … 735 745 print ' No.cycles = ',Ncyc,'Residual Rcf =%8.3f%s'%(Rcf,'%')+' Map size:',CErho.shape 736 746 CErho = np.real(fft.fftn(fft.fftshift(CEhkl))) 737 roll = findOffset(SGData,CE rho,CEhkl)747 roll = findOffset(SGData,CEhkl) 738 748 739 749 mapData['Rcf'] = Rcf … … 747 757 norm = 1./(np.sqrt(3.)*np.sqrt(2.*np.pi)**3) 748 758 749 def no Duplicate(xyz,peaks,SGData,incre): #be careful where this is used - it's slow759 def noEquivalent(xyz,peaks,SGData): #be careful where this is used - it's slow 750 760 equivs = G2spc.GenAtom(xyz,SGData) 751 761 xyzs = [equiv[0] for equiv in equivs] … … 754 764 return False 755 765 return True 756 766 767 def noDuplicate(xyz,peaks,incre): 768 if True in [np.allclose(xyz*incre,peak*incre,atol=2.0) for peak in peaks]: 769 return False 770 return True 771 757 772 def findRoll(rhoMask,mapHalf): 758 773 indx = np.array(ma.nonzero(rhoMask)).T … … 806 821 mapHalf = np.array(rho.shape)/2 807 822 res = mapData['Resolution'] 808 incre = 1./np.array(rho.shape)823 incre = np.array(rho.shape) 809 824 step = max(1.0,1./res)+1 810 825 steps = np.array(3*[step,]) … … 829 844 if np.any(x1 < 0): 830 845 break 831 peak = (np.array(x1[1:4])-rMI) *incre846 peak = (np.array(x1[1:4])-rMI)/incre 832 847 if not len(peaks): 833 848 peaks.append(peak) … … 835 850 else: 836 851 if keepDup: 837 peaks.append(peak) 838 mags.append(x1[0]) 839 elif noDuplicate(peak,peaks,SGData,incre) and x1[0] > 0.: 852 if noDuplicate(peak,peaks,incre): 853 peaks.append(peak) 854 mags.append(x1[0]) 855 elif noEquivalent(peak,peaks,SGData) and x1[0] > 0.: 840 856 peaks.append(peak) 841 857 mags.append(x1[0]) -
trunk/GSASIIphsGUI.py
r657 r658 3741 3741 Ind.sort() 3742 3742 Ind.reverse() 3743 print Ind3744 3743 for ind in Ind: 3745 3744 mapPeaks = np.delete(mapPeaks,ind,0)
Note: See TracChangeset
for help on using the changeset viewer.