Changeset 4547


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

AddToNotebook? routine added & implemented for peakfit & charge flipping

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r4534 r4547  
    25862586        if not newHistList: return # somehow, no new histograms
    25872587        return # success
    2588        
     2588   
     2589    def AddToNotebook(self,text):
     2590        Id =  GetGPXtreeItemId(self,self.root,'Notebook')
     2591        data = self.GPXtree.GetItemPyData(Id)
     2592        data.append('Notebook entry @ %s: %s\n'%(time.ctime(),text))   
     2593                   
    25892594###############################################################################
    25902595#Command logging
     
    62356240        self.PostfillDataMenu()
    62366241    # end of GSAS-II menu definitions
    6237                    
     6242   
    62386243################################################################################
    62396244#####  Notebook Tree Item editor
     
    62596264    G2frame.dataWindow.GetSizer().Add(wx.StaticText(G2frame.dataWindow,-1,' Add notes on project here: '),0,WACV)
    62606265    G2frame.dataWindow.GetSizer().Add(text,1,wx.ALL|wx.EXPAND)
    6261            
     6266
    62626267################################################################################
    62636268#####  Comments
  • 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):
  • trunk/GSASIIphsGUI.py

    r4532 r4547  
    1215712157        finally:
    1215812158            pgbar.Destroy()
     12159        G2frame.AddToNotebook('4D Charge flip: '+result[2])
     12160        G2frame.AddToNotebook('4D Charge flip: '+result[3])
    1215912161        mapData.update(newMap)
    1216012162        map4DData.update(new4Dmap)
     
    1219412196        try:
    1219512197            result = G2mth.ChargeFlip(data,ReflData,pgbar)
     12198            G2frame.AddToNotebook('Charge flip: '+result[2])
     12199            G2frame.AddToNotebook('Charge flip: '+result[3])
    1219612200            mapData.update(result[0])
    1219712201            X = range(len(result[1]))
  • trunk/GSASIIpwdGUI.py

    r4541 r4547  
    890890            dlg.SetPosition(wx.Point(screenSize[2]-Size[0]-305,screenSize[1]+5))
    891891        try:
    892             peaks['sigDict'] = G2pwd.DoPeakFit(FitPgm,peaks['peaks'],background,limits,inst,inst2,data,bxye,[],oneCycle,controls,wtFactor,dlg)[0]
     892            results = G2pwd.DoPeakFit(FitPgm,peaks['peaks'],background,limits,inst,inst2,data,bxye,[],oneCycle,controls,wtFactor,dlg)
     893            peaks['sigDict'] = results[0]
     894            text = 'Peak fit: Rwp=%.2f%% Nobs= %d Nparm= %d Npeaks= %d'%(results[3]['Rwp'],results[1][2]['fjac'].shape[1],len(results[0]),len(peaks['peaks']))
    893895        finally:
    894896#            dlg.Destroy()
     
    896898        newpeaks = copy.copy(peaks)
    897899        G2frame.GPXtree.SetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Peak List'),newpeaks)
     900        G2frame.AddToNotebook(text)
    898901        G2plt.PlotPatterns(G2frame,plotType='PWDR')
    899902        wx.CallAfter(UpdatePeakGrid,G2frame,newpeaks)
Note: See TracChangeset for help on using the changeset viewer.