Changeset 3818 for trunk/GSASIIplot.py


Ignore:
Timestamp:
Feb 12, 2019 11:58:33 AM (4 years ago)
Author:
vondreele
Message:

implement sqrt(I) plots for multiplots & contour plots - key 's' to toggle. Old 's' for select color scheme changed to 'S' (capital S).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r3817 r3818  
    18501850                newPlot = True
    18511851        elif event.key == 's' and 'PWDR' in plottype:
    1852             if G2frame.SinglePlot:  #toggle sqrt plot
    1853                 Page.plotStyle['sqrtPlot'] = not Page.plotStyle['sqrtPlot']
    1854                 if Page.plotStyle['sqrtPlot']:
    1855                     Page.plotStyle['logPlot'] = False
    1856                 Ymax = max(Pattern[1][1])
    1857                 if Page.plotStyle['sqrtPlot']:
    1858                     Page.plotStyle['delOffset'] = .002*np.sqrt(Ymax)
    1859                     Page.plotStyle['refOffset'] = -0.1*np.sqrt(Ymax)
    1860                     Page.plotStyle['refDelt'] = .1*np.sqrt(Ymax)
    1861                 else:
    1862                     Page.plotStyle['delOffset'] = .02*Ymax
    1863                     Page.plotStyle['refOffset'] = -0.1*Ymax
    1864                     Page.plotStyle['refDelt'] = .1*Ymax
    1865             else:   #select color scheme for multiplots & contour plots
    1866                 choice = [m for m in mpl.cm.datad.keys()]   # if not m.endswith("_r")
    1867                 choice.sort()
    1868                 dlg = wx.SingleChoiceDialog(G2frame,'Select','Color scheme',choice)
    1869                 if dlg.ShowModal() == wx.ID_OK:
    1870                     sel = dlg.GetSelection()
    1871                     G2frame.ContourColor = choice[sel]
    1872                 else:
    1873                     G2frame.ContourColor = GSASIIpath.GetConfigValue('Contour_color','Paired')
    1874                 dlg.Destroy()
     1852            Page.plotStyle['sqrtPlot'] = not Page.plotStyle['sqrtPlot']
     1853            if Page.plotStyle['sqrtPlot']:
     1854                Page.plotStyle['logPlot'] = False
     1855            Ymax = max(Pattern[1][1])
     1856            if Page.plotStyle['sqrtPlot']:
     1857                Page.plotStyle['delOffset'] = .02*np.sqrt(Ymax)
     1858                Page.plotStyle['refOffset'] = -0.1*np.sqrt(Ymax)
     1859                Page.plotStyle['refDelt'] = .1*np.sqrt(Ymax)
     1860            else:
     1861                Page.plotStyle['delOffset'] = .02*Ymax
     1862                Page.plotStyle['refOffset'] = -0.1*Ymax
     1863                Page.plotStyle['refDelt'] = .1*Ymax
     1864            newPlot = True
     1865        elif event.key == 'S' and 'PWDR' in plottype:
     1866            choice = [m for m in mpl.cm.datad.keys()]   # if not m.endswith("_r")
     1867            choice.sort()
     1868            dlg = wx.SingleChoiceDialog(G2frame,'Select','Color scheme',choice)
     1869            if dlg.ShowModal() == wx.ID_OK:
     1870                sel = dlg.GetSelection()
     1871                G2frame.ContourColor = choice[sel]
     1872            else:
     1873                G2frame.ContourColor = GSASIIpath.GetConfigValue('Contour_color','Paired')
     1874            dlg.Destroy()
    18751875            newPlot = True
    18761876        elif event.key == 'u' and (G2frame.Contour or not G2frame.SinglePlot):
     
    19571957                newPlot = True     
    19581958        elif event.key == 'm':
    1959             Page.plotStyle['sqrtPlot'] = False
     1959#            Page.plotStyle['sqrtPlot'] = False
    19601960            if not G2frame.Contour:               
    19611961                G2frame.SinglePlot = not G2frame.SinglePlot               
     
    19951995                    break
    19961996        else:
    1997             print('no binding for key',event.key)
     1997            #print('no binding for key',event.key)
    19981998            #GSASIIpath.IPyBreak()
    19991999            return
     
    25102510            'PWDR' in G2frame.GPXtree.GetItemText(PickId)) and xpos:
    25112511            Id = G2gd.GetGPXtreeItemId(G2frame,PatternId,'Reflection Lists')
    2512 #            GSASIIpath.IPyBreak()
    25132512            if Id:     
    2514                 #Phases = G2frame.GPXtree.GetItemPyData(Id)
    25152513                pick = str(G2frame.itemPicked).split('(',1)[1][:-1]
    25162514                if 'line' not in pick:       #avoid data points, etc.
     
    25742572    if G2frame.Contour:
    25752573        Page.Choice = (' key press','d: lower contour max','u: raise contour max','o: reset contour max','g: toggle grid',
    2576             'i: interpolation method','s: color scheme','c: contour off','t: temperature for y-axis')
     2574            'i: interpolation method','S: color scheme','c: contour off','t: temperature for y-axis','s: toggle sqrt plot')
    25772575    else:
    25782576        if Page.plotStyle['logPlot']:
     
    26052603                    Page.Choice = (' key press','l: offset left','r: offset right','d/D: offset down/10x','u/U: offset up/10x','o: reset offset',
    26062604                        'b: toggle subtract background','n: log(I) on','c: contour on','q: toggle q plot','t: toggle d-spacing plot','g: toggle grid',
    2607                         'm: toggle multidata plot','w: toggle (Io-Ic)/sig plot','f: select data','s: color scheme','+: no selection')
     2605                        'm: toggle multidata plot','w: toggle (Io-Ic)/sig plot','s: toggle sqrt plot','f: select data','S: color scheme','+: no selection')
    26082606            elif plottype in ['SASD','REFD']:
    26092607                if G2frame.SinglePlot:
     
    26982696    if Page.plotStyle['logPlot']:
    26992697        Title = 'log('+Title+')'
     2698    elif Page.plotStyle['sqrtPlot']:
     2699        Title = r'$\sqrt{I}$ for '+Title
     2700        Ymax = np.sqrt(Ymax)
    27002701    if Page.plotStyle['qPlot'] or plottype in ['SASD','REFD'] and not G2frame.Contour:
    27012702        xLabel = r'$Q, \AA^{-1}$'
     
    27882789                Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour):
    27892790            magLineList = data[0].get('Magnification',[])
    2790             if ('C' in ParmList[0]['Type'][0] and Page.plotStyle['dPlot']
    2791                 ) or ('T' in ParmList[0]['Type'][0] and Page.plotStyle['qPlot']
    2792                 ): # reversed regions relative to data order
     2791            if ('C' in ParmList[0]['Type'][0] and Page.plotStyle['dPlot']) or \
     2792                ('T' in ParmList[0]['Type'][0] and Page.plotStyle['qPlot']): # reversed regions relative to data order
    27932793                tcorner = 1
    27942794                tpos = 1.0
     
    28342834            if Page.plotStyle['sqrtPlot']:
    28352835                olderr = np.seterr(invalid='ignore') #get around sqrt(-ve) error
    2836                 Y = np.where(xye[1]+bxye>=0.,np.sqrt(xye[1]+bxye),-np.sqrt(-xye[1]-bxye))
     2836                Y = np.where(xye[1]+bxye>=0.,np.sqrt(xye[1]+bxye),-np.sqrt(-xye[1]-bxye))+bxye+NoffY*Ymax/100.0
    28372837                np.seterr(invalid=olderr['invalid'])
    28382838            elif 'PWDR' in plottype and G2frame.SinglePlot and not (
Note: See TracChangeset for help on using the changeset viewer.