Changeset 82


Ignore:
Timestamp:
Jun 4, 2010 10:03:15 AM (12 years ago)
Author:
vondreel
Message:

split powder GUI stuff out of G2gd & put in new GSASIIpwdGUI.py - all seems to work

Location:
trunk
Files:
2 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r81 r82  
    1616import GSASIIgrid as G2gd
    1717import GSASIIplot as G2plt
     18import GSASIIpwdGUI as G2pdG
    1819
    1920# print versions
     
    10741075            if self.dataDisplay.GetName() == item:
    10751076                if item == 'Background':
    1076                     G2gd.UpdateBackgroundGrid(self,self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, item)))
     1077                    G2pdG.UpdateBackgroundGrid(self,self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, item)))
    10771078                elif item == 'Instrument Parameters':
    1078                     G2gd.UpdateInstrumentGrid(self,self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, item)))
     1079                    G2pdG.UpdateInstrumentGrid(self,self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, item)))
    10791080                elif item == 'Peak List':
    1080                     G2gd.UpdatePeakGrid(self,self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, item)))
     1081                    G2pdG.UpdatePeakGrid(self,self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, item)))
    10811082            print item,' recovered'
    10821083        file.close()
  • trunk/GSASIIgrid.py

    r81 r82  
    77import cPickle
    88import GSASIIpath
    9 import GSASIIcomp as G2cmp
     9import GSASIIpeak as G2pk
    1010import GSASIIlattice as G2lat
    1111import GSASIIindex as G2indx
     
    1515import GSASIIplot as G2plt
    1616import GSASIIIO as G2IO
     17import GSASIIpwdGUI as G2pdG
    1718
    1819# trig functions in degrees
     
    2930] = [wx.NewId() for _init_coll_IMAGE_Items in range(6)]
    3031
     32[ wxID_MASKCOPY,
     33] = [wx.NewId() for _init_coll_MASK_Items in range(1)]
     34
    3135[ wxID_INSTPRMRESET,
    3236] = [wx.NewId() for _init_coll_INST_Items in range(1)]
    33 
    34 [ wxID_MASKCOPY,
    35 ] = [wx.NewId() for _init_coll_MASK_Items in range(1)]
    3637
    3738[ wxID_UNDO,wxID_PEAKFIT,wxID_AUTOPEAKFIT,
     
    336337        for line in data:
    337338            self.dataDisplay.AppendText(line+"\n")
    338      
    339 def UpdatePeakGrid(self, data):
    340     if self.dataDisplay:
    341         self.dataDisplay.Destroy()
    342    
    343     def OnUnDo(event):
    344         DoUnDo()
    345         self.dataFrame.UnDo.Enable(False)
    346        
    347     def DoUnDo():
    348         print 'Undo last refinement'
    349         file = open('GSASII.save','rb')
    350         PatternId = self.PatternId
    351         for item in ['Background','Instrument Parameters','Peak List']:
    352             self.PatternTree.SetItemPyData(GetPatternTreeItemId(self,PatternId, item),cPickle.load(file))
    353             if self.dataDisplay.GetName() == item:
    354                 if item == 'Background':
    355                     UpdateBackgroundGrid(self,self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, item)))
    356                 elif item == 'Instrument Parameters':
    357                     UpdateInstrumentGrid(self,self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, item)))
    358                 elif item == 'Peak List':
    359                     UpdatePeakGrid(self,self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, item)))
    360             print item,' recovered'
    361         file.close()
    362        
    363     def OnPeakFit(event):
    364         self.SaveState()
    365         print 'Peak Fitting - Do one cycle of peak fitting'
    366         PatternId = self.PatternId
    367         PickId = self.PickId
    368         peaks = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, 'Peak List'))
    369         if not peaks:
    370             self.ErrorDialog('No peaks!','Nothing to fit!')
    371             return
    372         background = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, 'Background'))[0]
    373         limits = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, 'Limits'))[1]
    374         inst = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, 'Instrument Parameters'))
    375         data = self.PatternTree.GetItemPyData(PatternId)[1]
    376         OK,smin,Rwp,runtime,GoOn = G2cmp.DoPeakFit(peaks,background,limits,inst,data)
    377         UpdatePeakGrid(self,peaks)
    378         G2plt.PlotPatterns(self)
    379         if not OK:
    380             print 'Refinement failed'
    381             dlg = wx.MessageDialog(self, 'Do you want to reload now?', 'Refinement failed',  wx.YES_NO)
    382             try:
    383                 if dlg.ShowModal() == wx.ID_YES:
    384                     DoUnDo()
    385                     self.dataFrame.UnDo.Enable(False)
    386             finally:
    387                 dlg.Destroy()
    388         else:
    389             self.dataFrame.UnDo.Enable(True)
    390             print "%s%7.2f%s%12.6g" % ('Rwp = ',Rwp,'%, Smin = ',smin)
    391             print "%s%8.3f%s " % ('fitpeak time =',runtime,'s')
    392             print 'finished'
    393         return
    394        
    395     def OnAutoPeakFit(event):
    396         self.SaveState()
    397         print 'AutoPeak Fitting - run until minimized'
    398         PatternId = self.PatternId
    399         PickId = self.PickId
    400         peaks = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, 'Peak List'))
    401         if not peaks:
    402             self.ErrorDialog('No peaks!','Nothing to fit!')
    403             return
    404         background = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, 'Background'))[0]
    405         limits = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, 'Limits'))[1]
    406         inst = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, 'Instrument Parameters'))
    407         data = self.PatternTree.GetItemPyData(PatternId)[1]
    408         smin = 1.0e15
    409         GoOn = True
    410         while GoOn:
    411             osmin = smin
    412             OK,smin,Rwp,runtime,GoOn = G2cmp.DoPeakFit(peaks,background,limits,inst,data)
    413             UpdatePeakGrid(self,peaks)
    414             if not OK:
    415                 break
    416             G2plt.PlotPatterns(self)
    417             print "%s%7.2f%s%12.6g" % ('Rwp = ',Rwp,'%, Smin = ',smin)
    418             rat = (osmin-smin)/smin
    419             if rat < 1.0e-4: GoOn = False
    420         if not OK:
    421             print 'Refinement failed'
    422             dlg = wx.MessageDialog(self, 'Do you want to reload now?', 'Refinement failed',  wx.YES_NO)
    423             try:
    424                 if dlg.ShowModal() == wx.ID_YES:
    425                     DoUnDo()
    426                     self.dataFrame.UnDo.Enable(False)
    427             finally:
    428                 dlg.Destroy()
    429         else:
    430             self.dataFrame.UnDo.Enable(True)
    431             print "%s%8.3f%s " % ('fitpeak time =',runtime,'s per cycle')
    432             print 'finished'
    433         return       
    434 
    435     def RefreshPeakGrid(event):
    436         event.StopPropagation()
    437         data = self.PeakTable.GetData()
    438         T = []
    439         for peak in data:T.append(peak[0])
    440         D = dict(zip(T,data))
    441         T.sort()
    442         X = []
    443         for key in T: X.append(D[key])
    444         data = X       
    445         G2plt.PlotPatterns(self)
    446        
    447     def setBackgroundColors():
    448        for r in range(self.dataDisplay.GetNumberRows()):
    449            for c in range(self.dataDisplay.GetNumberCols()):
    450                if self.dataDisplay.GetColLabelValue(c) in ['position','intensity','sigma','gamma']:
    451                    if float(self.dataDisplay.GetCellValue(r,c)) < 0.:
    452                        self.dataDisplay.SetCellBackgroundColour(r,c,wx.RED)
    453                    else:
    454                        self.dataDisplay.SetCellBackgroundColour(r,c,wx.WHITE)
    455                            
    456     def KeyEditPeakGrid(event):
    457         rowList = self.dataDisplay.GetSelectedRows()
    458         colList = self.dataDisplay.GetSelectedCols()
    459         selectList = self.dataDisplay.GetSelectedCells()
    460         data = self.PatternTree.GetItemPyData(self.PickId)
    461         if event.GetKeyCode() == wx.WXK_RETURN:
    462             event.Skip(True)
    463         elif event.GetKeyCode() == wx.WXK_CONTROL:
    464             event.Skip(True)
    465         elif event.GetKeyCode() == wx.WXK_SHIFT:
    466             event.Skip(True)
    467         elif rowList:
    468             self.dataDisplay.ClearSelection()
    469             if event.GetKeyCode() == wx.WXK_DELETE:
    470                 self.dataDisplay.ClearGrid()
    471                 rowList.reverse()
    472                 nDel = 0
    473                 for row in rowList:
    474                     self.PeakTable.DeleteRow(row)
    475                     nDel += 1
    476                 if nDel:
    477                     msg = wg.GridTableMessage(self.PeakTable,
    478                         wg.GRIDTABLE_NOTIFY_ROWS_DELETED,0,nDel)
    479                     self.dataDisplay.ProcessTableMessage(msg)
    480                 data = self.PeakTable.GetData()
    481                 self.PatternTree.SetItemPyData(self.PickId,data[:-nDel])
    482                 self.dataDisplay.ForceRefresh()
    483                 setBackgroundColors()
    484                 if not len(self.PatternTree.GetItemPyData(self.PickId)):
    485                     self.dataFrame.PeakFit.Enable(False)
    486                     self.dataFrame.AutoPeakFit.Enable(False)
    487                        
    488         elif colList:
    489             self.dataDisplay.ClearSelection()
    490             key = event.GetKeyCode()
    491             for col in colList:
    492                 if self.PeakTable.GetTypeName(0,col) == wg.GRID_VALUE_BOOL:
    493                     if key == 89: #'Y'
    494                         for row in range(self.PeakTable.GetNumberRows()): data[row][col]=True
    495                     elif key == 78:  #'N'
    496                         for row in range(self.PeakTable.GetNumberRows()): data[row][col]=False
    497         elif selectList:
    498             self.dataDisplay.ClearSelection()
    499             key = event.GetKeyCode()
    500             for row,col in selectList:
    501                 if self.PeakTable.GetTypeName(row,col) == wg.GRID_VALUE_BOOL:
    502                     if key == 89: #'Y'
    503                         data[row][col]=True
    504                     elif key == 78:  #'N'
    505                         data[row][col]=False
    506         G2plt.PlotPatterns(self)
    507            
    508     self.dataFrame.SetMenuBar(self.dataFrame.PeakMenu)
    509     if not self.dataFrame.GetStatusBar():
    510         Status = self.dataFrame.CreateStatusBar()
    511     self.Bind(wx.EVT_MENU, OnUnDo, id=wxID_UNDO)
    512     self.Bind(wx.EVT_MENU, OnPeakFit, id=wxID_PEAKFIT)
    513     self.Bind(wx.EVT_MENU, OnAutoPeakFit, id=wxID_AUTOPEAKFIT)
    514     self.dataFrame.PeakFit.Enable(False)
    515     self.dataFrame.AutoPeakFit.Enable(False)
    516     if data:
    517         self.dataFrame.PeakFit.Enable(True)
    518         self.dataFrame.AutoPeakFit.Enable(True)
    519     self.PickTable = []
    520     rowLabels = []
    521     for i in range(len(data)): rowLabels.append(str(i+1))
    522     colLabels = ['position','refine','intensity','refine','sigma','refine','gamma','refine']
    523     Types = [wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_BOOL,
    524         wg.GRID_VALUE_FLOAT+':10,1',wg.GRID_VALUE_BOOL,
    525         wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_BOOL,
    526         wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_BOOL]
    527     T = []
    528     for peak in data:
    529         T.append(peak[0])
    530     D = dict(zip(T,data))
    531     T.sort()
    532     X = []
    533     for key in T: X.append(D[key])
    534     data = X       
    535     self.PatternTree.SetItemPyData(self.PickId,data)
    536     self.PeakTable = Table(data,rowLabels=rowLabels,colLabels=colLabels,types=Types)
    537     self.dataFrame.SetLabel('Peak List')
    538     self.dataDisplay = GSGrid(parent=self.dataFrame)
    539     self.dataDisplay.SetTable(self.PeakTable, True)
    540     setBackgroundColors()                         
    541     self.dataDisplay.Bind(wg.EVT_GRID_CELL_CHANGE, RefreshPeakGrid)
    542     self.dataDisplay.Bind(wx.EVT_KEY_DOWN, KeyEditPeakGrid)                 
    543     self.dataDisplay.SetMargins(0,0)
    544     self.dataDisplay.AutoSizeColumns(False)
    545     self.dataFrame.setSizePosLeft([550,350])
    546        
    547 def UpdateBackgroundGrid(self,data):
    548     BackId = GetPatternTreeItemId(self,self.PatternId, 'Background')
    549    
    550     def RefreshBackgroundGrid(event):
    551         data = self.BackTable.GetData()
    552         M = len(data[0])
    553         N = data[0][2]+3
    554         item = data[0]
    555         if N > M:       #add terms
    556             for i in range(M,N):
    557                 item.append(0.0)
    558                 self.BackTable.SetColLabelValue(i,str(i-2))
    559             data = [item]
    560             msg = wg.GridTableMessage(self.BackTable,
    561                 wg.GRIDTABLE_NOTIFY_COLS_APPENDED,0,N-M)
    562             self.dataDisplay.ProcessTableMessage(msg)                         
    563         elif N < M:     #delete terms
    564             new = []
    565             for i in range(N):
    566                 new.append(item[i])
    567             data = [new]
    568             msg = wg.GridTableMessage(self.BackTable,
    569                 wg.GRIDTABLE_NOTIFY_COLS_DELETED,0,M-N)
    570             self.dataDisplay.ProcessTableMessage(msg)                         
    571         self.PatternTree.SetItemPyData(BackId,data)
    572                  
    573     self.dataFrame.setSizePosLeft([700,150])
    574     maxTerm = 7
    575     self.BackTable = []
    576     N = len(data[0])
    577     M = data[0][2]
    578     colLabels = ['function','refine','Nterms']
    579     rowLabels=['background']
    580     for i in range(M): colLabels.append(str(i+1))
    581     Types = [wg.GRID_VALUE_CHOICE+':chebyschev,another,more',
    582         wg.GRID_VALUE_BOOL,
    583         wg.GRID_VALUE_NUMBER+':1,'+str(maxTerm)]
    584     for i in range(maxTerm):
    585         Types.append(wg.GRID_VALUE_FLOAT+':10,3')
    586     self.BackTable = Table(data,rowLabels=rowLabels,colLabels=colLabels,types=Types)
    587     self.dataFrame.SetLabel('Background')
    588     self.dataFrame.SetMenuBar(self.dataFrame.BlankMenu)
    589     self.dataDisplay = GSGrid(parent=self.dataFrame)
    590     self.dataDisplay.Bind(wg.EVT_GRID_CELL_CHANGE, RefreshBackgroundGrid)               
    591     self.dataDisplay.SetTable(self.BackTable, True)
    592     self.dataDisplay.SetMargins(0,0)
    593     self.dataDisplay.AutoSizeColumns(False)
    594        
    595 def UpdateLimitsGrid(self, data):
    596     if self.dataDisplay:
    597         self.dataDisplay.Destroy()
    598     self.dataFrame.setSizePosLeft([250,150])
    599     LimitId = GetPatternTreeItemId(self,self.PatternId, 'Limits')
    600     def RefreshLimitsGrid(event):
    601         data = self.LimitsTable.GetData()
    602         old = data[0]
    603         new = data[1]
    604         new[0] = max(old[0],new[0])
    605         new[1] = max(new[0],min(old[1],new[1]))
    606         data = [old,new]
    607         G2plt.PlotPatterns(self)
    608        
    609     self.LimitsTable = []
    610     colLabels = ['Tmin','Tmax']
    611     rowLabels = ['original','changed']
    612     Types = [wg.GRID_VALUE_FLOAT+':10,3',wg.GRID_VALUE_FLOAT+':10,3']
    613     self.LimitsTable = Table(data,rowLabels=rowLabels,colLabels=colLabels,types=Types)
    614     self.dataFrame.SetLabel('Limits')
    615     self.dataFrame.SetMenuBar(self.dataFrame.BlankMenu)
    616     self.dataDisplay = GSGrid(parent=self.dataFrame)               
    617     self.dataDisplay.SetTable(self.LimitsTable, True)
    618     self.dataDisplay.Bind(wg.EVT_GRID_CELL_CHANGE, RefreshLimitsGrid)               
    619     self.dataDisplay.SetMargins(0,0)
    620     self.dataDisplay.AutoSizeColumns(False)
    621    
    622 def UpdateInstrumentGrid(self, data):
    623     if self.dataDisplay:
    624         self.dataDisplay.Destroy()
    625     Ka2 = False
    626     Xwid = 700
    627     if len(data[0]) == 13:
    628         Ka2 = True
    629         Xwid = 840       
    630     self.dataFrame.setSizePosLeft([Xwid,170])
    631     self.dataFrame.SetMenuBar(self.dataFrame.BlankMenu)
    632     InstId = GetPatternTreeItemId(self,self.PatternId, 'Instrument Parameters')
    633    
    634     def RefreshInstrumentGrid(event,doAnyway=False):
    635         if doAnyway or event.GetRow() == 1:
    636             peaks = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,self.PatternId, 'Peak List'))
    637             ins = data[1]
    638             if 'P' in ins[0]:                                       #update powder peak parameters
    639                 for peak in peaks:
    640                     if Ka2:
    641                         peak[4] = ins[6]*tand(peak[0]/2.0)**2+ins[7]*tand(peak[0]/2.0)+ins[8]
    642                         peak[6] = ins[9]/cosd(peak[0]/2.0)+ins[10]*tand(peak[0]/2.0)
    643                     else:
    644                         peak[4] = ins[4]*tand(peak[0]/2.0)**2+ins[5]*tand(peak[0]/2.0)+ins[6]
    645                         peak[6] = ins[7]/cosd(peak[0]/2.0)+ins[8]*tand(peak[0]/2.0)
    646                        
    647     def OnReset(event):
    648         if Ka2:
    649             data[1][6:12] = data[0][6:12]
    650         else:
    651             data[1][4:10] = data[0][4:10]
    652         RefreshInstrumentGrid(event,doAnyway=True)          #to get peaks updated
    653         UpdateInstrumentGrid(self, data)
    654        
    655     self.InstrumentTable = []
    656     if 'P' in data[1][0]:                   #powder data
    657         self.dataFrame.SetMenuBar(self.dataFrame.InstMenu)
    658         if not self.dataFrame.GetStatusBar():
    659             Status = self.dataFrame.CreateStatusBar()
    660         self.Bind(wx.EVT_MENU, OnReset, id=wxID_INSTPRMRESET)
    661         if Ka2:
    662             Types = [wg.GRID_VALUE_CHOICE+":PXC,PNC,PNT",wg.GRID_VALUE_FLOAT+':10,6',wg.GRID_VALUE_FLOAT+':10,6',               #type, lam-1 & lam-2
    663                 wg.GRID_VALUE_FLOAT+':10,3',wg.GRID_VALUE_FLOAT+':10,3',wg.GRID_VALUE_FLOAT+':10,3', #zero, ratio, pola
    664                 wg.GRID_VALUE_FLOAT+':10,3',wg.GRID_VALUE_FLOAT+':10,3',wg.GRID_VALUE_FLOAT+':10,3', #u,v,w
    665                 wg.GRID_VALUE_FLOAT+':10,3',wg.GRID_VALUE_FLOAT+':10,3',wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_FLOAT+':10,2']
    666         else:
    667             Types = [wg.GRID_VALUE_CHOICE+":PXC,PNC,PNT",wg.GRID_VALUE_FLOAT+':10,6',               #type & lam-1
    668                 wg.GRID_VALUE_FLOAT+':10,3',wg.GRID_VALUE_FLOAT+':10,3', #zero, pola
    669                 wg.GRID_VALUE_FLOAT+':10,3',wg.GRID_VALUE_FLOAT+':10,3',wg.GRID_VALUE_FLOAT+':10,3', #u,v,w
    670                 wg.GRID_VALUE_FLOAT+':10,3',wg.GRID_VALUE_FLOAT+':10,3',wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_FLOAT+':10,2']
    671         colLabels = data[3]
    672         rowLabels = ['default','changed','refine']
    673         self.InstrumentTable = Table(data[:-1],rowLabels=rowLabels,colLabels=colLabels,types=Types)
    674         self.dataFrame.SetLabel('Instrument Parameters')
    675         self.dataDisplay = GSGrid(parent=self.dataFrame)               
    676         self.dataDisplay.SetTable(self.InstrumentTable, True)
    677         self.dataDisplay.Bind(wg.EVT_GRID_CELL_CHANGE, RefreshInstrumentGrid)               
    678         self.dataDisplay.SetMargins(0,0)
    679         self.dataDisplay.AutoSizeColumns(False)
    680         beg = 4
    681         if Ka2: beg = 6
    682         for i in range(len(data[2])):
    683             if i < beg or i == beg+6:
    684                 self.dataDisplay.SetCellRenderer(2,i,wg.GridCellStringRenderer())
    685                 self.dataDisplay.SetCellValue(2,i,'')
    686                 self.dataDisplay.SetReadOnly(2,i,isReadOnly=True)
    687             else:
    688                 self.dataDisplay.SetCellRenderer(2,i,wg.GridCellBoolRenderer())
    689                 self.dataDisplay.SetCellEditor(2,i,wg.GridCellBoolEditor())
    690     else:                       #single crystal data
    691         Types = [wg.GRID_VALUE_CHOICE+":SXC,SNC,SNT",wg.GRID_VALUE_FLOAT+':10,6']
    692         colLabels = data[2]
    693         rowLabels = ['original','changed']
    694         self.InstrumentTable = Table(data[:-1],rowLabels=rowLabels,colLabels=colLabels,types=Types)
    695         self.dataFrame.SetLabel('Instrument Parameters')
    696         self.dataDisplay = GSGrid(parent=self.dataFrame)               
    697         self.dataDisplay.SetTable(self.InstrumentTable, True)
    698         self.dataDisplay.Bind(wg.EVT_GRID_CELL_CHANGE, RefreshInstrumentGrid)               
    699         self.dataDisplay.SetMargins(0,0)
    700         self.dataDisplay.AutoSizeColumns(False)
    701                
    702 def UpdateIndexPeaksGrid(self, data):
    703     IndexId = GetPatternTreeItemId(self,self.PatternId, 'Index Peak List')
    704    
    705     def RefreshIndexPeaksGrid(event):
    706         data = self.IndexPeaksTable.GetData()
    707         self.PatternTree.SetItemPyData(IndexId,data)
    708        
    709     def KeyEditPickGrid(event):
    710         colList = self.dataDisplay.GetSelectedCols()
    711         rowList = self.dataDisplay.GetSelectedRows()
    712         data = self.PatternTree.GetItemPyData(IndexId)
    713         if event.GetKeyCode() == wx.WXK_RETURN:
    714             event.Skip(True)
    715         elif event.GetKeyCode() == wx.WXK_CONTROL:
    716             event.Skip(True)
    717         elif event.GetKeyCode() == wx.WXK_SHIFT:
    718             event.Skip(True)
    719         elif event.GetKeyCode() == wx.WXK_DELETE:
    720             dlg = wx.MessageDialog(self, 'Delete Index Peak List?', ' ', wx.YES | wx.NO)
    721             try:
    722                 result = dlg.ShowModal()
    723                 if result == wx.ID_YES:
    724                     oldlen = len(data)
    725                     data = []
    726                     self.PatternTree.SetItemPyData(IndexId,data)
    727                     self.dataDisplay.Clear()
    728                     self.dataDisplay.Destroy()
    729                     self.IndexPeaksTable = []
    730             finally:
    731                 dlg.Destroy()
    732         elif colList:
    733             self.dataDisplay.ClearSelection()
    734             key = event.GetKeyCode()
    735             for col in colList:
    736                 if self.IndexPeaksTable.GetTypeName(0,col) == wg.GRID_VALUE_BOOL:
    737                     if key == 89: #'Y'
    738                         for row in range(self.IndexPeaksTable.GetNumberRows()): data[row][col]=True
    739                     elif key == 78:  #'N'
    740                         for row in range(self.IndexPeaksTable.GetNumberRows()): data[row][col]=False
    741            
    742     if self.dataDisplay:
    743         self.dataDisplay.Destroy()
    744     self.dataFrame.setSizePosLeft([500,300])
    745     self.dataFrame.SetMenuBar(self.dataFrame.BlankMenu)
    746     inst = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,self.PatternId, 'Instrument Parameters'))[1]
    747     self.IndexPeaksTable = []
    748     if not data:
    749         peaks = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,self.PatternId, 'Peak List'))
    750         for peak in peaks:
    751             dsp = inst[1]/(2.0*sind(peak[0]/2.0))
    752             data.append([peak[0],peak[2],True,False,0,0,0,dsp,0.0])
    753     else:
    754         cells = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,self.PatternId, 'Unit Cells List'))
    755         if cells:
    756             cellist = cells[2]
    757             dmin = cells[3]
    758             self.HKL = []
    759             for i,cell in enumerate(cellist):
    760                 if cell[-1]:
    761                     ibrav = cell[2]
    762                     A = G2lat.cell2A(cell[3:9])
    763                     self.HKL = G2lat.GenHBravais(dmin,ibrav,A)
    764                     G2indx.IndexPeaks(data,self.HKL)
    765                     for hkl in self.HKL:
    766                         hkl.append(2.0*asind(inst[1]/(2.*hkl[3])))             
    767     rowLabels = []
    768     for i in range(len(data)): rowLabels.append(str(i+1))
    769     colLabels = ['position','intensity','use','indexed','h','k','l','d-obs','d-calc']
    770     Types = [wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_FLOAT+':10,1',wg.GRID_VALUE_BOOL,
    771         wg.GRID_VALUE_BOOL,wg.GRID_VALUE_LONG,wg.GRID_VALUE_LONG,wg.GRID_VALUE_LONG,
    772         wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_FLOAT+':10,5']
    773     self.PatternTree.SetItemPyData(IndexId,data)
    774     self.IndexPeaksTable = Table(data,rowLabels=rowLabels,colLabels=colLabels,types=Types)
    775     self.dataFrame.SetLabel('Index Peak List')
    776     self.dataDisplay = GSGrid(parent=self.dataFrame)               
    777     self.dataDisplay.SetTable(self.IndexPeaksTable, True)
    778     self.dataDisplay.Bind(wg.EVT_GRID_CELL_CHANGE, RefreshIndexPeaksGrid)
    779     self.dataDisplay.Bind(wx.EVT_KEY_DOWN, KeyEditPickGrid)                 
    780     self.dataDisplay.SetMargins(0,0)
    781     self.dataDisplay.AutoSizeColumns(False)
    782 
    783 def UpdateUnitCellsGrid(self, data):
    784     UnitCellsId = GetPatternTreeItemId(self,self.PatternId, 'Unit Cells List')
    785     bravaisSymb = ['Fm3m','Im3m','Pm3m','R3-H','P6/mmm','I4/mmm',
    786         'P4/mmm','Fmmm','Immm','Cmmm','Pmmm','C2/m','P2/m','P1']
    787        
    788     def OnRefineCell(event):
    789         def cellPrint(ibrav,A):
    790             cell = G2lat.A2cell(A)
    791             Vol = G2lat.calc_V(A)
    792             if ibrav in [0,1,2]:
    793                 print "%s%10.6f" % ('a =',cell[0])
    794             elif ibrav in [3,4,5,6]:
    795                 print "%s%10.6f %s%10.6f %s%12.3f" % ('a =',cell[0],' c =',cell[2],' volume =',Vol)
    796             elif ibrav in [7,8,9,10]:
    797                 print "%s%10.6f %s%10.6f %s%10.6f %s%12.3f" % ('a =',cell[0],'b =',cell[1],'c =',cell[2],' volume =',Vol)
    798             elif ibrav in [11,12]:
    799                 print "%s%10.6f %s%10.6f %s%10.6f %s%8.3f %s%12.3f" % ('a =',cell[0],'b =',cell[1],'c =',cell[2],'beta =',cell[4],' volume =',Vol)
    800             else:
    801                 print "%s%10.6f %s%10.6f %s%10.6f" % ('a =',cell[0],'b =',cell[1],'c =',cell[2])
    802                 print "%s%8.3f %s%8.3f %s%8.3f %s%12.3f" % ('alpha =',cell[3],'beta =',cell[4],'gamma =',cell[5],' volume =',Vol)
    803339             
    804         bravaisSymb = ['Fm3m','Im3m','Pm3m','R3-H','P6/mmm','I4/mmm',
    805             'P4/mmm','Fmmm','Immm','Cmmm','Pmmm','C2/m','P2/m','P1']
    806         PatternId = self.PatternId
    807         PickId = self.PickId   
    808         peaks = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, 'Index Peak List'))
    809         if not peaks:
    810             self.ErrorDialog('No peaks!', 'Nothing to refine!')
    811             return       
    812         print 'Refine cell'
    813         inst = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, 'Instrument Parameters'))[1]
    814         controls,bravais,cells,dmin = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, 'Unit Cells List'))
    815         cell = controls[6:12]
    816         A = G2lat.cell2A(cell)
    817         print controls[5]
    818         ibrav = bravaisSymb.index(controls[5])
    819         dmin = G2indx.getDmin(peaks)-0.005
    820         Lhkl,M20,X20 = G2indx.refinePeaks(peaks,ibrav,A)
    821         controls[6:12] = G2lat.A2cell(A)
    822         controls[12] = G2lat.calc_V(A)
    823         data = [controls,bravais,cells,dmin]
    824         self.PatternTree.SetItemPyData(GetPatternTreeItemId(self,PatternId, 'Unit Cells List'),data)
    825         self.HKL = G2lat.GenHBravais(dmin,ibrav,A)
    826         UpdateUnitCellsGrid(self,data)
    827         print "%s%10.3f" % ('refinement M20 = ',M20)
    828         print 'unindexed lines = ',X20
    829         cellPrint(ibrav,A)
    830         for hkl in self.HKL:
    831             hkl.append(2.0*asind(inst[1]/(2.*hkl[3])))             
    832         if 'PKS' in self.PatternTree.GetItemText(self.PatternId):
    833             G2plt.PlotPowderLines(self)
    834         else:
    835             G2plt.PlotPatterns(self)
    836        
    837     def OnIndexPeaks(event):
    838         PatternId = self.PatternId   
    839         peaks = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, 'Index Peak List'))
    840         if not peaks:
    841             self.ErrorDialog('No peaks!', 'Nothing to index!')
    842             return
    843         inst = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, 'Instrument Parameters'))[1]
    844         print 'Peak Indexing'
    845         try:
    846             controls,bravais,cells,dmin = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,PatternId, 'Unit Cells List'))
    847             cells = []
    848         except ValueError:
    849             self.ErrorDialog('Error','Need to set controls in Unit Cell List first')
    850             return
    851         if True not in bravais:
    852             self.ErrorDialog('Error','No Bravais lattices selected')
    853             return
    854         self.dataFrame.IndexPeaks.Enable(False)
    855         self.dataFrame.CopyCell.Enable(False)
    856         OK,dmin,cells = G2indx.DoIndexPeaks(peaks,inst,controls,bravais)
    857         if OK:
    858             data = [controls,bravais,cells,dmin]
    859             self.PatternTree.SetItemPyData(GetPatternTreeItemId(self,PatternId, 'Unit Cells List'),data)
    860             UpdateUnitCellsGrid(self,data)
    861             bestCell = cells[0]
    862             if bestCell[0] > 10.:
    863                 self.HKL = G2lat.GenHBravais(dmin,bestCell[2],G2lat.cell2A(bestCell[3:9]))
    864                 for hkl in self.HKL:
    865                     hkl.append(2.0*asind(inst[1]/(2.*hkl[3])))             
    866                 if 'PKS' in self.PatternTree.GetItemText(self.PatternId):
    867                     G2plt.PlotPowderLines(self)
    868                 else:
    869                     G2plt.PlotPatterns(self)
    870         self.dataFrame.CopyCell.Enable(True)
    871         self.dataFrame.IndexPeaks.Enable(True)
    872                
    873     def CopyUnitCell(event):
    874         controls,bravais,cells,dmin = self.PatternTree.GetItemPyData(UnitCellsId)
    875         for Cell in cells:
    876             if Cell[-1]:
    877                 break
    878         cell = Cell[2:9]
    879         controls[4] = 1
    880         controls[5] = bravaisSymb[cell[0]]
    881         controls[6:12] = cell[1:8]
    882         controls[12] = G2lat.calc_V(G2lat.cell2A(controls[6:12]))
    883         for i in range(4,13):
    884             self.UnitCellsTable.SetValue(i,1,controls[i])
    885         self.PatternTree.SetItemPyData(UnitCellsId,[controls,bravais,cells,dmin])
    886         self.dataDisplay.ForceRefresh()
    887         self.dataFrame.RefineCell.Enable(True)
    888            
    889     def RefreshUnitCellsGrid(event):
    890         cells,dmin = self.PatternTree.GetItemPyData(UnitCellsId)[2:]
    891         r,c =  event.GetRow(),event.GetCol()
    892         if cells:
    893             if c == 6:
    894                 for i in range(min(self.UnitCellsTable.GetNumberRows(),len(cells))):
    895                     cells[i][-1] = False
    896                     self.UnitCellsTable.SetValue(i,c,0)
    897                 self.UnitCellsTable.SetValue(r,c,1)
    898                 cells[r][-1] = True
    899                 ibrav = cells[r][2]
    900                 A = G2lat.cell2A(cells[r][3:9])
    901                 self.HKL = G2lat.GenHBravais(dmin,ibrav,A)
    902                 for hkl in self.HKL:
    903                     hkl.append(2.0*asind(inst[1]/(2.*hkl[3])))
    904                 if 'PKS' in self.PatternTree.GetItemText(self.PatternId):
    905                     G2plt.PlotPowderLines(self)
    906                 else:
    907                     G2plt.PlotPatterns(self)
    908         controls = []
    909         bravais = [0,0,0,0,0,0,0, 0,0,0,0,0,0,0]
    910         table = self.UnitCellsTable.GetData()
    911         for i,row in enumerate(table):
    912             if i in [0,4]:
    913                 if row[1]:
    914                     controls.append(1)
    915                 else:
    916                     controls.append(0)
    917             elif i in [1,3]:
    918                 controls.append(float(row[1]))
    919             elif i in [2]:
    920                 controls.append(int(row[1]))
    921             elif i in [5]:
    922                 controls.append(row[1])
    923             elif i in [6,7,8,9,10,11]:
    924                 if controls[5] in bravaisSymb[:3]:              #cubic
    925                     if i in [6]:
    926                         controls.append(float(row[1]))
    927                         controls.append(float(row[1]))
    928                         controls.append(float(row[1]))
    929                         controls.append(90.)
    930                         controls.append(90.)
    931                         controls.append(90.)
    932                 elif controls[5] in bravaisSymb[3:7]:           #hexagonal & tetragonal
    933                     if i in [6]:
    934                         controls.append(float(row[1]))
    935                         controls.append(float(row[1]))
    936                     elif i in [8]:
    937                         controls.append(float(row[1]))
    938                         controls.append(90.)
    939                         controls.append(90.)
    940                         if controls[5] in bravaisSymb[3:5]:     #hexagonal
    941                             controls.append(120.)
    942                         else:                                   #tetragonal
    943                             controls.append(90.)
    944                 elif controls[5] in bravaisSymb[7:13]:          #orthorhombic & monoclinic
    945                     if i in [6,7,8]:
    946                         controls.append(float(row[1]))
    947                     if i in [9,10,11]:
    948                         if controls[5] in bravaisSymb[7:11]:
    949                             controls.append(90.)
    950                             controls.append(90.)
    951                             controls.append(90.)
    952                             break
    953                         else:
    954                             if i in [9,11]:
    955                                 controls.append(90.)
    956                             else:
    957                                 controls.append(float(row[1]))
    958                 else:                                           #triclinic
    959                     controls.append(float(row[1]))
    960         controls.append(G2lat.calc_V(G2lat.cell2A(controls[6:12])))        #volume       
    961         for i,row in enumerate(table):
    962             if i < 14:
    963                 bravais[i] = int(row[2])
    964             else:
    965                 break
    966         if controls[4]:
    967             for i in range(6,13):
    968                 self.UnitCellsTable.SetValue(i,1,controls[i])
    969         self.dataDisplay.ForceRefresh()
    970         if controls[4] and not False in controls[6:12]:
    971             self.dataFrame.RefineCell.Enable(True)
    972         else:
    973             self.dataFrame.RefineCell.Enable(False)
    974         data = [controls,bravais,cells,dmin]                   
    975         self.PatternTree.SetItemPyData(UnitCellsId,data)
    976        
    977     if self.dataDisplay:
    978         self.dataDisplay.Destroy()
    979     self.dataFrame.SetMenuBar(self.dataFrame.IndexMenu)
    980     if not self.dataFrame.GetStatusBar():
    981         Status = self.dataFrame.CreateStatusBar()
    982     self.Bind(wx.EVT_MENU, OnIndexPeaks, id=wxID_INDEXPEAKS)
    983     self.Bind(wx.EVT_MENU, CopyUnitCell, id=wxID_COPYCELL)
    984     self.Bind(wx.EVT_MENU, OnRefineCell, id=wxID_REFINECELL)
    985     self.UnitCellsTable = []
    986     controls,bravais,cells,dmin = data
    987     if cells:
    988         self.dataFrame.setSizePosLeft([900,320])
    989     else:
    990         self.dataFrame.setSizePosLeft([280,320])
    991     if len(controls) < 13:
    992         controls.append(G2lat.calc_V(G2lat.cell2A(controls[6:12])))
    993     self.PatternTree.SetItemPyData(UnitCellsId,data)
    994     inst = self.PatternTree.GetItemPyData(GetPatternTreeItemId(self,self.PatternId, 'Instrument Parameters'))[1]
    995     if cells:
    996         colLabels = ['controls','value','try','Bravais cells',
    997             'M20','X20','use','Bravais','a','b','c','alpha','beta','gamma','Volume']
    998         Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_FLOAT+":10,1",
    999             wg.GRID_VALUE_BOOL,wg.GRID_VALUE_STRING,wg.GRID_VALUE_FLOAT+':10,2',
    1000             wg.GRID_VALUE_NUMBER,wg.GRID_VALUE_BOOL,wg.GRID_VALUE_STRING,
    1001             wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_FLOAT+':10,5',
    1002             wg.GRID_VALUE_FLOAT+':10,3',wg.GRID_VALUE_FLOAT+':10,3',wg.GRID_VALUE_FLOAT+':10,3',
    1003             wg.GRID_VALUE_FLOAT+':10,2']
    1004     else:
    1005         colLabels = ['controls','value','try','Bravais cells']
    1006         Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,
    1007             wg.GRID_VALUE_BOOL,wg.GRID_VALUE_STRING]
    1008     controlNames = ['Vary zero?','Max zero error','Max Nc/Nobs','Start volume','refine cell?',
    1009         'bravais','a=','b=','c=','alpha=','beta=','gamma=','Volume=']
    1010     bravaisNames = ['Cubic-F','Cubic-I','Cubic-P','Trigonal-R','Trigonal/Hexagonal-P',
    1011         'Tetragonal-I','Tetragonal-P','Orthorhombic-F','Orthorhombic-I','Orthorhombic-C',
    1012         'Orthorhombic-P','Monoclinic-C','Monoclinic-P','Triclinic']
    1013     rowLabels = []
    1014     table = []
    1015     numRows = max(len(bravais),len(cells))
    1016     for i in range(numRows):
    1017         rowLabels.append('')
    1018         if i < 13:
    1019             row = [controlNames[i],controls[i],bravais[i],bravaisSymb[i]]
    1020         elif i < 14:
    1021             row = ['','',bravais[i],bravaisSymb[i]]
    1022         else:
    1023             row = ['','','','']
    1024         if cells:
    1025             if i < len(cells):
    1026                 cell = cells[i]
    1027                 row += cell[0:2]+[cell[-1]]+[bravaisSymb[cell[2]]]+cell[3:10]
    1028                 if cell[-1]:
    1029                     A = G2lat.cell2A(cell[3:9])
    1030                     self.HKL = G2lat.GenHBravais(dmin,cell[2],A)
    1031                     for hkl in self.HKL:
    1032                         hkl.append(2.0*asind(inst[1]/(2.*hkl[3])))
    1033             else:
    1034                 row += 14*['',]
    1035         table.append(row)
    1036     self.UnitCellsTable = Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types)
    1037     self.dataFrame.SetLabel('Unit Cells List')
    1038     self.dataDisplay = GSGrid(parent=self.dataFrame)               
    1039     self.dataDisplay.SetTable(self.UnitCellsTable, True)
    1040     self.dataDisplay.Bind(wg.EVT_GRID_CELL_CHANGE, RefreshUnitCellsGrid)
    1041     self.dataDisplay.SetMargins(0,0)
    1042     self.dataDisplay.SetRowLabelSize(0)
    1043     self.dataDisplay.SetCellRenderer(0,1,wg.GridCellBoolRenderer())
    1044     self.dataDisplay.SetCellEditor(0,1,wg.GridCellBoolEditor())
    1045     self.dataDisplay.SetCellRenderer(1,1,wg.GridCellFloatRenderer(5,2))
    1046     self.dataDisplay.SetCellEditor(1,1,wg.GridCellFloatEditor(5,0))
    1047     self.dataDisplay.SetCellRenderer(2,1,wg.GridCellNumberRenderer())
    1048     self.dataDisplay.SetCellEditor(2,1,wg.GridCellNumberEditor(1,10))
    1049     self.dataDisplay.SetCellRenderer(3,1,wg.GridCellFloatRenderer(5,0))
    1050     self.dataDisplay.SetCellEditor(3,1,wg.GridCellFloatEditor(5,2))
    1051     self.dataDisplay.SetCellRenderer(4,1,wg.GridCellBoolRenderer())
    1052     self.dataDisplay.SetCellEditor(4,1,wg.GridCellBoolEditor())
    1053     self.dataDisplay.SetCellRenderer(5,1,wg.GridCellStringRenderer())
    1054     self.dataDisplay.SetCellEditor(5,1,wg.GridCellChoiceEditor(bravaisSymb,False))
    1055     for i in range(6,9):
    1056         self.dataDisplay.SetCellRenderer(i,1,wg.GridCellFloatRenderer(10,5))
    1057         self.dataDisplay.SetCellEditor(i,1,wg.GridCellFloatEditor(10,5))
    1058     for i in range(9,13):
    1059         self.dataDisplay.SetCellRenderer(i,1,wg.GridCellFloatRenderer(10,3))
    1060         self.dataDisplay.SetCellEditor(i,1,wg.GridCellFloatEditor(10,3))
    1061     for i in range(14):
    1062         self.dataDisplay.SetReadOnly(i,0,isReadOnly=True)
    1063         self.dataDisplay.SetReadOnly(i,3,isReadOnly=True)
    1064     if cells:
    1065         self.dataFrame.CopyCell.Enable(True)
    1066         for r in range(max(len(cells),14)):
    1067             if r > 12:
    1068                 self.dataDisplay.SetCellRenderer(r,0,wg.GridCellStringRenderer())                   
    1069                 self.dataDisplay.SetCellRenderer(r,1,wg.GridCellStringRenderer())
    1070             if r > 13:
    1071                 self.dataDisplay.SetCellRenderer(r,2,wg.GridCellStringRenderer())
    1072             for c in range(4,15):
    1073                 if r >= len(cells):
    1074                     self.dataDisplay.SetCellRenderer(r,c,wg.GridCellStringRenderer())
    1075                 if c != 6:
    1076                     self.dataDisplay.SetReadOnly(r,c,isReadOnly=True)
    1077     self.dataDisplay.AutoSizeColumns(False)
    1078     if controls[4] and not False in controls[6:12]:
    1079         self.dataFrame.RefineCell.Enable(True)
    1080     else:
    1081         self.dataFrame.RefineCell.Enable(False)
    1082        
    1083340def UpdateHKLControls(self,data):
    1084341   
     
    20931350        self.PickId = item
    20941351        data = self.PatternTree.GetItemPyData(item)
    2095         UpdatePeakGrid(self,data)
     1352        G2pdG.UpdatePeakGrid(self,data)
    20961353        G2plt.PlotPatterns(self)
    20971354    elif self.PatternTree.GetItemText(item) == 'Background':
     
    20991356        self.PickId = item
    21001357        data = self.PatternTree.GetItemPyData(item)
    2101         UpdateBackgroundGrid(self,data)
     1358        G2pdG.UpdateBackgroundGrid(self,data)
    21021359        G2plt.PlotPatterns(self)
    21031360    elif self.PatternTree.GetItemText(item) == 'Limits':
     
    21051362        self.PickId = item
    21061363        data = self.PatternTree.GetItemPyData(item)
    2107         UpdateLimitsGrid(self,data)
     1364        G2pdG.UpdateLimitsGrid(self,data)
    21081365        G2plt.PlotPatterns(self)
    21091366    elif self.PatternTree.GetItemText(item) == 'Instrument Parameters':
     
    21111368        self.PickId = item
    21121369        data = self.PatternTree.GetItemPyData(item)
    2113         UpdateInstrumentGrid(self,data)
     1370        G2pdG.UpdateInstrumentGrid(self,data)
    21141371        G2plt.PlotPeakWidths(self)
    21151372    elif self.PatternTree.GetItemText(item) == 'Index Peak List':
     
    21181375        self.PickId = item
    21191376        data = self.PatternTree.GetItemPyData(item)
    2120         UpdateIndexPeaksGrid(self,data)
     1377        G2pdG.UpdateIndexPeaksGrid(self,data)
    21211378        if 'PKS' in self.PatternTree.GetItemText(self.PatternId):
    21221379            G2plt.PlotPowderLines(self)
     
    21331390            data.append([])                                 #empty dmin
    21341391            self.PatternTree.SetItemPyData(item,data)                             
    2135         UpdateUnitCellsGrid(self,data)
     1392        G2pdG.UpdateUnitCellsGrid(self,data)
    21361393        self.dataFrame.RefineCell.Enable(True)
    21371394        self.dataFrame.IndexPeaks.Enable(True)
  • trunk/GSASIIplot.py

    r81 r82  
    1010import GSASIIimage as G2img
    1111import GSASIIIO as G2IO
     12import GSASIIpwdGUI as G2pdG
    1213from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas
    1314from matplotlib.backends.backend_wxagg import NavigationToolbar2Wx as Toolbar
     
    212213                XY = [xy[0],0, xy[1],1, sig,0, gam,0]       #default refine intensity 1st   
    213214                data.append(XY)
    214                 G2gd.UpdatePeakGrid(self,data)
     215                G2pdG.UpdatePeakGrid(self,data)
    215216                PlotPatterns(self)
    216217            else:                                                   #picked a peak list line
     
    225226                    data[1][1] = max(xy[0],data[1][0])
    226227                self.PatternTree.SetItemPyData(LimitId,data)
    227                 G2gd.UpdateLimitsGrid(self,data)
     228                G2pdG.UpdateLimitsGrid(self,data)
    228229                PlotPatterns(self)
    229230            else:                                                   #picked a limit line
     
    291292                self.PatternTree.SetItemPyData(LimitId,data)
    292293                if self.PatternTree.GetItemText(self.PickId) == 'Limits':
    293                     G2gd.UpdateLimitsGrid(self,data)
     294                    G2pdG.UpdateLimitsGrid(self,data)
    294295            else:
    295296                PeakId = G2gd.GetPatternTreeItemId(self,self.PatternId, 'Peak List')
     
    298299                data[lineNo-2][0] = xpos
    299300                self.PatternTree.SetItemPyData(PeakId,data)
    300                 G2gd.UpdatePeakGrid(self,data)
     301                G2pdG.UpdatePeakGrid(self,data)
    301302        PlotPatterns(self)
    302303        self.itemPicked = None   
Note: See TracChangeset for help on using the changeset viewer.