Changeset 2187 for trunk/GSASIIplot.py


Ignore:
Timestamp:
Mar 31, 2016 3:17:43 PM (7 years ago)
Author:
vondreele
Message:

Modify the Cite please banners to add small angle & DIFFaX references
remov
e 'axial' from DIFFaX choices (for now) as it leads to a streak calculation not supported in GSAS-II
replace pylab stuff with use of PlotXYZ which has been improved
fix character Greek 'mu' in Layers GUI
new GSAS-II function for calculating selected area diffraction (still testing)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r2183 r2187  
    23972397    '''simple contour plot of xyz data, used for diagnostic purposes
    23982398    '''
     2399    def OnKeyPress(event):
     2400        if event.key == 'u':
     2401            G2frame.Cmax = min(1.0,G2frame.Cmax*1.2)
     2402        elif event.key == 'd':
     2403            G2frame.Cmax = max(0.0,G2frame.Cmax*0.8)
     2404        elif event.key == 'o':
     2405            G2frame.Cmax = 1.0
     2406           
     2407        elif event.key == 'i':
     2408            choice = ['nearest','bilinear','bicubic','spline16','spline36','hanning',
     2409               'hamming','hermite','kaiser','quadric','catrom','gaussian','bessel',
     2410               'mitchell','sinc','lanczos']
     2411            dlg = wx.SingleChoiceDialog(G2frame,'Select','Interpolation',choice)
     2412            if dlg.ShowModal() == wx.ID_OK:
     2413                sel = dlg.GetSelection()
     2414                G2frame.Interpolate = choice[sel]
     2415            else:
     2416                G2frame.Interpolate = 'nearest'
     2417            dlg.Destroy()
     2418           
     2419        elif event.key == 's':
     2420            choice = [m for m in mpl.cm.datad.keys() if not m.endswith("_r")]
     2421            choice.sort()
     2422            dlg = wx.SingleChoiceDialog(G2frame,'Select','Color scheme',choice)
     2423            if dlg.ShowModal() == wx.ID_OK:
     2424                sel = dlg.GetSelection()
     2425                G2frame.ContourColor = choice[sel]
     2426            else:
     2427                G2frame.ContourColor = 'Paired'
     2428            dlg.Destroy()
     2429        wx.CallAfter(PlotXYZ,G2frame,XY,Z,labelX,labelY,False,Title)
     2430   
    23992431    def OnMotion(event):
    24002432        xpos = event.xdata
    2401         if xpos:                                        #avoid out of frame mouse position
     2433        if Xmin<xpos<Xmax:                                        #avoid out of frame mouse position
    24022434            ypos = event.ydata
    2403             Page.canvas.SetCursor(wx.CROSS_CURSOR)
    2404             ix = int(Nxy[0]*(xpos-Xmin)+0.5)
    2405             iy = int(Nxy[1]*(ypos-Ymin)+0.5)
    2406             try:
    2407                 G2frame.G2plotNB.status.SetStatusText('%s =%9.3f %s =%9.3f val =%9.3f'% \
    2408                     (labelX,xpos,labelY,ypos,Z[ix,iy]),1)                   
    2409             except TypeError:
    2410                 G2frame.G2plotNB.status.SetStatusText('Select '+Title+' pattern first',1)
    2411 
     2435            if Ymin<ypos<Ymax:
     2436                Xwd = Xmax-Xmin
     2437                Ywd = Ymax-Ymin
     2438                Page.canvas.SetCursor(wx.CROSS_CURSOR)
     2439                ix = int(Nxy[0]*(xpos-Xmin)/Xwd)
     2440                iy = int(Nxy[1]*(ypos-Ymin)/Ywd)
     2441                try:
     2442                    G2frame.G2plotNB.status.SetStatusText('%s =%9.3f %s =%9.3f val =%9.3f'% \
     2443                        (labelX,xpos,labelY,ypos,Z[ix,iy]),1)                   
     2444                except TypeError:
     2445                    G2frame.G2plotNB.status.SetStatusText('Select '+Title+' pattern first',1)
     2446                   
    24122447    try:
    24132448        plotNum = G2frame.G2plotNB.plotList.index(Title)
     
    24242459        Page = G2frame.G2plotNB.nb.GetPage(plotNum)
    24252460        Page.canvas.mpl_connect('motion_notify_event', OnMotion)
     2461        Page.canvas.mpl_connect('key_press_event', OnKeyPress)
    24262462   
    2427     Page.Choice = None
     2463    Page.Choice = (' key press','d: lower contour max','u: raise contour max','o: reset contour max',
     2464        'i: interpolation method','s: color scheme')
    24282465    Page.SetFocus()
    24292466    G2frame.G2plotNB.status.DestroyChildren()
    24302467    Nxy = Z.shape
     2468    Zmax = np.max(Z)
    24312469    Xmin = np.min(XY[0])
    24322470    Xmax = np.max(XY[0])
     
    24422480    else:
    24432481        Plot.set_ylabel(r'Y',fontsize=14)
    2444     Img = Plot.imshow(Z.T,cmap='Paired',interpolation='nearest',origin='lower', \
    2445         aspect='auto',extent=[Xmin,Xmax,Ymin,Ymax])
     2482    acolor = mpl.cm.get_cmap(G2frame.ContourColor)
     2483    Img = Plot.imshow(Z.T,cmap=acolor,interpolation=G2frame.Interpolate,origin='lower', \
     2484        aspect='auto',extent=[Xmin,Xmax,Ymin,Ymax],vmin=0,vmax=Zmax*G2frame.Cmax)
    24462485    Page.figure.colorbar(Img)
    24472486    if not newPlot:
Note: See TracChangeset for help on using the changeset viewer.