Changeset 4547 for trunk/GSASIImath.py


Ignore:
Timestamp:
Aug 18, 2020 12:46:54 PM (3 years ago)
Author:
vondreele
Message:

AddToNotebook? routine added & implemented for peakfit & charge flipping

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r4542 r4547  
    33893389    Mmap = np.reshape(np.sum((Dang)**2,axis=1),newshape=steps)/len(DH)
    33903390    hist,bins = np.histogram(Mmap,bins=1000)
    3391 #    for i,item in enumerate(hist[:10]):
    3392 #        print item,bins[i]
    33933391    chisq = np.min(Mmap)
    33943392    DX = -np.array(np.unravel_index(np.argmin(Mmap),Mmap.shape))
    3395     G2fil.G2Print (' map offset chi**2: %.3f, map offset: %d %d %d'%(chisq,DX[0],DX[1],DX[2]))
    3396 #    print (np.dot(DX,DH.T)+.5)%1.-Dphi
    3397     return DX
     3393    ptext = ' map offset chi**2: %.3f, map offset: %d %d %d'%(chisq,DX[0],DX[1],DX[2])
     3394    G2fil.G2Print(ptext)
     3395    return DX,ptext
    33983396   
    33993397def ChargeFlip(data,reflDict,pgbar):
     
    34883486    G2fil.G2Print (' Charge flip time: %.4f'%(time.time()-time0),'no. elements: %d'%(Ehkl.size))
    34893487    CErho = np.real(fft.fftn(fft.fftshift(CEhkl)))/10.  #? to get on same scale as e-map
    3490     G2fil.G2Print (' No.cycles = %d Residual Rcf =%8.3f%s Map size: %s'%(Ncyc,Rcf,'%',str(CErho.shape)))
    3491     roll = findOffset(SGData,A,CEhkl)               #CEhkl needs to be just the observed set, not the full set!
     3488    ctext = ' No.cycles = %d Residual Rcf =%8.3f%s Map size: %s'%(Ncyc,Rcf,'%',str(CErho.shape))
     3489    G2fil.G2Print (ctext)
     3490    roll,ptext = findOffset(SGData,A,CEhkl)               #CEhkl needs to be just the observed set, not the full set!
    34923491       
    34933492    mapData['Rcf'] = Rcf
     
    34963495    mapData['minmax'] = [np.max(mapData['rho']),np.min(mapData['rho'])]
    34973496    mapData['Type'] = reflDict['Type']
    3498     return mapData,twophases
     3497    return mapData,twophases,ptext,ctext
    34993498   
    35003499def findSSOffset(SGData,SSGData,A,Fhklm):   
     
    35553554    Mmap = np.reshape(np.sum((Dang)**2,axis=1),newshape=steps)/len(DH)
    35563555    hist,bins = np.histogram(Mmap,bins=1000)
    3557 #    for i,item in enumerate(hist[:10]):
    3558 #        print item,bins[i]
    35593556    chisq = np.min(Mmap)
    35603557    DX = -np.array(np.unravel_index(np.argmin(Mmap),Mmap.shape))
    3561     G2fil.G2Print (' map offset chi**2: %.3f, map offset: %d %d %d %d'%(chisq,DX[0],DX[1],DX[2],DX[3]))
    3562 #    print (np.dot(DX,DH.T)+.5)%1.-Dphi
    3563     return DX
     3558    ptext = ' map offset chi**2: %.3f, map offset: %d %d %d %d'%(chisq,DX[0],DX[1],DX[2],DX[3])
     3559    G2fil.G2Print(ptext)
     3560    return DX,ptext
    35643561   
    35653562def SSChargeFlip(data,reflDict,pgbar):
     
    36503647    CErho = np.real(fft.fftn(fft.fftshift(CEhkl[:,:,:,maxM+1])))/10.    #? to get on same scale as e-map
    36513648    SSrho = np.real(fft.fftn(fft.fftshift(CEhkl)))/10.                  #? ditto
    3652     G2fil.G2Print (' No.cycles = %d Residual Rcf =%8.3f%s Map size: %s'%(Ncyc,Rcf,'%',str(CErho.shape)))
    3653     roll = findSSOffset(SGData,SSGData,A,CEhkl)               #CEhkl needs to be just the observed set, not the full set!
     3649    ctext = ' No.cycles = %d Residual Rcf =%8.3f%s Map size: %s'%(Ncyc,Rcf,'%',str(CErho.shape))
     3650    G2fil.G2Print (ctext)
     3651    roll,ptext = findSSOffset(SGData,SSGData,A,CEhkl)               #CEhkl needs to be just the observed set, not the full set!
    36543652
    36553653    mapData['Rcf'] = Rcf
     
    36643662    map4DData['minmax'] = [np.max(map4DData['rho']),np.min(map4DData['rho'])]
    36653663    map4DData['Type'] = reflDict['Type']
    3666     return mapData,map4DData
     3664    return mapData,map4DData,ptext,ctext
    36673665   
    36683666def getRho(xyz,mapData):
Note: See TracChangeset for help on using the changeset viewer.