Changeset 4299 for trunk/GSASIIimgGUI.py


Ignore:
Timestamp:
Feb 13, 2020 9:56:45 AM (3 years ago)
Author:
vondreele
Message:

new spot mask algorithm - it is slow but works

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimgGUI.py

    r4286 r4299  
    2828import matplotlib as mpl
    2929import numpy as np
     30import numpy.ma as ma
    3031import GSASIIpath
    3132GSASIIpath.SetVersionNumber("$Revision$")
     
    16441645            Controls = copy.deepcopy(G2frame.GPXtree.GetItemPyData(
    16451646                G2gd.GetGPXtreeItemId(G2frame,G2frame.Image,'Image Controls')))
    1646             Error = G2img.AutoSpotMasks(G2frame.ImageZ,data,Controls)
     1647            nChans = Controls['outChannels']
     1648            dlg = wx.ProgressDialog("Auto spot masking","Processed 2-theta rings = ",nChans+1,
     1649                style = wx.PD_ELAPSED_TIME|wx.PD_CAN_ABORT)
     1650            Error = G2img.AutoSpotMasks2(G2frame.ImageZ,data,Controls,dlg)
    16471651            if not Error is None:
    16481652                G2frame.ErrorDialog('Auto spot search error',Error)
     
    18421846        maxSizer.Add(autoSizer)
    18431847        return maxSizer
    1844 
     1848   
     1849    def OnDelBtn(event):
     1850        data['SpotMask'] = {'esdMul':2,'spotMask':None}
     1851        wx.CallAfter(UpdateMasks,G2frame,data)
     1852               
     1853   
    18451854    G2frame.dataWindow.ClearData()
    18461855    startScroll = None
     
    18911900    if 'Frames' not in data:
    18921901        data['Frames'] = []
     1902    if 'SpotMask' not in data:
     1903        data['SpotMask'] = {'esdMul':2,'spotMask':None}
    18931904    frame = data['Frames']             #3+ x,y pairs
    18941905    Arcs = data['Arcs']                 #radius, start/end azimuth, thickness
     
    19171928    littleSizer.Add(upperThreshold,0,WACV)
    19181929    mainSizer.Add(littleSizer,0,)
     1930    spotSizer = wx.BoxSizer(wx.HORIZONTAL)
     1931    spotSizer.Add(wx.StaticText(G2frame.dataWindow,label=' Select spot range factor (1-10): '),0,WACV)
     1932    spotSizer.Add(G2G.ValidatedTxtCtrl(G2frame.dataWindow,loc=data['SpotMask'],
     1933        key='esdMul',min=1,max=10,size=(40,25)),0,WACV)
     1934    numPix = 0
     1935    if data['SpotMask']['spotMask'] is not None:
     1936        numPix = np.count_nonzero(data['SpotMask']['spotMask'])
     1937    spotSizer.Add(wx.StaticText(G2frame.dataWindow,label=' Number of pixels in spot mask: %d  '%numPix),0,WACV)
     1938    delbtn = wx.Button(G2frame.dataWindow,label='Clear spot mask')
     1939    delbtn.Bind(wx.EVT_BUTTON,OnDelBtn)
     1940    spotSizer.Add(delbtn,0,WACV)
     1941    mainSizer.Add(spotSizer,0,WACV)
    19191942    if len(Spots):
    19201943        lbl = wx.StaticText(parent=G2frame.dataWindow,label=' Spot masks(on plot LB drag to move, shift-LB drag to resize, RB to delete)')
Note: See TracChangeset for help on using the changeset viewer.