- Timestamp:
- Mar 29, 2018 3:52:00 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIIdataGUI.py ¶
r3305 r3326 477 477 item = parent.Append(wx.ID_ANY,'Read Powder Pattern Peaks...','') 478 478 self.Bind(wx.EVT_MENU, self.OnReadPowderPeaks, id=item.GetId()) 479 item = parent.Append(wx.ID_ANY,'Sum powder data','')479 item = parent.Append(wx.ID_ANY,'Sum or Average powder data','') 480 480 self.Bind(wx.EVT_MENU, self.OnPwdrSum, id=item.GetId()) 481 481 item = parent.Append(wx.ID_ANY,'Sum image data','') … … 3031 3031 self.text = text 3032 3032 self.data = data 3033 self.average = False 3033 3034 self.selectData = copy.copy(data[:-1]) 3034 3035 self.selectVals = len(data)*[0.0,] … … 3074 3075 ScaleAll = wx.Button(self.panel,wx.ID_ANY,'Set all above') 3075 3076 ScaleAll.Bind(wx.EVT_BUTTON, self.OnAllScale) 3077 if self.dataType == 'PWDR': 3078 self.Avg = wx.CheckBox(self.panel,label=' Make average?') 3079 self.Avg.Bind(wx.EVT_CHECKBOX,self.OnAve) 3076 3080 self.dataGridSizer.Add(ScaleAll,0,wx.LEFT,10) 3077 self.dataGridSizer.Add( (-1,-1),0,wx.RIGHT,10)3078 self.dataGridSizer.Add(wx.StaticText(self.panel,-1,' Sum result name: '+self.dataType),1,3081 self.dataGridSizer.Add(self.Avg,0,wx.RIGHT,10) 3082 self.dataGridSizer.Add(wx.StaticText(self.panel,-1,' Result name: '+self.dataType),1, 3079 3083 wx.LEFT|wx.ALIGN_CENTER_VERTICAL,1) 3080 3084 self.name = G2G.ValidatedTxtCtrl(self.panel,self.data,-1,size=wx.Size(300,20)) … … 3102 3106 self.panel.Fit() 3103 3107 self.Fit() 3108 3109 def OnAve(self,event): 3110 self.average = self.Avg.GetValue() 3104 3111 3105 3112 def OnFilter(self,event): … … 3176 3183 '\nFound: '+str(x[0])+' '+str(x[-1])+'\nfor '+name) 3177 3184 self.OnCancel(event) 3178 else:3179 for j,yi in enumerate(y):3180 Ysum[j] += scale*yi3181 Vsum[j] += abs(scale)*v[j]3182 3185 else: 3183 3186 Xminmax = [x[0],x[-1]] 3184 3187 Xsum = x 3185 Ysum = scale*y 3186 Vsum = abs(scale*v) 3187 Wsum = 1./np.array(Vsum) 3188 if self.dataType == 'PWDR' and self.average: 3189 Ysum.append(scale*y) 3190 Vsum.append(abs(scale)*v) 3191 else: 3192 try: 3193 Ysum += scale*y 3194 Vsum += abs(scale)*v 3195 except ValueError: 3196 Ysum = scale*y 3197 Vsum = abs(scale)*v 3198 if self.dataType =='PWDR' and self.average: 3199 maYsum = ma.masked_equal(Ysum,0) 3200 Ysum = ma.mean(maYsum,axis=0) 3201 Wsum = 1./np.array(Ysum) 3202 else: 3203 Wsum = 1./Vsum 3188 3204 YCsum = np.zeros(lenX) 3189 3205 YBsum = np.zeros(lenX) … … 3219 3235 3220 3236 def OnPwdrSum(self,event): 3221 'Sum together powder data(?)'3237 'Sum or Average together powder data(?)' 3222 3238 TextList = [] 3223 3239 DataList = [] 3224 3240 Names = [] 3225 3241 Inst = None 3226 Comments = ['Sum equals: \n']3242 Comments = ['Sum/Average equals: \n'] 3227 3243 if self.GPXtree.GetCount(): 3228 3244 item, cookie = self.GPXtree.GetFirstChild(self.root) … … 3237 3253 item, cookie = self.GPXtree.GetNextChild(self.root, cookie) 3238 3254 if len(TextList) < 2: 3239 self.ErrorDialog('Not enough data to sum ','There must be more than one "PWDR" pattern')3255 self.ErrorDialog('Not enough data to sum/average','There must be more than one "PWDR" pattern') 3240 3256 return 3241 TextList.append('default_ sum_name')3242 dlg = self.SumDialog(self,'Sum data','Enter scale for each pattern to be summed','PWDR',TextList,DataList)3257 TextList.append('default_ave_name') 3258 dlg = self.SumDialog(self,'Sum/Average data',' Enter scale for each pattern to be summed/averaged','PWDR',TextList,DataList) 3243 3259 try: 3244 3260 if dlg.ShowModal() == wx.ID_OK: … … 3307 3323 return 3308 3324 TextList.append('default_sum_name') 3309 dlg = self.SumDialog(self,'Sum data',' Enter scale for each image to be summed','IMG',TextList,DataList)3325 dlg = self.SumDialog(self,'Sum data',' Enter scale for each image to be summed','IMG',TextList,DataList) 3310 3326 try: 3311 3327 if dlg.ShowModal() == wx.ID_OK: … … 5749 5765 'average the selected columns from menu command' 5750 5766 cols = sorted(G2frame.dataDisplay.GetSelectedCols()) # ignore selection order 5751 useCol = -np.array(G2frame.SeqTable.GetColValues(0),dtype=bool)5767 useCol = not np.array(G2frame.SeqTable.GetColValues(0),dtype=bool) 5752 5768 if cols: 5753 5769 for col in cols: -
TabularUnified trunk/GSASIIimgGUI.py ¶
r3267 r3326 171 171 if data['DetDepth'] > 0.5: 172 172 data['DetDepth'] /= data['distance'] 173 if 'setdist' not in data: 174 data['setdist'] = data['distance'] 173 175 #end patch 174 176 -
TabularUnified trunk/imports/G2img_SFRM.py ¶
r3325 r3326 61 61 stream = stream.decode('latin-1') 62 62 starter = 'IMG: ' 63 meanwaves = {'Cu':1.54 178,'Ti':2.74963,'Cr':2.29092,'Fe':1.93728,64 'Co':1.7 9021,'Mo':0.71069,'Ag':0.56083}63 meanwaves = {'Cu':1.54051,'Ti':2.74841,'Cr':2.28962,'Fe':1.93597, 64 'Co':1.78892,'Mo':0.70926,'Ag':0.559363} 65 65 imageBeg = stream.find(starter)+4 66 66 head = np.array(list(stream[:imageBeg].split('CFR:')[0]))
Note: See TracChangeset
for help on using the changeset viewer.