Changeset 5071
- Timestamp:
- Nov 9, 2021 4:11:31 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIdataGUI.py
r5070 r5071 2704 2704 self.GPXtree.SetItemPyData(self.GPXtree.AppendItem(Id,text='PDF Controls'), 2705 2705 {'G(R)':[valuesdict,rd.pdfdata,HistName],'diffGRname':'','diffMult':1.0,'Rmax':Ymax,'Type':rd.Type, 2706 'dscale':[1.0,False],'Fitrange':[Rmin,Rmax],'qdamp':[0.03,False],'qbroad':[0,False] })2706 'dscale':[1.0,False],'Fitrange':[Rmin,Rmax],'qdamp':[0.03,False],'qbroad':[0,False],'Temp':300.}) 2707 2707 self.GPXtree.SetItemPyData(self.GPXtree.AppendItem(Id,text='PDF Peaks'), 2708 2708 {'Limits':[1.,5.],'Background':[2,[0.,-0.2*np.pi],False],'Peaks':[]}) -
trunk/GSASIIfiles.py
r5008 r5071 1028 1028 qnew = np.arange(fqdata[0][0],fqdata[0][-1],0.005) 1029 1029 nq = qnew.shape[0] 1030 fqfile.write('%20d\n'% nq-1)1030 fqfile.write('%20d\n'%(nq-1)) 1031 1031 fqfile.write(fqfilename+'\n') 1032 1032 fqnew = zip(qnew,fqfxn(qnew)) 1033 for q,fq in fqnew[1:]: 1033 for q,fq in fqnew: 1034 if not q: 1035 continue 1034 1036 fqfile.write("%15.6g %15.6g\n" % (q,fq)) 1035 1037 fqfile.close() … … 1042 1044 rnew = np.arange(grdata[0][0],grdata[0][-1],0.010) 1043 1045 nr = rnew.shape[0] 1044 grfile.write('%20d\n'% nr-1)1046 grfile.write('%20d\n'%(nr-1)) 1045 1047 grfile.write(grfilename+'\n') 1046 1048 grnew = zip(rnew,grfxn(rnew)) 1047 for r,gr in grnew[1:]: 1049 for r,gr in grnew: 1050 if not r: 1051 continue 1048 1052 grfile.write("%15.6g %15.6g\n" % (r,gr)) 1049 1053 grfile.close() -
trunk/GSASIIobj.py
r5067 r5071 3393 3393 'DetType':'Area detector','ObliqCoeff':0.3,'Ruland':0.025,'QScaleLim':Qlimits, 3394 3394 'Lorch':False,'BackRatio':0.0,'Rmax':100.,'noRing':False,'IofQmin':1.0,'Rmin':1.0, 3395 'I(Q)':[],'S(Q)':[],'F(Q)':[],'G(R)':[]} 3395 'I(Q)':[],'S(Q)':[],'F(Q)':[],'G(R)':[], 3396 #items for sequential PDFfit 3397 'Datarange':[0.,30.],'Fitrange':[0.,30.],'qdamp':[0.03,False],'qbroad':[0,False],'Temp':300} 3396 3398 G2frame.GPXtree.SetItemPyData(G2frame.GPXtree.AppendItem(Id,text='PDF Controls'),Data) 3397 3399 G2frame.GPXtree.SetItemPyData(G2frame.GPXtree.AppendItem(Id,text='PDF Peaks'), -
trunk/GSASIIphsGUI.py
r5070 r5071 4923 4923 wx.CallAfter(UpdateRMC) 4924 4924 4925 def OnAddPDF(event):4926 usedList = RMCPdict['seqfiles']4927 PDFdict = dict([item[1:] for item in G2frame.GetFileList('PDF')])4928 PDFnames = [item for item in PDFdict if item not in usedList]4929 dlg = G2G.G2MultiChoiceDialog(G2frame.FRMC,'PDF dataset',4930 'Select G(r) data to use in seq. PDFfit',PDFnames)4931 # style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.OK|wx.CENTRE)4932 if dlg.ShowModal() == wx.ID_OK:4933 PDFuse = dlg.GetSelections()4934 for item in PDFuse:4935 pId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,PDFnames[item])4936 data = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,pId,'PDF Controls'))4937 RMCPdict['seqfiles'].append([PDFnames[item],data])4938 dlg.Destroy()4939 wx.CallAfter(UpdateRMC)4940 4941 4925 Indx = {} 4942 4926 topSizer = wx.BoxSizer(wx.HORIZONTAL) … … 5021 5005 elif G2frame.RMCchoice == 'PDFfit' and RMCPdict['refinement'] == 'sequential': 5022 5006 5007 def OnAddPDF(event): 5008 ''' Add PDF G(r)s while maintanining original sequence 5009 ''' 5010 usedList = RMCPdict['seqfiles'] 5011 PDFlist = [item[1:][0] for item in G2frame.GetFileList('PDF')] 5012 PDFdict = dict([item[1:] for item in G2frame.GetFileList('PDF')]) 5013 PDFnames = [item for item in PDFdict if item not in [itm[0] for itm in usedList]] 5014 dlg = G2G.G2MultiChoiceDialog(G2frame.FRMC,'Add PDF dataset', 5015 'Select G(r) data to use in seq. PDFfit',PDFnames) 5016 if dlg.ShowModal() == wx.ID_OK: 5017 PDFuse = dlg.GetSelections() 5018 for item in PDFuse: 5019 pId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,PDFnames[item]) 5020 data = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,pId,'PDF Controls')) 5021 try: 5022 insrt = PDFlist.index(PDFnames[item])-1 5023 RMCPdict['seqfiles'].insert(insrt+1,[PDFnames[item],data]) 5024 except ValueError: 5025 RMCPdict['seqfiles'].append([PDFnames[item],data]) 5026 dlg.Destroy() 5027 wx.CallAfter(UpdateRMC) 5028 5029 def OnDelPDF(event): 5030 usedList = [item[0] for item in RMCPdict['seqfiles']] 5031 dlg = G2G.G2MultiChoiceDialog(G2frame.FRMC,'Delete PDF dataset', 5032 'Select G(r) data to delete frpm seq. PDFfit',usedList) 5033 if dlg.ShowModal() == wx.ID_OK: 5034 PDFdel = dlg.GetSelections() 5035 PDFdel.reverse() 5036 for item in PDFdel: 5037 del RMCPdict['seqfiles'][item] 5038 dlg.Destroy() 5039 wx.CallAfter(UpdateRMC) 5040 5023 5041 def OnSetColVal(event): 5024 5042 5025 parms = {'Rmin':[0.0,5.0],'Rmax':[5.,30.],'dscale':[0.5,2.0],'qdamp':[0.0,0.5],'qbroad':[0.0,0.1]} 5043 parms = {'Rmin':[0.0,5.0],'Rmax':[5.,30.],'dscale':[0.5,2.0], 5044 'qdamp':[0.0,0.5],'qbroad':[0.0,0.1],'Temp':300} 5026 5045 c = event.GetCol() 5027 5046 if c >= 0: … … 5041 5060 else: 5042 5061 for row in range(seqGrid.GetNumberRows()): RMCPdict['seqfiles'][row][1][varib][1]=False 5043 elif c in [0,1,2,4,6 ]:5062 elif c in [0,1,2,4,6,8]: 5044 5063 seqGrid.ClearSelection() 5045 5064 seqGrid.SelectCol(c,True) … … 5050 5069 if c in [2,4,6]: 5051 5070 for row in range(seqGrid.GetNumberRows()): RMCPdict['seqfiles'][row][1][parm][0] = value 5071 elif c == 8: 5072 for row in range(seqGrid.GetNumberRows()): RMCPdict['seqfiles'][row][1][parm] = value 5052 5073 else: 5053 5074 for row in range(seqGrid.GetNumberRows()): RMCPdict['seqfiles'][row][1]['Fitrange'][c] = value 5054 5075 wx.CallAfter(UpdateRMC) 5076 5077 def OnSetVal(event): 5078 r,c= event.GetRow(),event.GetCol() 5079 if c >= 0: 5080 if c in [3,5,7]: 5081 varib = colLabels[c-1] 5082 RMCPdict['seqfiles'][r][1][varib][1] = bool(seqGrid.GetCellValue(r,c)) 5083 elif c in [0,1,2,4,6,8]: 5084 parm = colLabels[c] 5085 if c in [2,4,6]: 5086 RMCPdict['seqfiles'][r][1][parm][0] = float(seqGrid.GetCellValue(r,c)) 5087 elif c == 8: 5088 RMCPdict['seqfiles'][r][1][parm] = float(seqGrid.GetCellValue(r,c)) 5089 else: 5090 RMCPdict['seqfiles'][r][1]['Fitrange'][c] = float(seqGrid.GetCellValue(r,c)) 5055 5091 5056 5092 if 'seqfiles' not in RMCPdict: … … 5061 5097 addPDF.Bind(wx.EVT_BUTTON,OnAddPDF) 5062 5098 topSizer.Add(addPDF,0,WACV) 5099 delPDF = wx.Button(G2frame.FRMC,label='Delete PDF G(r) data sets') 5100 delPDF.Bind(wx.EVT_BUTTON,OnDelPDF) 5101 topSizer.Add(delPDF,0,WACV) 5063 5102 mainSizer.Add(topSizer) 5064 5103 table = [[item[1]['Fitrange'][0],item[1]['Fitrange'][1], 5065 5104 item[1]['dscale'][0],item[1]['dscale'][1],item[1]['qdamp'][0],item[1]['qdamp'][1], 5066 item[1]['qbroad'][0],item[1]['qbroad'][1], ] for item in RMCPdict['seqfiles']]5067 colLabels = ['Rmin','Rmax','dscale','refine','qdamp','refine','qbroad','refine' ]5105 item[1]['qbroad'][0],item[1]['qbroad'][1],item[1].get('Temp',300.)] for item in RMCPdict['seqfiles']] 5106 colLabels = ['Rmin','Rmax','dscale','refine','qdamp','refine','qbroad','refine','Temp'] 5068 5107 rowLabels = [item[0] for item in RMCPdict['seqfiles']] 5069 5108 Types = [wg.GRID_VALUE_FLOAT+':10,2',wg.GRID_VALUE_FLOAT+':10,2', 5070 5109 wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_BOOL, 5071 5110 wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_BOOL, 5072 wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_BOOL, ]5111 wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_BOOL,wg.GRID_VALUE_FLOAT+':10,2'] 5073 5112 seqTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 5074 5113 seqGrid = G2G.GSGrid(G2frame.FRMC) … … 5076 5115 seqGrid.AutoSizeColumns(True) 5077 5116 seqGrid.Bind(wg.EVT_GRID_LABEL_LEFT_DCLICK, OnSetColVal) 5117 seqGrid.Bind(wg.EVT_GRID_CELL_CHANGED, OnSetVal) 5078 5118 mainSizer.Add(seqGrid) 5079 5119 … … 5976 6016 5977 6017 def AtomSizer(): 5978 return None 6018 6019 def OnSetVal(event): 6020 r,c = event.GetRow(),event.GetCol() 6021 if c > 0: 6022 strval = atmGrid.GetCellValue(r,c).strip() 6023 if strval == '' or '@' in strval: 6024 RMCPdict['AtomConstr'][r][c+1] = strval 6025 else: 6026 print('ERROR - atom constraints must be blank or contain "@"') 6027 6028 atmSizer = wx.BoxSizer(wx.VERTICAL) 6029 atmSizer.Add(wx.StaticText(G2frame.FRMC,label=' Atom Constraints; enter as e.g. "@n" or "0.5-@n"; n>=10')) 6030 6031 table = [item[1:] for item in RMCPdict['AtomConstr']] 6032 colLabels = ['Type','x constraint','y constraint','z constraint','frac constr','Uiso constr'] 6033 rowLabels = [item[0] for item in RMCPdict['AtomConstr']] 6034 Types = 6*[wg.GRID_VALUE_STRING,] 6035 atmTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 6036 atmGrid = G2G.GSGrid(G2frame.FRMC) 6037 atmGrid.SetTable(atmTable, True,useFracEdit=False) 6038 atmGrid.AutoSizeColumns(True) 6039 atmGrid.Bind(wg.EVT_GRID_CELL_CHANGED, OnSetVal) 6040 atmSizer.Add(atmGrid) 6041 return atmSizer 5979 6042 5980 6043 … … 5998 6061 data['RMC']['PDFfit'] = {'files':files,'ReStart':[False,False],'metadata':metadata, 5999 6062 'delta1':[0.,False],'delta2':[0.,False],'spdiameter':[0.,False],'refinement':'normal', 6000 'sratio':[1.,False],'rcut':0.0,'stepcut':0.0,'shape':'sphere','SGData':SGData,'cellref':False, 6063 'sratio':[1.,False],'rcut':0.0,'stepcut':0.0,'shape':'sphere','SGData':SGData,'cellref':False, 6064 'AtomConstr':[], 6001 6065 'Xdata':{'dscale':[1.0,False],'Datarange':[0.,30.],'Fitrange':[0.,30.],'qdamp':[0.03,False],'qbroad':[0,False]}, 6002 6066 'Ndata':{'dscale':[1.0,False],'Datarange':[0.,30.],'Fitrange':[0.,30.],'qdamp':[0.03,False],'qbroad':[0,False]},} … … 6010 6074 if 'cellref' not in RMCPdict: 6011 6075 RMCPdict['cellref'] = False 6076 if 'AtomConstr' not in RMCPdict: 6077 RMCPdict['AtomConstr'] = [] 6012 6078 if 'metadata' not in RMCPdict: 6013 6079 RMCPdict['metadata'] = {'title':'none','date':str(time.ctime()),'temperature':'300K','doping':0} 6014 6080 #end patch 6081 Atoms = data['Atoms'] 6082 cx,ct,cs,ci = G2mth.getAtomPtrs(data) 6083 if not RMCPdict['AtomConstr']: 6084 for atom in Atoms: 6085 RMCPdict['AtomConstr'].append([atom[ct-1],atom[ct],'','','','','']) 6086 6015 6087 mainSizer.Add(wx.StaticText(G2frame.FRMC,label=' Enter metadata items:'),0) 6016 6088 mainSizer.Add(GetMetaSizer(RMCPdict,['title','date','temperature','doping']),0) … … 6033 6105 mainSizer.Add(cellref,0,WACV) 6034 6106 6107 G2G.HorizontalLine(mainSizer,G2frame.FRMC) 6035 6108 mainSizer.Add(wx.StaticText(G2frame.FRMC,label='PDFfit atom parameters:'),0,WACV) 6036 # mainSizer.Add(AtomSizer()) 6037 6109 mainSizer.Add(AtomSizer()) 6110 6111 G2G.HorizontalLine(mainSizer,G2frame.FRMC) 6038 6112 mainSizer.Add(wx.StaticText(G2frame.FRMC,label=' PDFfit phase profile coefficients:'),0,WACV) 6039 6113 mainSizer.Add(PDFParmSizer(),0)
Note: See TracChangeset
for help on using the changeset viewer.