Changeset 1580


Ignore:
Timestamp:
Nov 21, 2014 4:12:53 PM (9 years ago)
Author:
toby
Message:

Add ignore-threshold mask load; start on hetrogeneous seqref table display

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r1571 r1580  
    101101] = [wx.NewId() for item in range(8)]
    102102
    103 [ wxID_MASKCOPY, wxID_MASKSAVE, wxID_MASKLOAD,wxID_NEWMASKSPOT,wxID_NEWMASKARC,wxID_NEWMASKRING,
    104     wxID_NEWMASKFRAME, wxID_NEWMASKPOLY,
    105 ] = [wx.NewId() for item in range(8)]
     103[ wxID_MASKCOPY, wxID_MASKSAVE, wxID_MASKLOAD, wxID_NEWMASKSPOT,wxID_NEWMASKARC,wxID_NEWMASKRING,
     104    wxID_NEWMASKFRAME, wxID_NEWMASKPOLY,  wxID_MASKLOADNOT,
     105] = [wx.NewId() for item in range(9)]
    106106
    107107[ wxID_STRSTACOPY, wxID_STRSTAFIT, wxID_STRSTASAVE, wxID_STRSTALOAD,wxID_STRSTSAMPLE,
     
    261261        wx.TreeCtrl.Bind(self,eventtype,handler,*args,**kwargs)
    262262
    263 #    def GetItemPyData(self,*args,**kwargs):
    264 #        '''Override the standard method to wrap the contents
    265 #        so that the source can be tracked
    266 #        '''
    267 #        data = super(self.__class__,self).GetItemPyData(*args,**kwargs)
    268 #        textlist = self._getTreeItemsList(args[0])
    269 #        if type(data) is dict:
    270 #            return log.dictLogged(data,textlist)
    271 #        if type(data) is list:
    272 #            return log.listLogged(data,textlist)
    273 #        if type(data) is tuple: #N.B. tuples get converted to lists
    274 #            return log.listLogged(list(data),textlist)
    275 #        return data
     263    # commented out, disables Logging
     264    # def GetItemPyData(self,*args,**kwargs):
     265    #    '''Override the standard method to wrap the contents
     266    #    so that the source can be logged when changed
     267    #    '''
     268    #    data = super(self.__class__,self).GetItemPyData(*args,**kwargs)
     269    #    textlist = self._getTreeItemsList(args[0])
     270    #    if type(data) is dict:
     271    #        return log.dictLogged(data,textlist)
     272    #    if type(data) is list:
     273    #        return log.listLogged(data,textlist)
     274    #    if type(data) is tuple: #N.B. tuples get converted to lists
     275    #        return log.listLogged(list(data),textlist)
     276    #    return data
    276277
    277278    def GetRelativeHistNum(self,histname):
     
    358359    in the object, and are looked up rather than directly set with a bind.
    359360    An index to these buttons is saved as log.ButtonBindingLookup
     361    :param wx.Panel parent: parent widget
     362    :param int id: Id for button
     363    :param str label: label for button
     364    :param str locationcode: a label used internally to uniquely indentify the button
     365    :param function handler: a routine to call when the button is pressed
    360366    '''
    361     def __init__(self,parent,id,label,locationcode,handler,*args,**kwargs):
     367    def __init__(self,parent,id=wx.ID_ANY,label='',locationcode='',
     368                 handler=None,*args,**kwargs):
    362369        super(self.__class__,self).__init__(parent,id,label,*args,**kwargs)
    363370        self.label = label
     
    34883495        self.MaskEdit.Append(help='Load mask from file',
    34893496            id=wxID_MASKLOAD, kind=wx.ITEM_NORMAL,text='Load mask')
     3497        self.MaskEdit.Append(help='Load mask from file; ignore threshold',
     3498            id=wxID_MASKLOADNOT, kind=wx.ITEM_NORMAL,text='Load mask w/o threshold')
    34903499        submenu.Append(help='Create an arc mask with mouse input',
    34913500            id=wxID_NEWMASKARC, kind=wx.ITEM_NORMAL,text='Arc mask')
     
    40424051    def GetTypeName(self, row, col):
    40434052        try:
     4053            if self.data[row][col] is None: return None
    40444054            return self.dataTypes[col]
    40454055        except TypeError:
     
    40484058    def GetValue(self, row, col):
    40494059        try:
     4060            if self.data[row][col] is None: return ""
    40504061            return self.data[row][col]
    40514062        except IndexError:
     
    45574568                SeqFile.write(line+'\n')
    45584569
     4570        # start of OnSaveSelSeq code
    45594571        cols = sorted(G2frame.dataDisplay.GetSelectedCols()) # ignore selection order
    45604572        nrows = G2frame.SeqTable.GetNumberRows()
     
    50465058    Histograms,Phases = G2frame.GetUsedHistogramsAndPhasesfromTree()
    50475059    Controls = G2frame.PatternTree.GetItemPyData(GetPatternTreeItemId(G2frame,G2frame.root,'Controls'))
    5048     # create a place to store Pseudo Vars & Parametric Fit functions, if needed
     5060    # create a place to store Pseudo Vars & Parametric Fit functions, if not present
    50495061    if 'SeqPseudoVars' not in Controls: Controls['SeqPseudoVars'] = {}
    50505062    if 'SeqParFitEqList' not in Controls: Controls['SeqParFitEqList'] = []
     
    51265138    EnableParFitEqMenus()
    51275139
     5140    VaryListChanges = []
     5141    prevVaryList = []
     5142    combinedVaryList = []
     5143    firstValueList = []
     5144    for i,name in enumerate(histNames):
     5145        if i == 0 or prevVaryList != sorted(data[name]['varyList']):
     5146            if GSASIIpath.GetConfigValue('debug'):
     5147                print 'VaryList changes at',name
     5148                print data[name]['varyList']
     5149                print data[name]['variables']
     5150            # add variables to list as they appear
     5151            for j,var in enumerate(data[name]['varyList']):
     5152                if var in combinedVaryList: continue
     5153                combinedVaryList.append(data[name]['varyList'][j])
     5154                firstValueList.append(data[name]['variables'][j])
     5155            prevVaryList = sorted(data[name]['varyList'])
     5156            VaryListChanges += [name]
    51285157    #-----------------------------------------------------------------------------------
    51295158    # build up the data table by columns -----------------------------------------------
     
    51555184    for i,name in enumerate(histNames):
    51565185        sampleDict[name] = dict(zip(sampleParms.keys(),[sampleParms[key][i] for key in sampleParms.keys()]))
    5157     # add unique cell parameters
     5186    # add unique cell parameters TODO: review this where the cell symmetry changes (when possible)
    51585187    if Controls.get('ShowCell',False):
    51595188        for pId in sorted(RecpCellTerms):
     
    51895218            colSigs += zip(*cellESDs)
    51905219    # add the variables that were refined; change from rows to columns
    5191     colList += zip(*[data[name]['variables'] for name in histNames])
    5192     colLabels += data[histNames[0]]['varyList']
    5193     Types += len(data[histNames[0]]['varyList'])*[wg.GRID_VALUE_FLOAT]
    5194     colSigs += zip(*[data[name]['sig'] for name in histNames])
    5195 
     5220    #colList += zip(*[data[name]['variables'] for name in histNames])
     5221    #colLabels += data[histNames[0]]['varyList']
     5222    #Types += len(data[histNames[0]]['varyList'])*[wg.GRID_VALUE_FLOAT]
     5223    #colSigs += zip(*[data[name]['sig'] for name in histNames])
     5224    for var in combinedVaryList:
     5225        colLabels += [var]
     5226        Types += [wg.GRID_VALUE_FLOAT]
     5227        vals = []
     5228        sigs = []
     5229        for name in histNames:
     5230            try:
     5231                i = data[name]['varyList'].index(var)
     5232                vals.append(data[name]['variables'][i])
     5233                sigs.append(data[name]['sig'][i])
     5234            except ValueError: # var not in list
     5235                vals.append(None)
     5236                sigs.append(None)
     5237        colList += [vals]
     5238        colSigs += [sigs]
     5239               
    51965240    # tabulate constrained variables, removing histogram numbers if needed
    51975241    # from parameter label
  • trunk/GSASIIimgGUI.py

    r1579 r1580  
    10321032
    10331033    def Replot(*args,**kwargs):
    1034         print 'Replot'
    10351034        G2plt.PlotExposedImage(G2frame)       
    10361035
     
    11021101       
    11031102    def OnLoadMask(event):
     1103        if event.Id == G2gd.wxID_MASKLOADNOT:
     1104            ignoreThreshold = True
     1105        else:
     1106            ignoreThreshold = False
    11041107        dlg = wx.FileDialog(G2frame, 'Choose image mask file', '.', '',
    11051108            'image mask files (*.immask)|*.immask',wx.OPEN|wx.CHANGE_DIR)
     
    11171120                    [key,val] = S[:-1].split(':')
    11181121                    if key in ['Points','Rings','Arcs','Polygons','Frames','Thresholds']:
     1122                        if ignoreThreshold and key == 'Thresholds': continue
    11191123                        save[key] = eval(val)
    11201124                        if key == 'Thresholds':
     
    11611165    G2frame.dataFrame.Bind(wx.EVT_MENU, OnCopyMask, id=G2gd.wxID_MASKCOPY)
    11621166    G2frame.dataFrame.Bind(wx.EVT_MENU, OnLoadMask, id=G2gd.wxID_MASKLOAD)
     1167    G2frame.dataFrame.Bind(wx.EVT_MENU, OnLoadMask, id=G2gd.wxID_MASKLOADNOT)
    11631168    G2frame.dataFrame.Bind(wx.EVT_MENU, OnSaveMask, id=G2gd.wxID_MASKSAVE)
    11641169    G2frame.dataFrame.Bind(wx.EVT_MENU, OnNewSpotMask, id=G2gd.wxID_NEWMASKSPOT)
Note: See TracChangeset for help on using the changeset viewer.