Changeset 108


Ignore:
Timestamp:
Jul 7, 2010 4:08:38 PM (13 years ago)
Author:
vondreel
Message:

fix to GenHlaue?; add Hx2Rh & Rh2Hx
mod to ReadPDBPhase to use np.inner instead of np.sum
mod to ImRelease?
mods to ImageIntegrate?

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r94 r108  
    969969        elif 'ATOM' in S[:4] or 'HETATM' in S[:6]:
    970970            XYZ = [float(S[31:39]),float(S[39:47]),float(S[47:55])]
    971             XYZ = np.sum(AB*XYZ,axis=1)
     971            XYZ = np.inner(AB,XYZ)
    972972            SytSym,Mult = G2spc.SytSym(XYZ,SGData)
    973973            Uiso = float(S[61:67])/EightPiSq
  • trunk/GSASIIimage.py

    r104 r108  
    524524    t0 = time.time()
    525525    NST = np.zeros(shape=(numAzms,numChans),dtype=np.int,order='F')
    526     H0 = np.zeros(shape=(numAzms,numChans),order='F')
     526    H0 = np.zeros(shape=(numAzms,numChans),order='F',dtype=np.float32)
    527527    H1 = np.zeros(shape=(numAzms+1,))
    528528    H2 = np.zeros(shape=(numChans+1,))   
     529    HST = [H0,H1,H2]
    529530    NST,H0,H1,H2 = h2d.histogram2d(len(tax),tax,tay,taz,numAzms,numChans,LRazm,LUtth,NST,H0,H1,H2)
    530     HST = [H0,H1,H2]
    531     print "Binning elapsed time:","%8.3f"%(time.time()-t0), "s"
    532531    return NST,HST
    533532
     
    549548        print 'Bin image by 2-theta/azimuth intervals'
    550549        NST,HST = Bin2ThetaAzimuthMap(data,tax,tay,taz)
     550        print 'Binning complete'
    551551        del tax,tay,taz
    552552        dlg.Update(3)
    553553        print 'Form normalized 1D pattern(s)'
    554         self.Integrate = [HST[0]/NST,HST[1],HST[2]]
    555         del NST,HST
     554        HST[0] = np.divide(HST[0],NST)
     555        print 'Normalize done'
     556        self.Integrate = HST
     557        del NST
    556558        dlg.Update(4)
    557559        t1 = time.time()
  • trunk/GSASIIlattice.py

    r105 r108  
    149149       
    150150def MaxIndex(dmin,A):
    151     #finds maximum allowed hkl for given A within dmin
    152151    Hmax = [0,0,0]
    153152    try:
     
    186185    else:
    187186        return [H[2],H[0],H[1]]
     187       
     188def Rh2Hx(Rh):
     189    Hx = [0,0,0]
     190    Hx[0] = Rh[0]-Rh[1]
     191    Hx[1] = Rh[1]-Rh[2]
     192    Hx[2] = np.sum(Rh)
     193    return Hx
     194   
     195def Hx2Rh(Hx):
     196        Rh = [0,0,0]
     197        itk = -Hx[0]+Hx[1]+Hx[2]
     198        if itk%3 != 0:
     199            return 0        #error - not rhombohedral reflection
     200        else:
     201            Rh[1] = itk/3
     202            Rh[0] = Rh[1]+Hx[0]
     203            Rh[2] = Rh[1]-Hx[1]
     204            if Rh[0] < 0:
     205                for i in range(3):
     206                    Rh[i] = -Rh[i]
     207            return Rh
    188208       
    189209def CentCheck(Cent,H):
     
    368388# part of reciprocal space ignoring anomalous dispersion
    369389    import math
    370     Hmax = MaxIndex(dmin,A)
     390    #finds maximum allowed hkl for given A within dmin
     391    if Laue in ['3R','3mR']:        #Rhombohedral axes
     392        Hmax = [0,0,0]
     393        cell = A2cell(A)
     394        aHx = cell[0]*math.sqrt(2.0*(1.0-cosd(cell[3])))
     395        cHx = cell[0]*math.sqrt(3.0*(1.0+2.0*cosd(cell[3])))
     396        Hmax[0] = Hmax[1] = int(round(aHx/dmin))
     397        Hmax[2] = int(round(cHx/dmin))
     398        print Hmax,aHx,cHx
     399    else:                           # all others
     400        Hmax = MaxIndex(dmin,A)
     401       
    371402    dminsq = 1./(dmin**2)
    372403    HKL = []
     
    427458                if Laue in ['3R','3']:
    428459                    kmax = h
    429                     kmin = -int((h-1)/2.)
     460#                    kmin = -int((h-1.)/2.)
     461                    kmin = -(h-1)/2
    430462                else:
    431463                    kmin = 0
     
    436468                    H = []
    437469                    if CentCheck(Cent,[h,k,l]): H=[h,k,l]
     470                    if Laue in ['3R','3mR']:
     471                        H = Hx2Rh(H)
    438472                    if H:
    439473                        rdsq = calc_rDsq(H,A)
    440474                        if 0 < rdsq <= dminsq:
    441475                            HKL.append([h,k,l,1/math.sqrt(rdsq)])
     476                            print H,1/math.sqrt(rdsq)
    442477    else:                                   #cubic
    443478        for h in range(Hmax[0]+1):
     
    581616            assert np.allclose(ortho,to), msg
    582617            assert np.allclose(frac,tf), msg
     618            to = np.sum(A*frac,axis=1)
     619            tf = np.sum(B*to,axis=1)
     620            assert np.allclose(ortho,to), msg
     621            assert np.allclose(frac,tf), msg
    583622
    584623# test GetBraviasNum(...) and GenHBravais(...)
     
    649688        elif system == 'trigonal':
    650689            permlist = [(1,2,3),(2,1,3),(-1,-2,3),(-2,-1,3)]
     690        elif system == 'rhombohedral':
     691            permlist = [(1,2,3),(2,3,1),(3,1,2),(-1,-2,-3),(-2,-3,-1),(-3,-1,-2)]
    651692        else:
    652693            permlist = [(1,2,3)]
  • trunk/GSASIIplot.py

    r94 r108  
    665665        scalex = 1000./pixelSize[0]
    666666        scaley = 1000./pixelSize[1]
     667        print self.itemPicked
    667668        if self.itemPicked is None and PickName == 'Image Controls':
    668669            size = len(self.ImageZ)
     
    815816        interpolation='nearest',vmin=0,vmax=2,extent=[0,Xmax,Xmax,0])
    816817    Img = Plot.imshow(A,aspect='equal',cmap=acolor,
    817         interpolation='nearest',vmin=Imin,vmax=Imax,extent=[0,Xmax,Xmax,0],picker=True)
     818        interpolation='nearest',vmin=Imin,vmax=Imax,extent=[0,Xmax,Xmax,0])
    818819
    819820    Plot.plot(xcent,ycent,'x')
Note: See TracChangeset for help on using the changeset viewer.