Changeset 2931


Ignore:
Timestamp:
Jul 13, 2017 1:08:24 PM (6 years ago)
Author:
vondreele
Message:

remove duplicate code from G2dataGUI lines 5922-3; same thing is done on next line
Add a selectuse option for sequential results table - Use column no longer editable.
Use selects plottable points for seq results plots.

Location:
branch/2frame
Files:
3 edited

Legend:

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

    r2929 r2931  
    49124912        # Sequential results
    49134913        G2G.Define_wxId('wxID_RENAMESEQSEL', 'wxID_SAVESEQSEL', 'wxID_SAVESEQCSV', 'wxID_SAVESEQSELCSV', 'wxID_PLOTSEQSEL',
    4914           'wxID_ORGSEQSEL', 'wxID_ADDSEQVAR', 'wxID_DELSEQVAR', 'wxID_EDITSEQVAR', 'wxID_COPYPARFIT', 'wxID_AVESEQSEL',
     4914          'wxID_ORGSEQSEL', 'wxID_ADDSEQVAR', 'wxID_DELSEQVAR', 'wxID_EDITSEQVAR', 'wxID_COPYPARFIT', 'wxID_AVESEQSEL','wxID_SELECTUSE',
    49154915          'wxID_ADDPARFIT', 'wxID_DELPARFIT', 'wxID_EDITPARFIT', 'wxID_DOPARFIT', 'wxID_ADDSEQDIST', 'wxID_ADDSEQANGLE', 'wxID_ORGSEQINC',)
    49164916        self.SequentialMenu = wx.MenuBar()
     
    49184918        self.SequentialFile = wx.Menu(title='')
    49194919        self.SequentialMenu.Append(menu=self.SequentialFile, title='Columns')
     4920        self.SequentialFile.Append(id=G2G.wxID_SELECTUSE, kind=wx.ITEM_NORMAL,text='Select used',
     4921            help='Select rows to be used in plots/equation fitting')
    49204922        self.SequentialFile.Append(id=G2G.wxID_RENAMESEQSEL, kind=wx.ITEM_NORMAL,text='Rename selected',
    49214923            help='Rename selected sequential refinement columns')
     
    59185920            try:
    59195921                if 'Seq Data' in data:
    5920                     for item in data['Seq Data']:
    5921                         sel.append(choices.index(item))
     5922#                    for item in data['Seq Data']:
     5923#                        sel.append(choices.index(item))
    59225924                    sel = [choices.index(item) for item in data['Seq Data']]
    59235925            except ValueError:  #data changed somehow - start fresh
     
    62066208            G2plt.PlotCovariance(G2frame,data[name])
    62076209        else:
    6208             G2frame.ErrorDialog(
    6209                 'Select columns',
    6210                 'No columns or rows selected in table. Click on row or column labels to select fields for plotting.'
    6211                 )
     6210            G2frame.ErrorDialog('Select columns',
     6211                'No columns or rows selected in table. Click on row or column labels to select fields for plotting.')
    62126212               
    62136213    def OnAveSelSeq(event):
     
    62246224                print ' Average for '+G2frame.SeqTable.GetColLabelValue(col)+': '+'%.6g'%(ave)+' +/- '+'%.6g'%(sig)
    62256225        else:
    6226             G2frame.ErrorDialog(
    6227                 'Select columns',
    6228                 'No columns selected in table. Click on column labels to select fields for averaging.'
    6229                 )
     6226            G2frame.ErrorDialog('Select columns',
     6227                'No columns selected in table. Click on column labels to select fields for averaging.')
     6228           
     6229    def OnSelectUse(event):
     6230        dlg = G2G.G2MultiChoiceDialog(G2frame, 'Select rows to use','Select rows',histNames)
     6231        sellist = [i for i,item in enumerate(G2frame.colList[0]) if item]
     6232        dlg.SetSelections(sellist)
     6233        if dlg.ShowModal() == wx.ID_OK:
     6234            sellist = dlg.GetSelections()
     6235            for row in range(G2frame.SeqTable.GetNumberRows()):
     6236                G2frame.SeqTable.SetValue(row,0,False)
     6237                G2frame.colList[0][row] = False
     6238            for row in sellist:
     6239                G2frame.SeqTable.SetValue(row,0,True)
     6240                G2frame.colList[0][row] = True
     6241            G2frame.dataDisplay.ForceRefresh()
     6242        dlg.Destroy()
    62306243               
    62316244    def OnRenameSelSeq(event):
     
    62496262        G2plt.PlotSelectedSequence(G2frame,cols,GetColumnInfo,SelectXaxis)
    62506263           
    6251     def OnReOrgSelSeq(event):
    6252         'Reorder the columns -- probably not fully implemented'
    6253         G2G.GetItemOrder(G2frame,VaryListChanges,vallookup,posdict)   
    6254         UpdateSeqResults(G2frame,data,G2frame.dataDisplay.GetSize()) # redisplay variables
     6264#    def OnReOrgSelSeq(event):
     6265#        'Reorder the columns -- probably not fully implemented'
     6266#        G2G.GetItemOrder(G2frame,VaryListChanges,vallookup,posdict)   
     6267#        UpdateSeqResults(G2frame,data,G2frame.dataDisplay.GetSize()) # redisplay variables
    62556268
    62566269    def OnSaveSelSeqCSV(event):
     
    69706983    G2frame.SetTitle('Sequential refinement results')
    69716984    G2frame.GetStatusBar().SetStatusText('',1)
     6985    G2frame.Bind(wx.EVT_MENU, OnSelectUse, id=G2G.wxID_SELECTUSE)
    69726986    G2frame.Bind(wx.EVT_MENU, OnRenameSelSeq, id=G2G.wxID_RENAMESEQSEL)
    69736987    G2frame.Bind(wx.EVT_MENU, OnSaveSelSeq, id=G2G.wxID_SAVESEQSEL)
     
    70457059    nRows = len(histNames)
    70467060    G2frame.colList = [nRows*[True]]
    7047     G2frame.colSigs = [None]
    7048     colLabels = ['Use']
    7049     Types = [wg.GRID_VALUE_BOOL]
     7061    G2frame.colSigs = [None,]
     7062    colLabels = ['Use',]
     7063    Types = [wg.GRID_VALUE_BOOL,]
    70507064    # start with Rwp values
    70517065    if 'IMG ' not in histNames[0][:4]:
     
    73157329        colLabels=colLabels,rowLabels=histNames,types=Types)
    73167330    G2frame.dataDisplay.SetTable(G2frame.SeqTable, True)
    7317     #G2frame.dataDisplay.EnableEditing(False)
    7318     # make all but first column read-only
    7319     for c in range(1,len(colLabels)):
    7320         for r in range(nRows):
    7321             G2frame.dataDisplay.SetCellReadOnly(r,c)
     7331    G2frame.dataDisplay.EnableEditing(False)
     7332    # make all read-only
     7333#    for c in range(len(colLabels)):
     7334#        for r in range(nRows):
     7335#            G2frame.dataDisplay.SetCellReadOnly(r,c)
    73227336    G2frame.dataDisplay.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK, PlotSSelect)
    73237337    G2frame.dataDisplay.Bind(wg.EVT_GRID_LABEL_LEFT_DCLICK, PlotSelect)
     
    76247638                        u' Unweighted phase residuals RF\u00b2: %.3f%%, RF: %.3f%% on %d reflections  '% \
    76257639                        (data[0][pfx+'Rf^2'],data[0][pfx+'Rf'],data[0][value])))
     7640               
    76267641                   
    76277642    G2frame.GPXtree.SetItemPyData(item,data)
  • branch/2frame/GSASIIddataGUI.py

    r2917 r2931  
    2323import GSASIIspc as G2spc
    2424import GSASIIplot as G2plt
    25 import GSASIIdataGUI as G2gd
    2625import GSASIIpwd as G2pwd
    2726import GSASIIphsGUI as G2phsGUI
  • branch/2frame/GSASIIplot.py

    r2914 r2931  
    42444244        Plot.clear()
    42454245        colors=['b','g','r','c','m','k']
     4246        uselist = Page.seqTableGet(0)[1]
    42464247        if G2frame.seqXaxis is not None:   
    42474248            xName,X,Xsig = Page.seqTableGet(G2frame.seqXaxis)
     
    42574258            Ysnew = []
    42584259            for i in range(len(X)):
     4260                if not uselist[i]:
     4261                    continue
    42594262                if X[i] is None or Y[i] is None:
    42604263                    if Ysnew:
     
    56685671        except AttributeError:       #if from OnKeyBox above
    56695672            key = str(event.key).upper()
    5670         if key in ['+','-','=','0'] and generalData['Modulated']:
    5671             if key == '0':
    5672                 G2frame.tau = 0.
    5673             elif key in ['+','=']:
    5674                 G2frame.tau += 0.1
    5675             elif key == '-':
    5676                 G2frame.tau -= 0.1
    5677             G2frame.tau %= 1.   #force 0-1 range
    5678             G2frame.G2plotNB.status.SetStatusText('Modulation tau = %.2f'%(G2frame.tau),1)
    5679             data['Drawing']['Atoms'],Fade = G2mth.ApplyModulation(data,G2frame.tau)     #modifies drawing atom array!         
    5680             SetDrawAtomsText(data['Drawing']['Atoms'])
    5681             G2phG.FindBondsDraw(data)           #rebuild bonds & polygons
    5682             if not np.any(Fade):
    5683                 Fade += 1
    5684             Draw('key down',Fade)
     5673        if key in ['+','-','=','0']:
     5674            if generalData['Modulated']:
     5675                if key == '0':
     5676                    G2frame.tau = 0.
     5677                elif key in ['+','=']:
     5678                    G2frame.tau += 0.1
     5679                elif key == '-':
     5680                    G2frame.tau -= 0.1
     5681                G2frame.tau %= 1.   #force 0-1 range
     5682                G2frame.G2plotNB.status.SetStatusText('Modulation tau = %.2f'%(G2frame.tau),1)
     5683                data['Drawing']['Atoms'],Fade = G2mth.ApplyModulation(data,G2frame.tau)     #modifies drawing atom array!         
     5684                SetDrawAtomsText(data['Drawing']['Atoms'])
     5685                G2phG.FindBondsDraw(data)           #rebuild bonds & polygons
     5686                if not np.any(Fade):
     5687                    Fade += 1
     5688                Draw('key down',Fade)
     5689            else:
     5690                pass        #TODO sequential result movie here
    56855691           
    56865692    def GetTruePosition(xy,Add=False):
Note: See TracChangeset for help on using the changeset viewer.