Changeset 568 for trunk/GSASIImath.py


Ignore:
Timestamp:
Apr 20, 2012 4:06:42 PM (10 years ago)
Author:
vondreele
Message:

remove gsas data window placement
moved peaks are C atoms
start on a relocate map routine???

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r563 r568  
    580580    mapData['rhoMax'] = max(np.max(mapData['rho']),-np.min(mapData['rho']))
    581581    return mapData
     582   
     583def findRoll(SGData,rho,Fhkl):
     584    mapShape = rho.shape
     585    hklShape = Fhkl.shape
     586    mapHalf = np.array(mapShape)/2
     587    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],hklMax-hklHalf,hklHalf
     592   
     593    return [0,0,0]
    582594
    583595def ChargeFlip(data,reflData,pgbar):
     
    637649        CFrho = np.where(np.real(CErho) >= flipData['k-factor']*CEsig,CErho,-CErho)
    638650        CFhkl = fft.ifftshift(fft.ifftn(CFrho))
    639         CEhkl = np.absolute(Ehkl)*CFhkl/np.absolute(CFhkl)
     651        phase = CFhkl/np.absolute(CFhkl)
     652        CEhkl = np.absolute(Ehkl)*phase
    640653        Ncyc += 1
    641654        sumCF = np.sum(ma.array(np.absolute(CFhkl),mask=Emask))
     
    649662    print 'Charge flip time: %.4f'%(time.time()-time0),'no. elements: %d'%(Ehkl.size)
    650663    print 'No.cycles = ',Ncyc,'Residual Rcf =%8.3f%s'%(Rcf,'%')
    651     mapData['rho'] = np.real(fft.fftn(fft.fftshift(CEhkl)))
     664    CErho = np.real(fft.fftn(fft.fftshift(CEhkl)))
     665    roll = findRoll(SGData,CErho,CEhkl)
     666    mapData['rho'] = np.roll(np.roll(np.roll(CErho,roll[0],axis=0),roll[1],axis=1),roll[2],axis=2)
    652667    mapData['rhoMax'] = max(np.max(mapData['rho']),-np.min(mapData['rho']))
    653668    return mapData
Note: See TracChangeset for help on using the changeset viewer.