Changeset 2616
- Timestamp:
- Jan 8, 2017 4:17:15 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIgrid.py
r2614 r2616 2119 2119 self.MaskEdit.Append(help='Load mask from file; ignore threshold', 2120 2120 id=wxID_MASKLOADNOT, kind=wx.ITEM_NORMAL,text='Load mask w/o threshold') 2121 self.MaskEdit.Append(help='Auto search for spot masks ',2121 self.MaskEdit.Append(help='Auto search for spot masks; NB: will clear old spot masks', 2122 2122 id=wxID_FINDSPOTS, kind=wx.ITEM_NORMAL,text='Auto spot masks') 2123 2123 submenu.Append(help='Create an arc mask with mouse input', … … 2129 2129 submenu.Append(help='Create a ring mask with mouse input', 2130 2130 id=wxID_NEWMASKRING, kind=wx.ITEM_NORMAL,text='Ring mask') 2131 submenu.Append(help='Create spot masks with mouse clicks',2131 submenu.Append(help='Create spot masks with mouse input', 2132 2132 id=wxID_NEWMASKSPOT, kind=wx.ITEM_NORMAL,text='Spot mask') 2133 2133 self.PostfillDataMenu() … … 4271 4271 mainSizer.Add(wx.StaticText(G2frame.dataDisplay,-1, 4272 4272 ' Data residual wR: %.3f%% on %d observations'%(data[0]['wR'],data[0]['Nobs']))) 4273 mainSizer.Add(wx.StaticText(G2frame.dataDisplay,-1, 4274 ' Durbin-Watson statistic: %.3f'%(data[0].get('Durbin-Watson',0.)))) 4273 4275 for value in data[0]: 4274 4276 if 'Nref' in value: -
trunk/GSASIIimage.py
r2613 r2616 1132 1132 for roll in rolls: 1133 1133 if np.any(roll): #avoid [0,0] 1134 spotMask = ma.array(spotMask,mask=(spotMask-rollImage(Image,roll)<=0. ))1134 spotMask = ma.array(spotMask,mask=(spotMask-rollImage(Image,roll)<=0.10*np.mean(Image))) 1135 1135 mags = spotMask[spotMask.nonzero()] 1136 1136 indx = np.transpose(spotMask.nonzero()) … … 1146 1146 jndx.append([ind[1]+.5,ind[0]+.5]) 1147 1147 print 'Spots found: ',len(jndx) 1148 if len(jndx) > 100:1149 txt = 'Found: %d. Too many spots found; are rings spotty?'%(len(jndx))1150 return txt1151 1148 jndx = np.array(jndx) 1152 1149 peaks = jndx*pixelSize/1000. 1153 1150 tth = GetTth(peaks.T[0],peaks.T[1],Controls) 1154 1151 Peakarray = np.vstack((tth,peaks.T)).T 1155 Peakarray = np.array(G2mth.sortArray(Peakarray,0)) #now in 2theta order 1152 Peakarray = np.array(G2mth.sortArray(Peakarray,0)) #now in 2theta 1153 if peaks.shape[0] > 100: 1154 txt = 'More than 100 spots found: %d. Are rings spotty?'%(len(jndx)) 1155 return txt 1156 #should be able to filter out spotty Bragg rings here 1156 1157 Points = np.ones((peaks.shape[0],3)) 1157 1158 Points[:,:2] = Peakarray[:,1:] 1158 Masks['Points'] = Points1159 Masks['Points'] = list(Points) 1159 1160 return None 1160 1161 -
trunk/GSASIIimgGUI.py
r2611 r2616 1303 1303 def OnAutoSpotMask(event): 1304 1304 'Do auto search for spot masks' 1305 wx.MessageDialog(G2frame.dataDisplay,'NB: This will clear any old spot masks','Auto Spot Masks', wx.OK).ShowModal() 1305 1306 Controls = copy.deepcopy(G2frame.PatternTree.GetItemPyData( 1306 1307 G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId,'Image Controls'))) 1307 1308 Error = G2img.AutoSpotMasks(G2frame.ImageZ,data,Controls) 1308 1309 if not Error is None: 1309 1310 G2frame.ErrorDialog('Auto spot search error',Error) 1310 1311 wx.CallAfter(UpdateMasks,G2frame,data) 1311 G2plt.PlotExposedImage(G2frame,event=event)1312 wx.CallAfter(G2plt.PlotExposedImage,G2frame,event=event) 1312 1313 1313 1314 def ToggleSpotMaskMode(event): … … 1670 1671 G2frame.dataDisplay.SetSize(Size) 1671 1672 G2frame.dataFrame.setSizePosLeft(Size) 1672 wx.Yield()1673 1673 if startScroll: # reset scroll to saved position 1674 1674 G2frame.dataDisplay.Scroll(0,startScroll) # set to saved scroll position -
trunk/GSASIIplot.py
r2615 r2616 4349 4349 def OnImPick(event): 4350 4350 'A object has been picked' 4351 4351 4352 def OnDragIntBound(event): 4352 4353 'Respond to the dragging of one of the integration boundaries' … … 4375 4376 # compute arcs, etc 4376 4377 LRAzim = Data['LRazimuth'] #NB: integers 4377 Nazm = Data['outAzimuths']4378 delAzm = float(LRAzim[1]-LRAzim[0])/Nazm4379 4378 AzmthOff = Data['azmthOff'] 4380 4379 IOtth = Data['IOtth'] … … 4415 4414 Page.figure.gca().draw_artist(pick) 4416 4415 Page.canvas.blit(Page.figure.gca().bbox) 4416 4417 4417 def OnDragMask(event): 4418 4418 'Respond to the dragging of a mask' … … 4423 4423 Xpos,Ypos = [event.xdata,event.ydata] 4424 4424 #if Page.toolbar._active: return # zoom/pan selected 4425 itemPicked = str(G2frame.itemPicked)4426 4425 Page.canvas.restore_region(savedplot) 4427 4426 try: … … 4578 4577 print('picktype {} should not happen!'.format(pickType)) 4579 4578 GSASIIpath.IPyBreak() 4580 saveLinestyle = [p.get_linestyle() for p in pl] 4581 for p in pl: p.set_linestyle('dotted') # set line as dotted 4582 Page.canvas.draw() # refresh without dotted line & save bitmap 4583 savedplot = Page.canvas.copy_from_bbox(Page.figure.gca().bbox) 4584 G2frame.cid = Page.canvas.mpl_connect('motion_notify_event', OnDragMask) 4585 for p,s in zip(pl,saveLinestyle): p.set_linestyle(s) # set back to original 4579 if event.mouseevent.button == 3: 4580 if pickType == 'Spot': 4581 print 'delete',pick.center 4582 del Masks['Points'][pick.itemNumber] 4583 4584 Page.canvas.draw() # refresh without dotted line & save bitmap 4585 else: 4586 saveLinestyle = [p.get_linestyle() for p in pl] 4587 for p in pl: p.set_linestyle('dotted') # set line as dotted 4588 Page.canvas.draw() # refresh without dotted line & save bitmap 4589 savedplot = Page.canvas.copy_from_bbox(Page.figure.gca().bbox) 4590 G2frame.cid = Page.canvas.mpl_connect('motion_notify_event', OnDragMask) 4591 for p,s in zip(pl,saveLinestyle): p.set_linestyle(s) # set back to original 4586 4592 4587 4593 def OnImRelease(event): … … 4779 4785 G2frame.Razim.SetValue(Data['LRazimuth'][1]) 4780 4786 elif pickType == "Spot" and treeItem == 'Masks': 4781 # update the selected circle mask with the last drawn values 4782 spotnum = G2frame.itemPicked.itemNumber 4783 Masks['Points'][spotnum] = list(G2frame.itemPicked.center) + [ 4784 2.*G2frame.itemPicked.radius] 4787 if event.button == 3: 4788 # update the selected circle mask with the last drawn values 4789 spotnum = G2frame.itemPicked.itemNumber 4790 Masks['Points'][spotnum] = list(G2frame.itemPicked.center) + [ 4791 2.*G2frame.itemPicked.radius] 4785 4792 G2imG.UpdateMasks(G2frame,Masks) 4786 4793 elif pickType.startswith('Ring') and treeItem == 'Masks': … … 5192 5199 atomData = data['Atoms'] 5193 5200 mapPeaks = [] 5194 vdWRadii = generalData['vdWRadii']5195 5201 if generalData.get('DisAglCtrls',{}): 5196 5202 BondRadii = generalData['DisAglCtrls']['BondRadii'] -
trunk/GSASIIstrIO.py
r2589 r2616 2748 2748 print >>pFile,' Final refinement RF, RF^2 = %.2f%%, %.2f%% on %d reflections' \ 2749 2749 %(Histogram['Residuals'][pfx+'Rf'],Histogram['Residuals'][pfx+'Rf^2'],Histogram['Residuals'][pfx+'Nref']) 2750 print >>pFile,' Durbin-Watson statistic = %.3f'%(Histogram['Residuals']['Durbin-Watson']) 2750 2751 print >>pFile,' Bragg intensity sum = %.3g'%(Histogram['Residuals'][pfx+'sumInt']) 2751 2752 -
trunk/GSASIIstrMath.py
r2598 r2616 3757 3757 yd[xB:xF] = y[xB:xF]-yc[xB:xF] 3758 3758 W = wtFactor*w 3759 wdy = -ma.sqrt(W[xB:xF])*(yd[xB:xF]) 3759 wdy = -ma.sqrt(w[xB:xF])*(yd[xB:xF]) 3760 Histogram['Residuals']['Durbin-Watson'] = ma.sum(ma.diff(wdy)**2)/ma.sum(wdy**2) 3761 wdy *= wtFactor 3760 3762 Histogram['Residuals']['Nobs'] = ma.count(x[xB:xF]) 3761 3763 Nobs += Histogram['Residuals']['Nobs']
Note: See TracChangeset
for help on using the changeset viewer.