- Timestamp:
- Jul 2, 2017 7:27:09 PM (6 years ago)
- Location:
- branch/2frame
- Files:
-
- 1 added
- 5 edited
- 21 copied
Legend:
- Unmodified
- Added
- Removed
-
branch/2frame/GSASII.py
r2893 r2895 4177 4177 Rw = Msg['Rwp'] 4178 4178 lamMax = Msg.get('lamMax',0.001) 4179 text = 'Load new result?' 4179 lst = os.path.splitext(os.path.abspath(self.GSASprojectfile))[0] 4180 text = u'Detailed results are in '+lst+'.lst\n\nLoad new result?' 4180 4181 if lamMax >= 10.: 4181 4182 text += '\nWARNING: Steepest descents dominates;'+ \ … … 4289 4290 dlg.CenterOnParent() 4290 4291 try: 4291 OK,Msg = G2stMn.SeqRefine(self.GSASprojectfile,dlg ) #Msg is Rvals dict if Ok=True4292 OK,Msg = G2stMn.SeqRefine(self.GSASprojectfile,dlg,G2plt.SequentialPlotPattern,self) #Msg is Rvals dict if Ok=True 4292 4293 finally: 4293 4294 dlg.Update(101.) # forces the Auto_Hide; needed after move w/Win & wx3.0 -
branch/2frame/GSASIIctrls.py
r2890 r2895 2722 2722 else: 2723 2723 return '.' 2724 2725 ################################################################################ 2726 class SGMessageBox(wx.Dialog): 2727 ''' Special version of MessageBox that displays space group & super space group text 2728 in two blocks 2729 ''' 2730 def __init__(self,parent,title,text,table,): 2731 wx.Dialog.__init__(self,parent,wx.ID_ANY,title,pos=wx.DefaultPosition, 2732 style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) 2733 self.text = text 2734 self.table = table 2735 self.panel = wx.Panel(self) 2736 mainSizer = wx.BoxSizer(wx.VERTICAL) 2737 mainSizer.Add((0,10)) 2738 for line in text: 2739 mainSizer.Add(wx.StaticText(self.panel,label=' %s '%(line)),0,WACV) 2740 ncol = self.table[0].count(',')+1 2741 tableSizer = wx.FlexGridSizer(0,2*ncol+3,0,0) 2742 for j,item in enumerate(self.table): 2743 num,flds = item.split(')') 2744 tableSizer.Add(wx.StaticText(self.panel,label=' %s '%(num+')')),0,WACV|wx.ALIGN_LEFT) 2745 flds = flds.replace(' ','').split(',') 2746 for i,fld in enumerate(flds): 2747 if i < ncol-1: 2748 tableSizer.Add(wx.StaticText(self.panel,label='%s, '%(fld)),0,WACV|wx.ALIGN_RIGHT) 2749 else: 2750 tableSizer.Add(wx.StaticText(self.panel,label='%s'%(fld)),0,WACV|wx.ALIGN_RIGHT) 2751 if not j%2: 2752 tableSizer.Add((20,0)) 2753 mainSizer.Add(tableSizer,0,wx.ALIGN_LEFT) 2754 btnsizer = wx.StdDialogButtonSizer() 2755 OKbtn = wx.Button(self.panel, wx.ID_OK) 2756 OKbtn.Bind(wx.EVT_BUTTON, self.OnOk) 2757 OKbtn.SetDefault() 2758 btnsizer.AddButton(OKbtn) 2759 btnsizer.Realize() 2760 mainSizer.Add((0,10)) 2761 mainSizer.Add(btnsizer,0,wx.ALIGN_CENTER) 2762 self.panel.SetSizer(mainSizer) 2763 self.panel.Fit() 2764 self.Fit() 2765 size = self.GetSize() 2766 self.SetSize([size[0]+20,size[1]]) 2767 2768 def Show(self): 2769 '''Use this method after creating the dialog to post it 2770 ''' 2771 self.ShowModal() 2772 return 2773 2774 def OnOk(self,event): 2775 parent = self.GetParent() 2776 parent.Raise() 2777 self.EndModal(wx.ID_OK) 2724 2778 2725 2779 ################################################################################ -
branch/2frame/GSASIIgrid.py
r2893 r2895 176 176 'P->I','I->P','P->F','F->P','H->R','R->H','R->O','O->R','abc*','setting 1->2'] #don't put any new ones after the setting one! 177 177 178 # Should SGMessageBox, SymOpDialog, DisAglDialog be moved?179 180 178 ################################################################################ 181 179 #### GSAS-II class definitions 182 180 ################################################################################ 183 181 184 class SGMessageBox(wx.Dialog): 185 ''' Special version of MessageBox that displays space group & super space group text 186 in two blocks 187 ''' 188 def __init__(self,parent,title,text,table,): 189 wx.Dialog.__init__(self,parent,wx.ID_ANY,title,pos=wx.DefaultPosition, 190 style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) 191 self.text = text 192 self.table = table 193 self.panel = wx.Panel(self) 194 mainSizer = wx.BoxSizer(wx.VERTICAL) 195 mainSizer.Add((0,10)) 196 for line in text: 197 mainSizer.Add(wx.StaticText(self.panel,label=' %s '%(line)),0,WACV) 198 ncol = self.table[0].count(',')+1 199 tableSizer = wx.FlexGridSizer(0,2*ncol+3,0,0) 200 for j,item in enumerate(self.table): 201 num,flds = item.split(')') 202 tableSizer.Add(wx.StaticText(self.panel,label=' %s '%(num+')')),0,WACV|wx.ALIGN_LEFT) 203 flds = flds.replace(' ','').split(',') 204 for i,fld in enumerate(flds): 205 if i < ncol-1: 206 tableSizer.Add(wx.StaticText(self.panel,label='%s, '%(fld)),0,WACV|wx.ALIGN_RIGHT) 207 else: 208 tableSizer.Add(wx.StaticText(self.panel,label='%s'%(fld)),0,WACV|wx.ALIGN_RIGHT) 209 if not j%2: 210 tableSizer.Add((20,0)) 211 mainSizer.Add(tableSizer,0,wx.ALIGN_LEFT) 212 btnsizer = wx.StdDialogButtonSizer() 213 OKbtn = wx.Button(self.panel, wx.ID_OK) 214 OKbtn.Bind(wx.EVT_BUTTON, self.OnOk) 215 OKbtn.SetDefault() 216 btnsizer.AddButton(OKbtn) 217 btnsizer.Realize() 218 mainSizer.Add((0,10)) 219 mainSizer.Add(btnsizer,0,wx.ALIGN_CENTER) 220 self.panel.SetSizer(mainSizer) 221 self.panel.Fit() 222 self.Fit() 223 size = self.GetSize() 224 self.SetSize([size[0]+20,size[1]]) 225 226 def Show(self): 227 '''Use this method after creating the dialog to post it 228 ''' 229 self.ShowModal() 230 return 231 232 def OnOk(self,event): 233 parent = self.GetParent() 234 parent.Raise() 235 self.EndModal(wx.ID_OK) 182 # Should SymOpDialog, DisAglDialog etc. be moved to GSASIIctrls? 236 183 237 184 class SGMagSpinBox(wx.Dialog): … … 581 528 SGTxt.SetValue(self.Phase['General']['SGData']['SpGrp']) 582 529 msg = 'Space Group Information' 583 SGMessageBox(self.panel,msg,text,table).Show()530 G2G.SGMessageBox(self.panel,msg,text,table).Show() 584 531 if self.Phase['General']['Type'] == 'magnetic': 585 532 Nops = len(SGData['SGOps'])*len(SGData['SGCen']) … … 3008 2955 return plotName,G2frame.colList[col],G2frame.colSigs[col] 3009 2956 3010 def PlotSelect(event): 3011 'Plots a row (covariance) or column on double-click' 2957 def PlotSelectedColRow(calltyp=''): 2958 '''Called to plot a selected column or row. This is called after the event is processed 2959 so that the column or row gets selected. 2960 Single click on row: plots histogram 2961 Double click on row: plots V-C matrix 2962 Single or double click on column: plots values in column 2963 ''' 3012 2964 cols = G2frame.dataDisplay.GetSelectedCols() 3013 2965 rows = G2frame.dataDisplay.GetSelectedRows() 3014 2966 if cols: 3015 2967 G2plt.PlotSelectedSequence(G2frame,cols,GetColumnInfo,SelectXaxis) 2968 elif rows and calltyp == 'single': 2969 name = histNames[rows[0]] #only does 1st one selected 2970 if not name.startswith('PWDR'): return 2971 pickId = G2frame.PickId 2972 G2frame.PickId = G2frame.PatternId = GetPatternTreeItemId(G2frame, G2frame.root, name) 2973 G2plt.PlotPatterns(G2frame,newPlot=True,plotType='PWDR') 2974 G2frame.PickId = pickId 3016 2975 elif rows: 3017 2976 name = histNames[rows[0]] #only does 1st one selected … … 3022 2981 'Nothing selected in table. Click on column or row label(s) to plot. N.B. Grid selection can be a bit funky.' 3023 2982 ) 2983 2984 def PlotSSelect(event): 2985 'Called by a single click on a row or column label. ' 2986 event.Skip() 2987 wx.CallAfter(PlotSelectedColRow,'single') 2988 2989 def PlotSelect(event): 2990 'Called by a double-click on a row or column label' 2991 event.Skip() 2992 wx.CallAfter(PlotSelectedColRow,'double') 3024 2993 3025 2994 def OnPlotSelSeq(event): … … 3983 3952 sigwtFrList = [] 3984 3953 for i,name in enumerate(histNames): 3954 if name not in Phases[phase]['Histograms']: 3955 wtFrList.append(None) 3956 sigwtFrList.append(0.0) 3957 continue 3985 3958 wtFrSum = 0. 3986 3959 for phase1 in Phases: 3960 if name not in Phases[phase1]['Histograms']: continue 3987 3961 wtFrSum += Phases[phase1]['Histograms'][name]['Scale'][0]*Phases[phase1]['General']['Mass'] 3988 3962 var = str(Phases[phase]['pId'])+':'+str(i)+':Scale' … … 4141 4115 for r in range(nRows): 4142 4116 G2frame.dataDisplay.SetCellReadOnly(r,c) 4117 G2frame.dataDisplay.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK, PlotSSelect) 4143 4118 G2frame.dataDisplay.Bind(wg.EVT_GRID_LABEL_LEFT_DCLICK, PlotSelect) 4144 4119 G2frame.dataDisplay.Bind(wg.EVT_GRID_LABEL_RIGHT_CLICK, SetLabelString) -
branch/2frame/GSASIIphsGUI.py
r2893 r2895 444 444 used (not recommended when alpha >> 120 or << 60, due to correlation.) 445 445 446 For standard settings of space groups, space group numbers (1-230) can alternately 447 be entered. 448 446 449 GSAS-II will accept non-standard settings of space groups. For example, space 447 450 group "P -1" can be set to include face centering, using symbol "F -1" and "P 1 1 21/a" … … 452 455 ''' 453 456 dlg = G2G.SingleStringDialog(General,'Get Space Group', 454 ' Input the space group with spaces between axial fields \n (e.g. p 21/c, P 63/m m c, P 4/m m m ',457 ' Input the space group with spaces between axial fields \n (e.g. p 21/c, P 63/m m c, P 4/m m m) or enter a space\n group number between 1 and 230.', 455 458 value=generalData['SGData']['SpGrp'],help=helptext) 456 459 if not dlg.Show(): … … 458 461 return 459 462 else: 460 Flds = dlg.GetValue().split() 461 dlg.Destroy() 462 #get rid of extra spaces between fields first 463 for fld in Flds: fld = fld.strip() 464 SpcGp = ' '.join(Flds) 463 try: 464 # has a space group number been input? 465 spcnum = int(dlg.GetValue()) 466 if 1 <= spcnum <= 230: 467 SpcGp = G2spc.spgbyNum[spcnum] 468 else: 469 msg = 'Space Group Error' 470 Style = wx.ICON_EXCLAMATION 471 wx.MessageBox('Invalid space group number',caption=msg,style=Style) 472 return 473 except: 474 #get rid of extra spaces between fields first 475 Flds = dlg.GetValue().split() 476 for fld in Flds: fld = fld.strip() 477 SpcGp = ' '.join(Flds) 478 finally: 479 dlg.Destroy() 465 480 # try a lookup on the user-supplied name 466 481 SpGrpNorm = G2spc.StandardizeSpcName(SpcGp) … … 481 496 SGTxt.SetLabel(generalData['SGData']['SpGrp']) 482 497 msg = 'Space Group Information' 483 G2 gd.SGMessageBox(General,msg,text,table).Show()498 G2G.SGMessageBox(General,msg,text,table).Show() 484 499 if generalData['Type'] == 'magnetic': 485 500 Nops = len(SGData['SGOps'])*len(SGData['SGCen']) … … 884 899 generalData['SuperSg'] = SSymbol 885 900 msg = 'Superspace Group Information' 886 G2 gd.SGMessageBox(General,msg,text,table).Show()901 G2G.SGMessageBox(General,msg,text,table).Show() 887 902 else: 888 903 text = [E+'\nSuperspace Group set to previous'] … … 5708 5723 copyDict[name] = sourceDict[name][1] 5709 5724 elif name in ['Size','Mustrain']: 5710 copyDict[name] = [sourceDict[name][0],sourceDict[name][2],sourceDict[name][ 4]]5725 copyDict[name] = [sourceDict[name][0],sourceDict[name][2],sourceDict[name][5]] 5711 5726 elif name == 'Pref.Ori.': 5712 5727 copyDict[name] = [sourceDict[name][0],sourceDict[name][2]] … … 5749 5764 data['Histograms'][item][name][0] = copy.deepcopy(copyDict[name][0]) 5750 5765 data['Histograms'][item][name][2] = copy.deepcopy(copyDict[name][1]) 5751 data['Histograms'][item][name][ 4] = copy.deepcopy(copyDict[name][2])5766 data['Histograms'][item][name][5] = copy.deepcopy(copyDict[name][2]) 5752 5767 elif name == 'Pref.Ori.': 5753 5768 data['Histograms'][item][name][0] = copy.deepcopy(copyDict[name][0]) -
branch/2frame/GSASIIplot.py
r2891 r2895 1181 1181 ##### PlotPatterns 1182 1182 ################################################################################ 1183 def SequentialPlotPattern(G2frame,refdata,histogram): 1184 '''This is passed into :func:`GSASIIstrMain.SeqRefine` where it is used to 1185 provide a plot of the current powder histogram just after a refinement. It 1186 takes the old refinement information (Rfactors, curve locations, etc.) and 1187 combines it with the refinement results in refdata and passes that to 1188 :func:`PlotPatterns` 1189 ''' 1190 if not histogram.startswith('PWDR'): return 1191 pickId = G2frame.PickId 1192 G2frame.PickId = G2frame.PatternId = G2gd.GetPatternTreeItemId(G2frame, G2frame.root, histogram) 1193 treedata = G2frame.PatternTree.GetItemPyData(G2frame.PatternId) 1194 PlotPatterns(G2frame,newPlot=True,plotType='PWDR',data=[treedata[0],refdata]) 1195 wx.Yield() # force a plot update (needed on Windows?) 1196 G2frame.PickId = pickId 1197 1183 1198 def ReplotPattern(G2frame,newPlot,plotType,PatternName=None,PickName=None): 1184 1199 '''This does the same as PlotPatterns except that it expects the information … … 1196 1211 PlotPatterns(G2frame,newPlot,plotType) 1197 1212 1198 def PlotPatterns(G2frame,newPlot=False,plotType='PWDR' ):1213 def PlotPatterns(G2frame,newPlot=False,plotType='PWDR',data=None): 1199 1214 '''Powder pattern plotting package - displays single or multiple powder patterns as intensity vs 1200 1215 2-theta, q or TOF. Can display multiple patterns as "waterfall plots" or contour plots. Log I … … 1220 1235 return 1221 1236 #patch 1222 data = G2frame.PatternTree.GetItemPyData(G2frame.PatternId) 1237 if data is None: 1238 data = G2frame.PatternTree.GetItemPyData(G2frame.PatternId) 1223 1239 if 'Offset' not in data[0] and plotType in ['PWDR','SASD','REFD']: #plot offset data 1224 1240 Ymax = max(data[1][1]) … … 1824 1840 Page.canvas.mpl_connect('button_press_event',OnPress) 1825 1841 if 'PWDR' in G2frame.PatternTree.GetItemText(G2frame.PickId): 1842 Histograms,Phases = G2frame.GetUsedHistogramsAndPhasesfromTree() 1843 refColors=['b','r','c','g','m','k'] 1844 Page.phaseColors = {p:refColors[i%len(refColors)] for i,p in enumerate(Phases)} 1826 1845 Phases = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId,'Reflection Lists')) 1827 1846 Page.phaseList = sorted(Phases.keys()) # define an order for phases (once!) … … 2215 2234 elif G2frame.PatternTree.GetItemText(PickId) in ['Reflection Lists'] or \ 2216 2235 'PWDR' in G2frame.PatternTree.GetItemText(PickId): 2217 refColors=['b','r','c','g','m','k']2218 2236 Phases = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId,'Reflection Lists')) 2219 2237 l = GSASIIpath.GetConfigValue('Tick_length',8.0) … … 2230 2248 peak = np.array([[peak[4],peak[5]] for peak in peaks]) 2231 2249 pos = Pattern[0]['refOffset']-pId*Pattern[0]['refDelt']*np.ones_like(peak) 2250 plsym = Page.phaseColors.get(phase,'y')+'|' # yellow should never happen! 2232 2251 if G2frame.plotStyle['qPlot']: 2233 Page.tickDict[phase],j = Plot.plot(2*np.pi/peak.T[0],pos, refColors[pId%6]+'|',mew=w,ms=l,picker=3.,label=phase)2252 Page.tickDict[phase],j = Plot.plot(2*np.pi/peak.T[0],pos,plsym,mew=w,ms=l,picker=3.,label=phase) 2234 2253 elif G2frame.plotStyle['dPlot']: 2235 Page.tickDict[phase],j = Plot.plot(peak.T[0],pos, refColors[pId%6]+'|',mew=w,ms=l,picker=3.,label=phase)2254 Page.tickDict[phase],j = Plot.plot(peak.T[0],pos,plsym,mew=w,ms=l,picker=3.,label=phase) 2236 2255 else: 2237 Page.tickDict[phase],j = Plot.plot(peak.T[1],pos, refColors[pId%6]+'|',mew=w,ms=l,picker=3.,label=phase)2256 Page.tickDict[phase],j = Plot.plot(peak.T[1],pos,plsym,mew=w,ms=l,picker=3.,label=phase) 2238 2257 if len(Phases): 2239 2258 handles,legends = Plot.get_legend_handles_labels() #got double entries in the legends for some reason
Note: See TracChangeset
for help on using the changeset viewer.