Changeset 5164 for trunk/GSASIIpwdGUI.py


Ignore:
Timestamp:
Jan 28, 2022 8:39:44 AM (6 months ago)
Author:
toby
Message:

some PWD cleanups from Laue Fringe work & fullrmc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwdGUI.py

    r5140 r5164  
    431431    else:
    432432        hLam = 0
    433     sample = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId,'Sample Parameters'))
     433#    sample = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId,'Sample Parameters'))
    434434#    hGeom = sample.get('Type')
    435435    hstName = G2frame.GPXtree.GetItemText(G2frame.PatternId)
     
    440440        name = G2frame.GPXtree.GetItemText(item)
    441441        if name.startswith(hPrefix) and name != hstName:
    442             cGeom,cType,cLam, = '?','?',-1
     442            cType,cLam, = '?',-1
    443443            subitem, subcookie = G2frame.GPXtree.GetFirstChild(item)
    444444            while subitem:
    445445                subname = G2frame.GPXtree.GetItemText(subitem)
    446446                if subname == 'Sample Parameters':
    447                     sample = G2frame.GPXtree.GetItemPyData(subitem)
    448 #                    cGeom = sample.get('Type')
     447                    # sample = G2frame.GPXtree.GetItemPyData(subitem)
     448                    # cGeom = sample.get('Type')
     449                    pass
    449450                elif subname == 'Instrument Parameters':
    450451                    inst,inst2 = G2frame.GPXtree.GetItemPyData(subitem)
     
    948949           for c in range(reflGrid.GetNumberCols()):
    949950               if reflGrid.GetColLabelValue(c) in ['position','intensity','alpha','beta','sigma','gamma']:
    950                    if float(reflGrid.GetCellValue(r,c)) < 0.:
    951                        reflGrid.SetCellBackgroundColour(r,c,wx.RED)
    952                    else:
    953                        reflGrid.SetCellBackgroundColour(r,c,wx.WHITE)
    954                                                  
     951                   try:
     952                       if float(reflGrid.GetCellValue(r,c)) < 0.:
     953                           reflGrid.SetCellBackgroundColour(r,c,wx.RED)
     954                       else:
     955                           reflGrid.SetCellBackgroundColour(r,c,wx.WHITE)
     956                   except:
     957                        pass
     958                   
    955959    def KeyEditPeakGrid(event):
    956960        '''Respond to pressing a key to act on selection of a row, column or cell
     
    10841088        'Redraw the peak listings after the mode changes'
    10851089        wx.CallAfter(UpdatePeakGrid,G2frame,data)
     1090#        wx.CallLater(100,RefreshPeakGrid,None)
    10861091
    10871092    def RefreshPeakGrid(event):
     
    10931098       
    10941099    #======================================================================
    1095     # beginning of UpdatePeakGrid init
     1100    #### beginning of UpdatePeakGrid
    10961101    #======================================================================
    10971102#    data['FitPgm'] = data.get('FitPgm',0)
     
    11271132    Inst = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Instrument Parameters'))[0]
    11281133    for i in range(len(data['peaks'])): rowLabels.append(str(i+1))
    1129 #    if data.get('FitPgm',0) == 1:
    1130 #        colLabels = ['position','refine','intensity','refine','cells','refine']
    1131 #        Types = [wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_BOOL,
    1132 #            wg.GRID_VALUE_FLOAT+':10,3',wg.GRID_VALUE_BOOL,
    1133 #            wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_BOOL]
    1134 #        # TODO: note gamma values can still be set as refined
    1135 #    elif 'C' in Inst['Type'][0]:
    1136     if 'C' in Inst['Type'][0]:
    1137         colLabels = ['position','refine','intensity','refine','sigma','refine','gamma','refine']
    1138         Types = [wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_BOOL,
    1139             wg.GRID_VALUE_FLOAT+':10,1',wg.GRID_VALUE_BOOL,
    1140             wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_BOOL,
    1141             wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_BOOL]
    1142     elif 'E' in Inst['Type'][0]:
    1143         colLabels = ['position','refine','intensity','refine','sigma','refine']
    1144         Types = [wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_BOOL,
    1145             wg.GRID_VALUE_FLOAT+':10,1',wg.GRID_VALUE_BOOL,
    1146             wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_BOOL]
    1147     else:
    1148         colLabels = ['position','refine','intensity','refine','alpha','refine',
    1149             'beta','refine','sigma','refine','gamma','refine']
    1150         if 'T' in Inst['Type'][0]:
    1151             Types = [wg.GRID_VALUE_FLOAT+':10,1',wg.GRID_VALUE_BOOL,
    1152                 wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_BOOL,
    1153                 wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_BOOL,
    1154                 wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_BOOL,
    1155                 wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_BOOL,
    1156                 wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_BOOL]
    1157         else:  #'B'
    1158             Types = [wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_BOOL,
    1159                 wg.GRID_VALUE_FLOAT+':10,1',wg.GRID_VALUE_BOOL,
    1160                 wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_BOOL,
    1161                 wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_BOOL,
    1162                 wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_BOOL,
    1163                 wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_BOOL]
     1134    colLabels = []
     1135    Types = []
     1136    for _,f,l in zip(*G2pwd.getHeaderInfo(
     1137        ('LSQ','LaueFringe')[data.get('FitPgm',0)],Inst['Type'][0])):
     1138        colLabels.append(l)
     1139        colLabels.append('refine')
     1140        Types.append(wg.GRID_VALUE_FLOAT +
     1141                         f.replace('%',':').replace('f','').replace('.',','))
     1142        Types.append(wg.GRID_VALUE_BOOL)
    11641143    T = []
    11651144    for peak in data['peaks']:
     
    11721151    for key in T: X.append(D[key])
    11731152    data['peaks'] = X
     1153    # pad peak table, if needed
     1154    for j in range(len(data['peaks'])):
     1155        for i in range(len(data['peaks'][j]),len(colLabels)):
     1156            if colLabels[i] == 'refine':
     1157                data['peaks'][j].append(False)
     1158            else:
     1159                data['peaks'][j].append(1.0)
    11741160    G2frame.dataWindow.ClearData()
    11751161    mainSizer = wx.BoxSizer(wx.VERTICAL)
Note: See TracChangeset for help on using the changeset viewer.