Ignore:
Timestamp:
Jul 4, 2017 12:11:29 PM (5 years ago)
Author:
toby
Message:

use GPXtree in place of PatternTree?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branch/2frame/GSASIIplot.py

    r2900 r2905  
    368368        '''
    369369        self.allowZoomReset = False
    370         if pid: self.G2frame.PatternTree.SelectItem(pid)
     370        if pid: self.G2frame.GPXtree.SelectItem(pid)
    371371        self.allowZoomReset = True
    372372        if plotDebug: print 'invoke',str(self).split('0x')[1],str(pid)
     
    555555        G2frame.G2plotNB.status.SetStatusText('H = '+HKLtext,0)
    556556                                 
    557     Name = G2frame.PatternTree.GetItemText(G2frame.PatternId)
     557    Name = G2frame.GPXtree.GetItemText(G2frame.PatternId)
    558558    if not Title:
    559559        Title = Name
     
    809809        Draw('key')
    810810           
    811     Name = G2frame.PatternTree.GetItemText(G2frame.PatternId)
     811    Name = G2frame.GPXtree.GetItemText(G2frame.PatternId)
    812812    if Title and Title in G2frame.GetPhaseData(): #NB: save image as e.g. jpeg will fail if False; MyDir is unknown
    813813        generalData = G2frame.GetPhaseData()[Title]['General']
     
    11911191    if not histogram.startswith('PWDR'): return
    11921192    pickId = G2frame.PickId
    1193     G2frame.PickId = G2frame.PatternId = G2gd.GetPatternTreeItemId(G2frame, G2frame.root, histogram)
    1194     treedata = G2frame.PatternTree.GetItemPyData(G2frame.PatternId)
     1193    G2frame.PickId = G2frame.PatternId = G2gd.GetGPXtreeItemId(G2frame, G2frame.root, histogram)
     1194    treedata = G2frame.GPXtree.GetItemPyData(G2frame.PatternId)
    11951195    PlotPatterns(G2frame,newPlot=True,plotType='PWDR',data=[treedata[0],refdata])
    11961196    wx.Yield() # force a plot update (needed on Windows?)
     
    12031203    '''
    12041204    if PatternName:
    1205         G2frame.PatternId = G2gd.GetPatternTreeItemId(G2frame, G2frame.root, PatternName)
     1205        G2frame.PatternId = G2gd.GetGPXtreeItemId(G2frame, G2frame.root, PatternName)
    12061206    if PickName == PatternName:
    12071207        G2frame.PickId = G2frame.PatternId
    12081208    elif PickName:
    1209         G2frame.PickId = G2gd.GetPatternTreeItemId(G2frame, G2frame.PatternId, PickName)
     1209        G2frame.PickId = G2gd.GetGPXtreeItemId(G2frame, G2frame.PatternId, PickName)
    12101210    # for now I am not sure how to regenerate G2frame.HKL
    12111211    G2frame.HKL = [] # TODO
     
    12371237#patch
    12381238    if data is None:
    1239         data = G2frame.PatternTree.GetItemPyData(G2frame.PatternId)
     1239        data = G2frame.GPXtree.GetItemPyData(G2frame.PatternId)
    12401240    if 'Offset' not in data[0] and plotType in ['PWDR','SASD','REFD']:     #plot offset data
    12411241        Ymax = max(data[1][1])
    12421242        data[0].update({'Offset':[0.0,0.0],'delOffset':0.02*Ymax,'refOffset':-0.1*Ymax,
    12431243            'refDelt':0.1*Ymax,})
    1244         G2frame.PatternTree.SetItemPyData(G2frame.PickId,data)
     1244        G2frame.GPXtree.SetItemPyData(G2frame.PickId,data)
    12451245#end patch
    12461246    def OnPlotKeyPress(event):
    12471247        try:        #one way to check if key stroke will work on plot
    1248             Parms,Parms2 = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters'))
     1248            Parms,Parms2 = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters'))
    12491249        except TypeError:
    12501250            G2frame.G2plotNB.status.SetStatusText('Select '+plottype+' pattern first',1)
     
    13351335            newPlot = True
    13361336        elif event.key == 'f' and not G2frame.SinglePlot:
    1337             choices = G2gd.GetPatternTreeDataNames(G2frame,plotType)
     1337            choices = G2gd.GetGPXtreeDataNames(G2frame,plotType)
    13381338            dlg = G2G.G2MultiChoiceDialog(G2frame.dataFrame,'Select dataset to plot',
    13391339                'Multidata plot selection',choices)
     
    13731373            Page.canvas.SetCursor(wx.CROSS_CURSOR)
    13741374            try:
    1375                 Id = G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters')
     1375                Id = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters')
    13761376                if not Id: return
    1377                 Parms,Parms2 = G2frame.PatternTree.GetItemPyData(Id)
     1377                Parms,Parms2 = G2frame.GPXtree.GetItemPyData(Id)
    13781378                if G2frame.plotStyle['qPlot'] and 'PWDR' in plottype:
    13791379                    q = xpos
     
    14221422                if G2frame.PickId:
    14231423                    found = []
    1424                     pickIdText = G2frame.PatternTree.GetItemText(G2frame.PickId)
     1424                    pickIdText = G2frame.GPXtree.GetItemText(G2frame.PickId)
    14251425                    if pickIdText in ['Index Peak List','Unit Cells List','Reflection Lists'] or \
    14261426                        'PWDR' in pickIdText:
     
    15461546
    15471547        try:
    1548             Parms,Parms2 = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters'))
     1548            Parms,Parms2 = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters'))
    15491549        except TypeError:
    15501550            return
     
    15701570        PatternId = G2frame.PatternId
    15711571        PickId = G2frame.PickId
    1572         if G2frame.PatternTree.GetItemText(PickId) == 'Peak List':
     1572        if G2frame.GPXtree.GetItemText(PickId) == 'Peak List':
    15731573            if ind.all() != [0] and ObsLine[0].get_label() in str(pick):    #picked a data point, add a new peak
    1574                 data = G2frame.PatternTree.GetItemPyData(G2frame.PickId)
     1574                data = G2frame.GPXtree.GetItemPyData(G2frame.PickId)
    15751575                XY = G2mth.setPeakparms(Parms,Parms2,xy[0],xy[1])
    15761576                data['peaks'].append(XY)
     
    15881588                G2frame.cid = Page.canvas.mpl_connect('motion_notify_event', OnDragLine)
    15891589                pick.set_linestyle('--') # back to dashed
    1590         elif G2frame.PatternTree.GetItemText(PickId) == 'Limits':
     1590        elif G2frame.GPXtree.GetItemText(PickId) == 'Limits':
    15911591            if ind.all() != [0]:                                    #picked a data point
    1592                 LimitId = G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Limits')
    1593                 data = G2frame.PatternTree.GetItemPyData(LimitId)
     1592                LimitId = G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Limits')
     1593                data = G2frame.GPXtree.GetItemPyData(LimitId)
    15941594                if G2frame.plotStyle['qPlot']:                              #qplot - convert back to 2-theta
    15951595                    xy[0] = G2lat.Dsp2pos(Parms,2*np.pi/xy[0])
     
    16071607                    if mouse.button==3:
    16081608                        data[1][1] = max(xy[0],data[1][0])
    1609                 G2frame.PatternTree.SetItemPyData(LimitId,data)
     1609                G2frame.GPXtree.SetItemPyData(LimitId,data)
    16101610                G2pdG.UpdateLimitsGrid(G2frame,data,plottype)
    16111611                wx.CallAfter(PlotPatterns,G2frame,plotType=plottype)
     
    16211621                pick.set_linestyle('--') # back to dashed
    16221622               
    1623         elif G2frame.PatternTree.GetItemText(PickId) == 'Models':
     1623        elif G2frame.GPXtree.GetItemText(PickId) == 'Models':
    16241624            if ind.all() != [0]:                                    #picked a data point
    1625                 LimitId = G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Limits')
    1626                 data = G2frame.PatternTree.GetItemPyData(LimitId)
     1625                LimitId = G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Limits')
     1626                data = G2frame.GPXtree.GetItemPyData(LimitId)
    16271627                if mouse.button==1:
    16281628                    data[1][0] = min(xy[0],data[1][1])
    16291629                if mouse.button==3:
    16301630                    data[1][1] = max(xy[0],data[1][0])
    1631                 G2frame.PatternTree.SetItemPyData(LimitId,data)
     1631                G2frame.GPXtree.SetItemPyData(LimitId,data)
    16321632                wx.CallAfter(PlotPatterns,G2frame,plotType=plottype)
    16331633            else:                                                   #picked a limit line
    16341634                G2frame.itemPicked = pick
    1635         elif (G2frame.PatternTree.GetItemText(PickId) == 'Reflection Lists' or
    1636                 'PWDR' in G2frame.PatternTree.GetItemText(PickId)
     1635        elif (G2frame.GPXtree.GetItemText(PickId) == 'Reflection Lists' or
     1636                'PWDR' in G2frame.GPXtree.GetItemText(PickId)
    16371637                ):
    16381638            G2frame.itemPicked = pick
     
    16641664                G2frame.cid = Page.canvas.mpl_connect('motion_notify_event', OnDragTickmarks)
    16651665           
    1666         elif G2frame.PatternTree.GetItemText(PickId) == 'Background':
     1666        elif G2frame.GPXtree.GetItemText(PickId) == 'Background':
    16671667            # selected a fixed background point. Can move it or delete it.
    16681668            for mode,id in G2frame.dataFrame.wxID_BackPts.iteritems(): # what menu is selected?
     
    16721672            if pick.get_marker() == 'D':
    16731673                # find the closest point
    1674                 backDict = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Background'))[1]
     1674                backDict = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Background'))[1]
    16751675                d2 = [(x-xy[0])**2+(y-xy[1])**2 for x,y in backDict['FixedPoints']]
    16761676                G2frame.fixPtMarker = d2.index(min(d2))
     
    17081708       
    17091709        PickId = G2frame.PickId                             # points to item in tree
    1710         if G2frame.PatternTree.GetItemText(PickId) == 'Background' and event.xdata:
     1710        if G2frame.GPXtree.GetItemText(PickId) == 'Background' and event.xdata:
    17111711            if Page.toolbar._active:    # prevent ops. if a toolbar zoom button pressed
    17121712                return
     
    17141714            if G2frame.SubBack or G2frame.Weight or G2frame.Contour or not G2frame.SinglePlot:
    17151715                return
    1716             backDict = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Background'))[1]
     1716            backDict = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Background'))[1]
    17171717            if 'FixedPoints' not in backDict: backDict['FixedPoints'] = []
    17181718            try:
    1719                 Parms,Parms2 = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters'))
     1719                Parms,Parms2 = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters'))
    17201720            except TypeError:
    17211721                return
     
    17451745        if G2frame.itemPicked is None: return
    17461746        if DifLine[0] is G2frame.itemPicked:   # respond to dragging of the difference curve
    1747             data = G2frame.PatternTree.GetItemPyData(PickId)
     1747            data = G2frame.GPXtree.GetItemPyData(PickId)
    17481748            ypos = event.ydata
    17491749            Pattern[0]['delOffset'] = -ypos
     
    17511751            wx.CallAfter(PlotPatterns,G2frame,plotType=plottype)
    17521752            return
    1753         Parms,Parms2 = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters'))
     1753        Parms,Parms2 = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters'))
    17541754        xpos = event.xdata
    1755         if G2frame.PatternTree.GetItemText(PickId) in ['Peak List','Limits'] and xpos:
     1755        if G2frame.GPXtree.GetItemText(PickId) in ['Peak List','Limits'] and xpos:
    17561756            lines = []
    17571757            for line in G2frame.Lines:
     
    17631763            nxcl = len(exclLines)
    17641764            if  lineNo in [0,1] or lineNo in exclLines:
    1765                 LimitId = G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Limits')
    1766                 limits = G2frame.PatternTree.GetItemPyData(LimitId)
     1765                LimitId = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Limits')
     1766                limits = G2frame.GPXtree.GetItemPyData(LimitId)
    17671767                id = lineNo/2+1
    17681768                id2 = lineNo%2
     
    17771777                limits[1][0] = min(max(limits[0][0],limits[1][0]),limits[1][1])
    17781778                limits[1][1] = max(min(limits[0][1],limits[1][1]),limits[1][0])
    1779                 if G2frame.PatternTree.GetItemText(G2frame.PickId) == 'Limits':
     1779                if G2frame.GPXtree.GetItemText(G2frame.PickId) == 'Limits':
    17801780                    G2pdG.UpdateLimitsGrid(G2frame,limits,plottype)
    17811781            elif lineNo > 1+nxcl:
    1782                 PeakId = G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Peak List')
    1783                 peaks = G2frame.PatternTree.GetItemPyData(PeakId)
     1782                PeakId = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Peak List')
     1783                peaks = G2frame.GPXtree.GetItemPyData(PeakId)
    17841784                if event.button == 3:
    17851785                    del peaks['peaks'][lineNo-2-nxcl]
     
    17931793                    peaks['sigDict'] = {}        #no longer valid
    17941794                G2pdG.UpdatePeakGrid(G2frame,peaks)
    1795         elif G2frame.PatternTree.GetItemText(PickId) in ['Models',] and xpos:
     1795        elif G2frame.GPXtree.GetItemText(PickId) in ['Models',] and xpos:
    17961796            lines = []
    17971797            for line in G2frame.Lines:
     
    18021802                lineNo = -1
    18031803            if  lineNo in [0,1]:
    1804                 LimitId = G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Limits')
    1805                 data = G2frame.PatternTree.GetItemPyData(LimitId)
     1804                LimitId = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Limits')
     1805                data = G2frame.GPXtree.GetItemPyData(LimitId)
    18061806                data[1][lineNo] = xpos
    18071807                data[1][0] = min(max(data[0][0],data[1][0]),data[1][1])
    18081808                data[1][1] = max(min(data[0][1],data[1][1]),data[1][0])
    1809         elif (G2frame.PatternTree.GetItemText(PickId) == 'Reflection Lists' or \
    1810             'PWDR' in G2frame.PatternTree.GetItemText(PickId)) and xpos:
    1811             Id = G2gd.GetPatternTreeItemId(G2frame,PatternId,'Reflection Lists')
     1809        elif (G2frame.GPXtree.GetItemText(PickId) == 'Reflection Lists' or \
     1810            'PWDR' in G2frame.GPXtree.GetItemText(PickId)) and xpos:
     1811            Id = G2gd.GetGPXtreeItemId(G2frame,PatternId,'Reflection Lists')
    18121812#            GSASIIpath.IPyBreak()
    18131813            if Id:     
    1814                 #Phases = G2frame.PatternTree.GetItemPyData(Id)
     1814                #Phases = G2frame.GPXtree.GetItemPyData(Id)
    18151815                pick = str(G2frame.itemPicked).split('(',1)[1][:-1]
    18161816                if 'line' not in pick:       #avoid data points, etc.
    1817                     data = G2frame.PatternTree.GetItemPyData(G2frame.PatternId)
     1817                    data = G2frame.GPXtree.GetItemPyData(G2frame.PatternId)
    18181818                    num = Page.phaseList.index(pick)
    18191819                    if num:
     
    18401840        Page.canvas.mpl_connect('button_release_event', OnRelease)
    18411841        Page.canvas.mpl_connect('button_press_event',OnPress)
    1842     if 'PWDR' in G2frame.PatternTree.GetItemText(G2frame.PickId):
     1842    if 'PWDR' in G2frame.GPXtree.GetItemText(G2frame.PickId):
    18431843        Histograms,Phases = G2frame.GetUsedHistogramsAndPhasesfromTree()
    18441844        refColors=['b','r','c','g','m','k']
    18451845        Page.phaseColors = {p:refColors[i%len(refColors)] for i,p in enumerate(Phases)}
    1846         Phases = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId,'Reflection Lists'))
     1846        Phases = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId,'Reflection Lists'))
    18471847        Page.phaseList = sorted(Phases.keys()) # define an order for phases (once!)
    18481848        G2frame.dataWindow.Bind(wx.EVT_MENU, onMoveDiffCurve, id=G2frame.dataWindow.moveDiffCurve.GetId())
     
    18521852        G2frame.dataWindow.moveTickLoc.Enable(False)
    18531853        G2frame.dataWindow.moveTickSpc.Enable(False)
    1854     elif G2frame.PatternTree.GetItemText(G2frame.PickId) == 'Peak List':
     1854    elif G2frame.GPXtree.GetItemText(G2frame.PickId) == 'Peak List':
    18551855        G2frame.dataFrame.Bind(wx.EVT_MENU, onMovePeak, id=G2frame.dataWindow.movePeak.GetId())
    18561856    # save information needed to reload from tree and redraw
    1857     kwargs={'PatternName':G2frame.PatternTree.GetItemText(G2frame.PatternId)}
     1857    kwargs={'PatternName':G2frame.GPXtree.GetItemText(G2frame.PatternId)}
    18581858    if G2frame.PickId:
    1859         kwargs['PickName'] = G2frame.PatternTree.GetItemText(G2frame.PickId)
     1859        kwargs['PickName'] = G2frame.GPXtree.GetItemText(G2frame.PickId)
    18601860    #G2frame.G2plotNB.RegisterRedrawRoutine('Powder Patterns',ReplotPattern,
    18611861    G2frame.G2plotNB.RegisterRedrawRoutine(G2frame.G2plotNB.lastRaisedPlotTab,ReplotPattern,
     
    19161916    exclLines = []
    19171917    if G2frame.SinglePlot and PatternId:
    1918         Pattern = G2frame.PatternTree.GetItemPyData(PatternId)
    1919         Pattern.append(G2frame.PatternTree.GetItemText(PatternId))
     1918        Pattern = G2frame.GPXtree.GetItemPyData(PatternId)
     1919        Pattern.append(G2frame.GPXtree.GetItemText(PatternId))
    19201920        PlotList = [Pattern,]
    1921         Parms,Parms2 = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,
     1921        Parms,Parms2 = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,
    19221922            G2frame.PatternId, 'Instrument Parameters'))
    1923         Sample = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Sample Parameters'))
     1923        Sample = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Sample Parameters'))
    19241924        ParmList = [Parms,]
    19251925        SampleList = [Sample,]
     
    19311931        SampleList = []
    19321932        if G2frame.selections is None:
    1933             choices = G2gd.GetPatternTreeDataNames(G2frame,plotType)
     1933            choices = G2gd.GetGPXtreeDataNames(G2frame,plotType)
    19341934        else:
    19351935            choices = G2frame.selections
    19361936        for item in choices:
    1937             id = G2gd.GetPatternTreeItemId(G2frame,G2frame.root, item)
    1938             Pattern = G2frame.PatternTree.GetItemPyData(id)
     1937            id = G2gd.GetGPXtreeItemId(G2frame,G2frame.root, item)
     1938            Pattern = G2frame.GPXtree.GetItemPyData(id)
    19391939            if len(Pattern) < 3:                    # put name on end if needed
    1940                 Pattern.append(G2frame.PatternTree.GetItemText(id))
     1940                Pattern.append(G2frame.GPXtree.GetItemText(id))
    19411941            if 'Offset' not in Pattern[0]:     #plot offset data
    19421942                Ymax = max(Pattern[1][1])
    19431943                Pattern[0].update({'Offset':[0.0,0.0],'delOffset':0.02*Ymax,'refOffset':-0.1*Ymax,'refDelt':0.1*Ymax,})
    19441944            PlotList.append(Pattern)
    1945             ParmList.append(G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,
     1945            ParmList.append(G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,
    19461946                id,'Instrument Parameters'))[0])
    1947             SampleList.append(G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,
     1947            SampleList.append(G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,
    19481948                id, 'Sample Parameters')))
    19491949    lenX = 0
     
    20112011        xye = ma.array(ma.getdata(Pattern[1]))
    20122012        if PickId:
    2013             ifpicked = Pattern[2] == G2frame.PatternTree.GetItemText(PatternId)
    2014             LimitId = G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId,'Limits')
    2015             limits = G2frame.PatternTree.GetItemPyData(LimitId)
     2013            ifpicked = Pattern[2] == G2frame.GPXtree.GetItemText(PatternId)
     2014            LimitId = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId,'Limits')
     2015            limits = G2frame.GPXtree.GetItemPyData(LimitId)
    20162016            excls = limits[2:]
    20172017            for excl in excls:
     
    20422042                Y = xye[1]*Sample['Scale'][0]*(1.05)**(offsetY*N)
    20432043        if LimitId and ifpicked:
    2044             limits = np.array(G2frame.PatternTree.GetItemPyData(LimitId))
     2044            limits = np.array(G2frame.GPXtree.GetItemPyData(LimitId))
    20452045            lims = limits[1]
    20462046            if G2frame.plotStyle['qPlot'] and 'PWDR' in plottype:
     
    21692169                Page.canvas.SetToolTipString('')
    21702170                if PickId:
    2171                     if G2frame.PatternTree.GetItemText(PickId) == 'Peak List':
     2171                    if G2frame.GPXtree.GetItemText(PickId) == 'Peak List':
    21722172                        tip = 'On data point: Pick peak - L or R MB. On line: L-move, R-delete'
    21732173                        Page.canvas.SetToolTipString(tip)
    2174                         data = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Peak List'))
     2174                        data = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Peak List'))
    21752175                        selectedPeaks = list(set(
    21762176                            [row for row,col in G2frame.reflGrid.GetSelectedCells()] +
     
    21902190                            if Ni == N+1:
    21912191                                Lines[-1].set_lw(Lines[-1].get_lw()+1)
    2192                     if G2frame.PatternTree.GetItemText(PickId) == 'Limits':
     2192                    if G2frame.GPXtree.GetItemText(PickId) == 'Limits':
    21932193                        tip = 'On data point: Lower limit - L MB; Upper limit - R MB. On limit: MB down to move'
    21942194                        Page.canvas.SetToolTipString(tip)
    2195                         data = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Limits'))
     2195                        data = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Limits'))
    21962196                       
    21972197            else:   #not picked
     
    22112211                    Plot.set_ylim(bottom=np.min(np.trim_zeros(Y))/2.,top=np.max(Y)*2.)
    22122212    if PickId and not G2frame.Contour:
    2213         Parms,Parms2 = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Instrument Parameters'))
    2214         if G2frame.PatternTree.GetItemText(PickId) in ['Index Peak List','Unit Cells List']:
    2215             peaks = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Index Peak List'))
     2213        Parms,Parms2 = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Instrument Parameters'))
     2214        if G2frame.GPXtree.GetItemText(PickId) in ['Index Peak List','Unit Cells List']:
     2215            peaks = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Index Peak List'))
    22162216            if not len(peaks): return # are there any peaks?
    22172217            for peak in peaks[0]:
     
    22332233                else:
    22342234                    Plot.axvline(hkl[-2],color=clr,dashes=(5,5))
    2235         elif G2frame.PatternTree.GetItemText(PickId) in ['Reflection Lists'] or \
    2236             'PWDR' in G2frame.PatternTree.GetItemText(PickId):
    2237             Phases = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId,'Reflection Lists'))
     2235        elif G2frame.GPXtree.GetItemText(PickId) in ['Reflection Lists'] or \
     2236            'PWDR' in G2frame.GPXtree.GetItemText(PickId):
     2237            Phases = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId,'Reflection Lists'))
    22382238            l = GSASIIpath.GetConfigValue('Tick_length',8.0)
    22392239            w = GSASIIpath.GetConfigValue('Tick_width',1.)
     
    22682268    else:
    22692269        G2frame.Lines = Lines
    2270     if PickId and G2frame.PatternTree.GetItemText(PickId) == 'Background':
     2270    if PickId and G2frame.GPXtree.GetItemText(PickId) == 'Background':
    22712271        # plot fixed background points
    2272         backDict = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Background'))[1]
     2272        backDict = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Background'))[1]
    22732273        try:
    2274             Parms,Parms2 = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters'))
     2274            Parms,Parms2 = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters'))
    22752275        except TypeError:
    22762276            Parms = None
     
    23102310    # and sqrt(-ve) in np.where usage               
    23112311#    G2frame.Pwdr = True
    2312     if 'PWDR' in G2frame.PatternTree.GetItemText(G2frame.PickId):
     2312    if 'PWDR' in G2frame.GPXtree.GetItemText(G2frame.PickId):
    23132313        if len(Page.tickDict.keys()) == 1:
    23142314            G2frame.dataWindow.moveTickLoc.Enable(True)
     
    23262326    'Produces normal probability plot for a powder or single crystal histogram'
    23272327    if PatternName:
    2328         G2frame.PatternId = G2gd.GetPatternTreeItemId(G2frame, G2frame.root, PatternName)
     2328        G2frame.PatternId = G2gd.GetGPXtreeItemId(G2frame, G2frame.root, PatternName)
    23292329    new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab('Error analysis','mpl')
    23302330    if new:
     
    23352335                                           PlotDeltSig,(
    23362336                                               G2frame,kind,
    2337                                                G2frame.PatternTree.GetItemText(G2frame.PatternId))
     2337                                               G2frame.GPXtree.GetItemText(G2frame.PatternId))
    23382338                                           )
    23392339    Page.Choice = None
    23402340    PatternId = G2frame.PatternId
    2341     Pattern = G2frame.PatternTree.GetItemPyData(PatternId)
    2342     Pattern.append(G2frame.PatternTree.GetItemText(PatternId))
     2341    Pattern = G2frame.GPXtree.GetItemPyData(PatternId)
     2342    Pattern.append(G2frame.GPXtree.GetItemText(PatternId))
    23432343    wtFactor = Pattern[0]['wtFactor']
    23442344    if kind == 'PWDR':
    2345         limits = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Limits'))[1]
     2345        limits = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Limits'))[1]
    23462346        xye = np.array(Pattern[1])
    23472347        xmin = np.searchsorted(xye[0],limits[0])
     
    24462446            G2frame.Waterfall = not G2frame.Waterfall
    24472447        elif event.key == 'f' and not G2frame.SinglePlot:
    2448             choices = G2gd.GetPatternTreeDataNames(G2frame,'PDF ')
     2448            choices = G2gd.GetGPXtreeDataNames(G2frame,'PDF ')
    24492449            dlg = G2G.G2MultiChoiceDialog(G2frame.dataFrame,'Select dataset to plot',
    24502450                'Multidata plot selection',choices)
     
    25962596    PatternId = G2frame.PatternId
    25972597    if not PatternId:  return
    2598     pId = G2gd.GetPatternTreeItemId(G2frame,PatternId, 'PDF Controls')
     2598    pId = G2gd.GetGPXtreeItemId(G2frame,PatternId, 'PDF Controls')
    25992599    if not pId:  return
    2600     PDFdata = G2frame.PatternTree.GetItemPyData(pId)
     2600    PDFdata = G2frame.GPXtree.GetItemPyData(pId)
    26012601    numbDen = 0.
    26022602    if 'ElList' in PDFdata:
     
    26102610        PlotList = []
    26112611        if G2frame.PDFselections is None:
    2612             choices = G2gd.GetPatternTreeDataNames(G2frame,'PDF ')
     2612            choices = G2gd.GetGPXtreeDataNames(G2frame,'PDF ')
    26132613        else:
    26142614            choices = G2frame.PDFselections
    26152615        for item in choices:
    2616             Pid = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,item)
    2617             Id = G2gd.GetPatternTreeItemId(G2frame,Pid,'PDF Controls')
    2618             Pattern = G2frame.PatternTree.GetItemPyData(Id)
     2616            Pid = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,item)
     2617            Id = G2gd.GetGPXtreeItemId(G2frame,Pid,'PDF Controls')
     2618            Pattern = G2frame.GPXtree.GetItemPyData(Id)
    26192619            if Pattern:
    26202620                PlotList.append(Pattern[plotType])
     
    31553155    Page.Choice = None
    31563156    PatternId = G2frame.PatternId
    3157     data = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Models'))
     3157    data = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Models'))
    31583158    Bins,Dbins,BinMag = data['Size']['Distribution']
    31593159    Plot.set_title('Size Distribution')
     
    31853185            Page.canvas.SetCursor(wx.CROSS_CURSOR)
    31863186            G2frame.G2plotNB.status.SetStatusText('2-theta =%9.3f '%(xpos,),1)
    3187             if G2frame.PickId and G2frame.PatternTree.GetItemText(G2frame.PickId) in ['Index Peak List','Unit Cells List']:
     3187            if G2frame.PickId and G2frame.GPXtree.GetItemText(G2frame.PickId) in ['Index Peak List','Unit Cells List']:
    31883188                found = []
    31893189                if len(G2frame.HKL):
     
    32043204    Plot.set_xlabel(r'$\mathsf{2\theta}$',fontsize=14)
    32053205    PatternId = G2frame.PatternId
    3206     peaks = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Index Peak List'))[0]
     3206    peaks = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Index Peak List'))[0]
    32073207    for peak in peaks:
    32083208        Plot.axvline(peak[0],color='b')
     
    32323232#    gamFW2 = lambda s,g: math.sqrt(s**2+(0.4654996*g)**2)+.5345004*g  #Ubaldo Bafile - private communication
    32333233    if PatternName:
    3234         G2frame.PatternId = G2gd.GetPatternTreeItemId(G2frame, G2frame.root, PatternName)
     3234        G2frame.PatternId = G2gd.GetGPXtreeItemId(G2frame, G2frame.root, PatternName)
    32353235    PatternId = G2frame.PatternId
    3236     limitID = G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Limits')
     3236    limitID = G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Limits')
    32373237    if limitID:
    3238         limits = G2frame.PatternTree.GetItemPyData(limitID)[:2]
     3238        limits = G2frame.GPXtree.GetItemPyData(limitID)[:2]
    32393239    else:
    32403240        return
    3241     Parms,Parms2 = G2frame.PatternTree.GetItemPyData( \
    3242         G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Instrument Parameters'))
     3241    Parms,Parms2 = G2frame.GPXtree.GetItemPyData( \
     3242        G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Instrument Parameters'))
    32433243    if 'PKS' in Parms['Type'][0]:
    32443244        return
     
    32483248        lam = G2mth.getWave(Parms)
    32493249    try:  # PATCH: deal with older peak lists, before changed to dict to implement TOF
    3250         peaks = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Peak List'))['peaks']
     3250        peaks = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Peak List'))['peaks']
    32513251    except TypeError:
    32523252        print "Your peak list needs reformatting...",
    3253         item = G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Peak List')
    3254         G2frame.PatternTree.SelectItem(item) 
    3255         item = G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Instrument Parameters')
    3256         G2frame.PatternTree.SelectItem(item)
     3253        item = G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Peak List')
     3254        G2frame.GPXtree.SelectItem(item) 
     3255        item = G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Instrument Parameters')
     3256        G2frame.GPXtree.SelectItem(item)
    32573257        print "done"
    32583258        return
     
    32643264    # save information needed to reload from tree and redraw
    32653265    G2frame.G2plotNB.RegisterRedrawRoutine(G2frame.G2plotNB.lastRaisedPlotTab,
    3266             PlotPeakWidths,(G2frame,G2frame.PatternTree.GetItemText(G2frame.PatternId))
     3266            PlotPeakWidths,(G2frame,G2frame.GPXtree.GetItemText(G2frame.PatternId))
    32673267            )
    32683268
    3269     TreeItemText = G2frame.PatternTree.GetItemText(G2frame.PatternId)
     3269    TreeItemText = G2frame.GPXtree.GetItemText(G2frame.PatternId)
    32703270    G2frame.G2plotNB.status.SetStatusText('histogram: '+TreeItemText,1)
    32713271    Page.Choice = None
     
    35713571            Plot.set_ylabel('MRD',fontsize=14)
    35723572    elif plotType in ['Inv. pole figure',]:
    3573         Id = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,hist)
    3574         rId = G2gd.GetPatternTreeItemId(G2frame,Id,'Reflection Lists')
    3575         RefData = G2frame.PatternTree.GetItemPyData(rId)[phase]
     3573        Id = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,hist)
     3574        rId = G2gd.GetGPXtreeItemId(G2frame,Id,'Reflection Lists')
     3575        RefData = G2frame.GPXtree.GetItemPyData(rId)[phase]
    35763576        Type = RefData['Type']
    35773577        Refs = RefData['RefList'].T
     
    43584358    :param wx.Frame G2frame: The main GSAS-II tree "window"
    43594359    '''
    4360     Masks = G2frame.PatternTree.GetItemPyData(
    4361         G2gd.GetPatternTreeItemId(G2frame,G2frame.Image, 'Masks'))
     4360    Masks = G2frame.GPXtree.GetItemPyData(
     4361        G2gd.GetGPXtreeItemId(G2frame,G2frame.Image, 'Masks'))
    43624362    if G2frame.MaskKey == 'f':
    43634363        new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab('2D Powder Image','mpl',newImage=False)
     
    43964396    '''
    43974397    G2frame.GetStatusBar().SetStatusText('Add strain ring active - LB pick d-zero value',0)
    4398     G2frame.PickId = G2gd.GetPatternTreeItemId(G2frame,G2frame.Image, 'Stress/Strain')
    4399     data = G2frame.PatternTree.GetItemPyData(G2frame.PickId)
     4398    G2frame.PickId = G2gd.GetGPXtreeItemId(G2frame,G2frame.Image, 'Stress/Strain')
     4399    data = G2frame.GPXtree.GetItemPyData(G2frame.PickId)
    44004400    return data
    44014401
     
    44674467    global Data,Masks,StrSta  # RVD: these are needed for multiple image controls/masks
    44684468    colors=['b','g','r','c','m','k']
    4469     Data = G2frame.PatternTree.GetItemPyData(
    4470         G2gd.GetPatternTreeItemId(G2frame,G2frame.Image, 'Image Controls'))
     4469    Data = G2frame.GPXtree.GetItemPyData(
     4470        G2gd.GetGPXtreeItemId(G2frame,G2frame.Image, 'Image Controls'))
    44714471# patch
    44724472    if 'invert_x' not in Data:
     
    44744474        Data['invert_y'] = True
    44754475# end patch
    4476     Masks = G2frame.PatternTree.GetItemPyData(
    4477         G2gd.GetPatternTreeItemId(G2frame,G2frame.Image, 'Masks'))
     4476    Masks = G2frame.GPXtree.GetItemPyData(
     4477        G2gd.GetGPXtreeItemId(G2frame,G2frame.Image, 'Masks'))
    44784478    try:    #may be absent
    4479         StrSta = G2frame.PatternTree.GetItemPyData(
    4480             G2gd.GetPatternTreeItemId(G2frame,G2frame.Image, 'Stress/Strain'))
     4479        StrSta = G2frame.GPXtree.GetItemPyData(
     4480            G2gd.GetGPXtreeItemId(G2frame,G2frame.Image, 'Stress/Strain'))
    44814481    except TypeError:   #is missing
    44824482        StrSta = {}
     
    44924492            scalex = 1000./pixelSize[0]         #microns --> 1/mm
    44934493            scaley = 1000./pixelSize[1]
    4494             if item and G2frame.PatternTree.GetItemText(G2frame.PickId) == 'Image Controls':
     4494            if item and G2frame.GPXtree.GetItemText(G2frame.PickId) == 'Image Controls':
    44954495                if 'Text' in str(item):
    44964496                    Page.canvas.SetToolTipString('%8.3f %8.3fmm'%(event.xdata,event.ydata))
     
    45264526    def OnImPlotKeyPress(event):
    45274527        try:
    4528             treeItem = G2frame.PatternTree.GetItemText(G2frame.PickId)
     4528            treeItem = G2frame.GPXtree.GetItemText(G2frame.PickId)
    45294529        except TypeError:
    45304530            return
     
    47924792
    47934793        if G2frame.itemPicked is not None: return
    4794         if G2frame.PatternTree.GetItemText(G2frame.PickId) == 'Image Controls':
     4794        if G2frame.GPXtree.GetItemText(G2frame.PickId) == 'Image Controls':
    47954795            G2frame.itemPicked = pick = event.artist
    47964796            G2frame.mousePicked = event.mouseevent
     
    48044804            G2frame.cid = Page.canvas.mpl_connect('motion_notify_event', OnDragIntBound)
    48054805            pick.set_linestyle(saveLinestyle) # back to original
    4806         elif G2frame.PatternTree.GetItemText(G2frame.PickId) == 'Masks':
     4806        elif G2frame.GPXtree.GetItemText(G2frame.PickId) == 'Masks':
    48074807            # prepare to animate dragging of mask
    48084808            G2frame.itemPicked = pick = event.artist
     
    48394839        '''
    48404840        try:
    4841             treeItem = G2frame.PatternTree.GetItemText(G2frame.PickId)
     4841            treeItem = G2frame.GPXtree.GetItemText(G2frame.PickId)
    48424842        except TypeError:
    48434843            return
     
    50795079        Page.canvas.mpl_connect('button_release_event', OnImRelease)
    50805080    Page.Choice = None
    5081     Title = G2frame.PatternTree.GetItemText(G2frame.Image)[4:]
     5081    Title = G2frame.GPXtree.GetItemText(G2frame.Image)[4:]
    50825082    G2frame.G2plotNB.status.DestroyChildren()
    50835083    if G2frame.logPlot:
     
    50855085    Plot.set_title(Title)
    50865086    try:
    5087         if G2frame.PatternTree.GetItemText(G2frame.PickId) in ['Image Controls',]:
     5087        if G2frame.GPXtree.GetItemText(G2frame.PickId) in ['Image Controls',]:
    50885088            Page.Choice = (' key press','l: log(I) on','d: set dmin','x: flip x','y: flip y',)
    50895089            if G2frame.logPlot:
    50905090                Page.Choice[1] = 'l: log(I) off'
    50915091            Page.keyPress = OnImPlotKeyPress
    5092         elif G2frame.PatternTree.GetItemText(G2frame.PickId) in ['Masks',]:
     5092        elif G2frame.GPXtree.GetItemText(G2frame.PickId) in ['Masks',]:
    50935093            Page.Choice = [' key press','l: log(I) on','a: arc mask','r: ring mask',
    50945094                'p: polygon mask','f: frame mask',
     
    50995099                Page.Choice[1] = 'l: log(I) off'
    51005100            Page.keyPress = OnImPlotKeyPress
    5101         elif G2frame.PatternTree.GetItemText(G2frame.PickId) in ['Stress/Strain',]:
     5101        elif G2frame.GPXtree.GetItemText(G2frame.PickId) in ['Stress/Strain',]:
    51025102            Page.Choice = (' key press','a: add new ring',)
    51035103            Page.keyPress = OnImPlotKeyPress
    51045104    except TypeError:
    51055105        pass
    5106     size,imagefile,imagetag = G2frame.PatternTree.GetImageLoc(G2frame.Image)
     5106    size,imagefile,imagetag = G2frame.GPXtree.GetImageLoc(G2frame.Image)
    51075107
    51085108    imScale = 1
     
    51425142           
    51435143        Plot.plot(xcent,ycent,'x')
    5144         #G2frame.PatternTree.GetItemText(item)
     5144        #G2frame.GPXtree.GetItemText(item)
    51455145        if Data['showLines']: # draw integration range arc/circles/lines
    51465146            LRAzim = Data['LRazimuth']                  #NB: integers
     
    51855185                Plot.plot([arcxI[ind],arcxO[ind]],[arcyI[ind],arcyO[ind]],color='k',dashes=(5,5))
    51865186                   
    5187         if G2frame.PickId and G2frame.PatternTree.GetItemText(G2frame.PickId) in ['Image Controls',]:
     5187        if G2frame.PickId and G2frame.GPXtree.GetItemText(G2frame.PickId) in ['Image Controls',]:
    51885188            for xring,yring in Data['ring']:
    51895189                Plot.plot(xring,yring,'r+',picker=3)
     
    51995199                    Plot.add_artist(Ellipse([cent[0],cent[1]],2*width,2*height,phi,ec=col,fc='none'))
    52005200                    Plot.text(cent[0],cent[1],'+',color=col,ha='center',va='center')
    5201         if G2frame.PickId and G2frame.PatternTree.GetItemText(G2frame.PickId) in ['Stress/Strain',]:
     5201        if G2frame.PickId and G2frame.GPXtree.GetItemText(G2frame.PickId) in ['Stress/Strain',]:
    52025202            for N,ring in enumerate(StrSta['d-zero']):
    52035203                if 'ImxyCalc' in ring:
     
    53275327    Page.Choice = None
    53285328       
    5329     Data = G2frame.PatternTree.GetItemPyData(
    5330         G2gd.GetPatternTreeItemId(G2frame,G2frame.Image, 'Image Controls'))
     5329    Data = G2frame.GPXtree.GetItemPyData(
     5330        G2gd.GetGPXtreeItemId(G2frame,G2frame.Image, 'Image Controls'))
    53315331    image = G2frame.Integrate[0]
    53325332    xsc = G2frame.Integrate[1]
     
    53345334    Imin,Imax = Data['range'][1]
    53355335    acolor = mpl.cm.get_cmap(Data['color'])
    5336     Plot.set_title(G2frame.PatternTree.GetItemText(G2frame.Image)[4:])
     5336    Plot.set_title(G2frame.GPXtree.GetItemText(G2frame.Image)[4:])
    53375337    Plot.set_ylabel('azimuth',fontsize=12)
    53385338    Plot.set_xlabel('2-theta',fontsize=12)
     
    53815381        Page.views = False
    53825382    Page.Choice = None
    5383     Data = G2frame.PatternTree.GetItemPyData(
    5384         G2gd.GetPatternTreeItemId(G2frame,G2frame.Image, 'Image Controls'))
     5383    Data = G2frame.GPXtree.GetItemPyData(
     5384        G2gd.GetGPXtreeItemId(G2frame,G2frame.Image, 'Image Controls'))
    53855385    Imin,Imax = Data['range'][1]
    53865386    step = (Imax-Imin)/5.
    53875387    V = np.arange(Imin,Imax,step)
    53885388    acolor = mpl.cm.get_cmap(Data['color'])
    5389     Plot.set_title(G2frame.PatternTree.GetItemText(G2frame.Image)[4:])
     5389    Plot.set_title(G2frame.GPXtree.GetItemText(G2frame.Image)[4:])
    53905390    Plot.set_xlabel('azimuth',fontsize=12)
    53915391    Plot.set_ylabel('2-theta',fontsize=12)
Note: See TracChangeset for help on using the changeset viewer.