Changeset 805


Ignore:
Timestamp:
Nov 26, 2012 1:46:51 PM (10 years ago)
Author:
vondreele
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r803 r805  
    678678        return [0,0,0]   
    679679    hklShape = Fhkl.shape
    680     steps = np.array(hklShape)
    681     Hmax = 2*np.asarray(G2lat.getHKLmax(4.5,SGData,A),dtype='i')
    682     Fmax = np.max(np.absolute(Fhkl))
    683680    hklHalf = np.array(hklShape)/2
    684681    sortHKL = np.argsort(Fhkl.flatten())
     
    695692    DH = []
    696693    Dphi = []
    697     while i < 20 and len(DH) < 30:
    698         F = Flist[i]
     694    Hmax = 2*np.asarray(G2lat.getHKLmax(3.5,SGData,A),dtype='i')
     695    for F in Flist:
    699696        hkl = np.unravel_index(Fdict[F],hklShape)
    700697        iabsnt,mulp,Uniq,Phi = G2spc.GenHKLf(list(hkl-hklHalf),SGData)
     
    713710            DH.append(dH)
    714711            Dphi.append((dang+.5) % 1.0)
     712        if i > 20 or len(DH) > 30:
     713            break
    715714        i += 1
    716715    DH = np.array(DH)
    717     print ' map offset no.of terms: %d'%(len(DH))
     716    print ' map offset no.of terms: %d from %d reflections'%(len(DH),len(Flist))
    718717    Dphi = np.array(Dphi)
     718    steps = np.array(hklShape)
    719719    X,Y,Z = np.mgrid[0:1:1./steps[0],0:1:1./steps[1],0:1:1./steps[2]]
    720720    XYZ = np.array(zip(X.flatten(),Y.flatten(),Z.flatten()))
    721     Mmap = np.reshape(np.sum(((np.dot(XYZ,DH.T)+.5)%1.-Dphi)**2,axis=1),newshape=steps)/len(DH)
    722 #    hist,bins = np.histogram(Mmap,bins=1000)
     721    Dang = (np.dot(XYZ,DH.T)+.5)%1.-Dphi
     722    Mmap = np.reshape(np.sum((Dang)**2,axis=1),newshape=steps)/len(DH)
     723    hist,bins = np.histogram(Mmap,bins=1000)
    723724#    for i,item in enumerate(hist[:10]):
    724725#        print item,bins[i]
     
    726727    DX = -np.array(np.unravel_index(np.argmin(Mmap),Mmap.shape))
    727728    print ' map offset chi**2: %.3f, map offset: %d %d %d'%(chisq,DX[0],DX[1],DX[2])
     729#    print (np.dot(DX,DH.T)+.5)%1.-Dphi
    728730    return DX
    729731   
     
    942944    for ind in Ind:
    943945        xyz = np.array(mapPeaks[ind][1:4])
    944         xyzs = np.array([equiv[0] for equiv in G2spc.GenAtom(xyz,SGData,Move=True)])
     946        xyzs = np.array([equiv[0] for equiv in G2spc.GenAtom(xyz,SGData,Move=True)])
     947#        for x in xyzs: print x
    945948        for jnd,xyz in enumerate(XYZ):       
    946949            Indx[jnd] = Duplicate(xyz,xyzs,Amat)
Note: See TracChangeset for help on using the changeset viewer.