Changeset 2620
- Timestamp:
- Jan 11, 2017 11:20:01 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIctrls.py
r2617 r2620 3004 3004 '''Notebook used in various locations; implemented with wx.aui extension 3005 3005 ''' 3006 def __init__(self, parent, name='',size = None): 3007 wx.aui.AuiNotebook.__init__(self, parent, -1, 3008 style=wx.aui.AUI_NB_TOP | 3009 wx.aui.AUI_NB_SCROLL_BUTTONS) 3006 def __init__(self, parent, name='',size = None,style=wx.aui.AUI_NB_TOP | 3007 wx.aui.AUI_NB_SCROLL_BUTTONS): 3008 wx.aui.AuiNotebook.__init__(self, parent, style=style) 3010 3009 if size: self.SetSize(size) 3011 3010 self.parent = parent -
trunk/GSASIIgrid.py
r2619 r2620 2512 2512 self.lastSize = [0,0] 2513 2513 self.manualPhaseSize = None 2514 self.userReSize = False 2514 2515 wx.Frame.Bind(self,wx.EVT_SIZE,self.OnReSize) 2515 self.userReSize = False2516 2516 2517 2517 def OnReSize(self,event): … … 2519 2519 ''' 2520 2520 id = self.G2frame.PatternTree.GetSelection() 2521 parent = self.G2frame.PatternTree.GetItemParent(id) 2521 try: 2522 parent = self.G2frame.PatternTree.GetItemParent(id) 2523 except: #avoid bad tree item on start via gpx file selection 2524 parent = 0 2522 2525 if self.userReSize and parent and self.G2frame.PatternTree.GetItemText(parent) == "Phases": 2523 2526 self.manualPhaseSize = event.EventObject.GetSize() … … 2539 2542 Width = list(Width) 2540 2543 id = self.G2frame.PatternTree.GetSelection() 2541 pid = self.G2frame.PatternTree.GetItemParent(id) 2544 try: #avoid bad tree item on start via gpx file selection 2545 pid = self.G2frame.PatternTree.GetItemParent(id) 2546 except: 2547 pid = 0 2542 2548 if pid: 2543 2549 parent = self.G2frame.PatternTree.GetItemText(pid) … … 2835 2841 mainSizer.Layout() 2836 2842 G2frame.dataDisplay.SetSizer(mainSizer) 2837 #G2frame.dataDisplay.SetSize(mainSizer.Fit(G2frame.dataFrame))2838 2843 G2frame.dataFrame.setSizePosLeft(mainSizer.Fit(G2frame.dataFrame)) 2839 2844 … … 4011 4016 G2frame.dataDisplay.AutoSizeColumns(True) 4012 4017 if prevSize: 4013 #G2frame.dataDisplay.SetSize(prevSize)4014 4018 G2frame.dataFrame.setSizePosLeft(prevSize) 4015 4019 else: -
trunk/GSASIIimage.py
r2618 r2620 23 23 import polymask as pm 24 24 from scipy.optimize import leastsq 25 import scipy.signal as scsg 25 26 import copy 26 27 import GSASIIpath … … 1132 1133 for roll in rolls: 1133 1134 if np.any(roll): #avoid [0,0] 1134 spotMask = ma.array(spotMask,mask=(spotMask-rollImage(Image,roll)< =0.10*np.mean(Image)))1135 spotMask = ma.array(spotMask,mask=(spotMask-rollImage(Image,roll)<0.)) 1135 1136 mags = spotMask[spotMask.nonzero()] 1136 1137 indx = np.transpose(spotMask.nonzero()) … … 1138 1139 jndx = [] 1139 1140 for [ind,mag] in zip(indx,mags): 1140 if ( 0 < ind[0] < nx-1) and (0 < ind[1] < ny-1):1141 if (1 < ind[0] < nx-2) and (1 < ind[1] < ny-2): 1141 1142 cent = np.zeros((3,3)) 1142 1143 cent[1,1] = mag 1143 msk = np.array(Image[ind[0]- 1:ind[0]+2,ind[1]-1:ind[1]+2])1144 msk = np.array(Image[ind[0]-2:ind[0]+3,ind[1]-2:ind[1]+3]) 1144 1145 msk = ma.array(msk,mask=(msk==mag)) 1145 if mag > 1. 33*ma.mean(msk):1146 if mag > 1.5*ma.mean(msk): 1146 1147 jndx.append([ind[1]+.5,ind[0]+.5]) 1147 1148 print 'Spots found: ',len(jndx) … … 1149 1150 peaks = jndx*pixelSize/1000. 1150 1151 tth = GetTth(peaks.T[0],peaks.T[1],Controls) 1151 histtth,bins = np.histogram(tth,2500) 1152 1152 histth,bins = np.histogram(tth,2500) 1153 for shft in [-1,1]: 1154 histmsk = ma.array(histth,mask=-(histth-np.roll(histth,shft)<2.)) 1155 histmsk = ma.array(histmsk,mask=(histmsk>5)) 1156 binmsk = np.array(ma.nonzero(histmsk)) 1157 digts = np.digitize(tth,bins)-1 1158 PeaksList = [] 1159 for digt,peak in zip(digts,peaks): 1160 if digt in binmsk: 1161 PeaksList.append(peak) 1153 1162 #should be able to filter out spotty Bragg rings here 1154 Peakarray = np.vstack((tth,peaks.T)).T 1155 Peakarray = np.array(G2mth.sortArray(Peakarray,0)) #now in 2theta 1156 if peaks.shape[0] > 100: 1157 txt = 'More than 100 spots found: %d. Are rings spotty?'%(len(jndx)) 1158 return txt 1159 Points = np.ones((peaks.shape[0],3)) 1160 Points[:,:2] = Peakarray[:,1:] 1163 PeaksList = np.array(PeaksList) 1164 # Peakarray = np.vstack((tth,peaks.T)).T 1165 # Peakarray = np.array(G2mth.sortArray(Peakarray,0)) #now in 2theta 1166 # if peaks.shape[0] > 100: 1167 # txt = 'More than 100 spots found: %d. Are rings spotty?'%(len(jndx)) 1168 # return txt 1169 Points = np.ones((PeaksList.shape[0],3)) 1170 # Points[:,:2] = Peakarray[:,1:] 1171 Points[:,:2] = PeaksList 1161 1172 Masks['Points'] = list(Points) 1162 1173 return None
Note: See TracChangeset
for help on using the changeset viewer.