Changeset 2659 for trunk/GSASIIplot.py


Ignore:
Timestamp:
Jan 24, 2017 1:58:38 PM (6 years ago)
Author:
vondreele
Message:

make lab data (2 x-ray wavelengths) instrument default 'Bragg-Brentano', all others 'Debye-Scherrer'
refactor PDF stuff to show PDF Controls & (new) PDF Peaks on G2 tree (removing I(Q)...).
Old gpx files with I(Q)... updated automatically to new scheme
Add new tree item for PDF Peaks - does nothing yet.
Fix FWHM calc for TOF so bins/FWHM on peak fitting make sense.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r2654 r2659  
    23492349################################################################################
    23502350           
    2351 def PlotISFG(G2frame,newPlot=False,plotType=''):
     2351def PlotISFG(G2frame,data,newPlot=False,plotType='',peaks=None):
    23522352    ''' Plotting package for PDF analysis; displays I(Q), S(Q), F(Q) and G(r) as single
    23532353    or multiple plots with waterfall and contour plots as options
     
    23892389            Page.Offset[0] += 1.
    23902390        elif event.key == 'o':
    2391             Page.Offset = [0,0]
     2391            if G2frame.Contour:
     2392                G2frame.Interpolate = 'nearest'
     2393                G2frame.Cmin = 0.0
     2394                G2frame.Cmax = 1.0
     2395            else:
     2396                Page.Offset = [0,0]           
    23922397        elif event.key == 'm':
    23932398            G2frame.SinglePlot = not G2frame.SinglePlot
     
    23972402            if G2frame.Contour:
    23982403                G2frame.SinglePlot = False
     2404            else:
    23992405                Page.Offset = [0.,0.]
     2406                G2frame.SinglePlot = not G2frame.SinglePlot
    24002407        elif not G2frame.Contour and event.key == 'w':
    24012408            G2frame.Waterfall = not G2frame.Waterfall
     
    24362443        elif event.key == 't' and not G2frame.Contour:
    24372444            G2frame.Legend = not G2frame.Legend
    2438         PlotISFG(G2frame,newPlot=newPlot,plotType=plotType)
     2445        PlotISFG(G2frame,data,newPlot=newPlot,plotType=plotType)
    24392446       
    24402447    def OnMotion(event):
     
    24662473   
    24672474    G2frame.G2plotNB.status.DestroyChildren()
    2468     if G2frame.Contour:
    2469         Page.Choice = (' key press','d: lower contour max','u: raise contour max',
    2470             'D: lower contour min','U: raise contour min',
    2471             'i: interpolation method','s: color scheme','c: contour off','f: select data',
    2472             )
     2475    if peaks == None:
     2476        if G2frame.Contour:
     2477            Page.Choice = (' key press','d: lower contour max','u: raise contour max',
     2478                'D: lower contour min','U: raise contour min','o: reset to default',
     2479                'i: interpolation method','s: color scheme','c: contour off','f: select data',
     2480                )
     2481        else:
     2482            Page.Choice = (' key press','l: offset left','r: offset right','d: offset down','u: offset up',
     2483                'o: reset offset','t: toggle legend','c: contour on','w: toggle waterfall colors (slow!)',
     2484                'm: toggle multiplot','s: color scheme','f: select data' )
     2485        Page.keyPress = OnPlotKeyPress
    24732486    else:
    2474         Page.Choice = (' key press','l: offset left','r: offset right','d: offset down','u: offset up',
    2475             'o: reset offset','t: toggle legend','c: contour on','w: toggle waterfall colors (slow!)',
    2476             'm: toggle multiplot','s: color scheme','f: select data' )
    2477     Page.keyPress = OnPlotKeyPress
     2487        Page.Choice = ()
     2488        newPlot = True
    24782489    PatternId = G2frame.PatternId
    24792490    name = G2frame.PatternTree.GetItemText(PatternId)[4:]
    2480     Pattern = []   
    24812491    if G2frame.SinglePlot:
    2482         name = G2frame.PatternTree.GetItemText(PatternId)
    2483         name = plotType+name[4:]
    2484         Id = G2gd.GetPatternTreeItemId(G2frame,PatternId,name)
    2485         Pattern = G2frame.PatternTree.GetItemPyData(Id)
    2486         if Pattern:
    2487             Pattern.append(name)
    2488         PlotList = [Pattern,]
     2492        if 'G(R)' not in data:
     2493            return
     2494        PlotList = [data[plotType],]
    24892495    else:
    24902496        PlotList = []
     
    24952501        for item in choices:
    24962502            Pid = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,item)
    2497             name = plotType+item[4:]
    2498             Id = G2gd.GetPatternTreeItemId(G2frame,Pid,name)
     2503            Id = G2gd.GetPatternTreeItemId(G2frame,Pid,'PDF Controls')
    24992504            Pattern = G2frame.PatternTree.GetItemPyData(Id)
    25002505            if Pattern:
    2501                 Pattern.append(item)
    2502                 PlotList.append(Pattern)
     2506                PlotList.append(Pattern[plotType])
    25032507        name = plotType
    25042508    if plotType == 'G(R)':
     
    25152519    lenX = 0
    25162520    for Pattern in PlotList:
    2517         try:
    2518             xye = Pattern[1]
    2519         except IndexError:
    2520             return
     2521        xye = Pattern[1]
    25212522        Ymax = max(Ymax,max(xye[1]))
     2523    XYlist = []
    25222524    if G2frame.Contour:
    25232525        ContourZ = []
    25242526        ContourY = []
    25252527        Nseq = 0
    2526     else:
    2527         XYlist = []
    25282528    for N,Pattern in enumerate(PlotList):
    25292529        xye = Pattern[1]
     
    25312531        if not lenX:
    25322532            lenX = len(X)           
    2533         if G2frame.Contour and len(Pattern)>1:
     2533        if G2frame.Contour and len(PlotList)>1:
    25342534            Y = xye[1]
    25352535            if lenX == len(X):
     
    25472547#            else:
    25482548#                Plot.plot(X,Y,colors[N%6],picker=False)
    2549     if G2frame.Contour and len(Pattern)>1:
     2549    if G2frame.Contour and len(PlotList)>1:
    25502550        acolor = mpl.cm.get_cmap(G2frame.ContourColor)
    25512551        Img = Plot.imshow(ContourZ,cmap=acolor,vmin=Ymax*G2frame.Cmin,vmax=Ymax*G2frame.Cmax,interpolation=G2frame.Interpolate,
     
    25962596                line = mplC.LineCollection(XYlist,color=colors[0])
    25972597                Plot.add_collection(line)
     2598            if peaks != None:
     2599                Plot.axvline(peaks['Limits'][0],color='g',dashes=(5,5),picker=2.)
     2600                Plot.axvline(peaks['Limits'][1],color='r',dashes=(5,5),picker=2.)
    25982601        wx.EndBusyCursor()
    25992602        if plotType == 'G(R)':
Note: See TracChangeset for help on using the changeset viewer.