Changeset 2620


Ignore:
Timestamp:
Jan 11, 2017 11:20:01 AM (5 years ago)
Author:
vondreele
Message:

allow multipanel Phase data window change G2ctrls - GSNotebook init
put in try/except to catch C++ errors when GSAS-II started via gpx file double click (Windows)
more tweaks of image Auto spot find - now avoids spots in Bragg rings

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrls.py

    r2617 r2620  
    30043004    '''Notebook used in various locations; implemented with wx.aui extension
    30053005    '''
    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)
    30103009        if size: self.SetSize(size)
    30113010        self.parent = parent
  • trunk/GSASIIgrid.py

    r2619 r2620  
    25122512        self.lastSize = [0,0]       
    25132513        self.manualPhaseSize = None
     2514        self.userReSize = False
    25142515        wx.Frame.Bind(self,wx.EVT_SIZE,self.OnReSize)
    2515         self.userReSize = False
    25162516           
    25172517    def OnReSize(self,event):
     
    25192519        '''
    25202520        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
    25222525        if self.userReSize and parent and self.G2frame.PatternTree.GetItemText(parent) == "Phases":
    25232526            self.manualPhaseSize = event.EventObject.GetSize()
     
    25392542        Width = list(Width)
    25402543        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
    25422548        if pid:
    25432549            parent = self.G2frame.PatternTree.GetItemText(pid)
     
    28352841    mainSizer.Layout()   
    28362842    G2frame.dataDisplay.SetSizer(mainSizer)
    2837     #G2frame.dataDisplay.SetSize(mainSizer.Fit(G2frame.dataFrame))
    28382843    G2frame.dataFrame.setSizePosLeft(mainSizer.Fit(G2frame.dataFrame))
    28392844     
     
    40114016    G2frame.dataDisplay.AutoSizeColumns(True)
    40124017    if prevSize:
    4013         #G2frame.dataDisplay.SetSize(prevSize)
    40144018        G2frame.dataFrame.setSizePosLeft(prevSize)
    40154019    else:
  • trunk/GSASIIimage.py

    r2618 r2620  
    2323import polymask as pm
    2424from scipy.optimize import leastsq
     25import scipy.signal as scsg
    2526import copy
    2627import GSASIIpath
     
    11321133    for roll in rolls:
    11331134        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.))
    11351136    mags = spotMask[spotMask.nonzero()]
    11361137    indx = np.transpose(spotMask.nonzero())
     
    11381139    jndx = []
    11391140    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):
    11411142            cent = np.zeros((3,3))
    11421143            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])
    11441145            msk = ma.array(msk,mask=(msk==mag))
    1145             if mag > 1.33*ma.mean(msk):
     1146            if mag > 1.5*ma.mean(msk):
    11461147                jndx.append([ind[1]+.5,ind[0]+.5])
    11471148    print 'Spots found: ',len(jndx)
     
    11491150    peaks = jndx*pixelSize/1000.
    11501151    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)
    11531162    #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
    11611172    Masks['Points'] = list(Points)
    11621173    return None
Note: See TracChangeset for help on using the changeset viewer.