Changeset 4032 for trunk/GSASIIimgGUI.py


Ignore:
Timestamp:
Jun 19, 2019 4:13:00 PM (3 years ago)
Author:
vondreele
Message:

fix 'Resolution' in old gpx to 'GridStep?'
fix to bad logical operator in MakeFrameMask?
apply polarization pixel by pixel in integration; then put back on for azm=0 for powder diffraction
remove a wasted busycursor
add Xlines & Ylines to masks to mask whole row/columns of pixels (not quite complete)
make picktype = None for unknown picks ('?' causes crash)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimgGUI.py

    r4031 r4032  
    269269        CleanupMasks(masks)
    270270        sumImg = GetImageZ(G2frame,data)
    271         wx.BeginBusyCursor()
    272         try:
    273             G2frame.Integrate = G2img.ImageIntegrate(sumImg,data,masks,blkSize,useTA=useTA,useMask=useMask)           
    274         finally:
    275             wx.EndBusyCursor()   
     271        G2frame.Integrate = G2img.ImageIntegrate(sumImg,data,masks,blkSize,useTA=useTA,useMask=useMask)           
    276272        G2frame.PauseIntegration = G2frame.Integrate[-1]
    277273        del sumImg  #force cleanup
     
    13631359    before they are used for integration.
    13641360    '''
    1365     for key in ['Points','Rings','Arcs','Polygons']:
     1361    for key in ['Points','Rings','Arcs','Polygons','Xlines','Ylines',]:
    13661362        data[key] = data.get(key,[])
    13671363        l1 = len(data[key])
     
    14441440                filename = os.path.splitext(filename)[0]+'.immask'
    14451441                File = open(filename,'w')
    1446                 keys = ['Points','Rings','Arcs','Polygons','Frames','Thresholds']
     1442                keys = ['Points','Rings','Arcs','Polygons','Xlines','Ylines','Frames','Thresholds']
    14471443                for key in keys:
    14481444                    File.write(key+':'+str(data[key])+'\n')
     
    14971493        'Start a new ring mask'
    14981494        G2frame.MaskKey = 'r'
     1495        G2plt.OnStartMask(G2frame)
     1496       
     1497    def OnNewXlineMask(event):
     1498        'Start a new x-line mask'
     1499        print('x')
     1500        G2frame.MaskKey = 'x'
     1501        G2plt.OnStartMask(G2frame)
     1502       
     1503    def OnNewYlineMask(event):
     1504        'Start a new y-line mask'
     1505        G2frame.MaskKey = 'y'
    14991506        G2plt.OnStartMask(G2frame)
    15001507       
     
    16791686    G2frame.Bind(wx.EVT_MENU, OnNewArcMask, id=G2G.wxID_NEWMASKARC)
    16801687    G2frame.Bind(wx.EVT_MENU, OnNewRingMask, id=G2G.wxID_NEWMASKRING)
     1688    G2frame.Bind(wx.EVT_MENU, OnNewXlineMask, id=G2G.wxID_NEWMASKXLINE)
     1689    G2frame.Bind(wx.EVT_MENU, OnNewYlineMask, id=G2G.wxID_NEWMASKYLINE)
    16811690    G2frame.Bind(wx.EVT_MENU, OnNewPolyMask, id=G2G.wxID_NEWMASKPOLY)
    16821691    G2frame.Bind(wx.EVT_MENU, OnNewFrameMask, id=G2G.wxID_NEWMASKFRAME)
     
    16891698    elif G2frame.MaskKey == 'r':
    16901699        G2frame.GetStatusBar().SetStatusText('Ring mask active - LB pick ring location',1)
     1700    elif G2frame.MaskKey == 'x':
     1701        G2frame.GetStatusBar().SetStatusText('X-line mask active - LB pick x line of pixels',1)
     1702    elif G2frame.MaskKey == 'y':
     1703        G2frame.GetStatusBar().SetStatusText('Y-line mask active - LB pick y line of pixels',1)
    16911704    else:
    1692         G2frame.GetStatusBar().SetStatusText("To add mask: press a,r,s,p or f on 2D image for arc/ring/spot/polygon/frame",1)
     1705        G2frame.GetStatusBar().SetStatusText("To add mask: press a,r,s,x,y,p or f on 2D image for arc/ring/spot/xline/yline/polygon/frame",1)
    16931706    mainSizer = G2frame.dataWindow.GetSizer()
    16941707    mainSizer.Add((5,10),0)
     
    16981711    Rings = data['Rings']               #radius, thickness
    16991712    Polygons = data['Polygons']         #3+ x,y pairs
     1713    if 'Xlines' not in data:            #single rows/columns of bad pixels
     1714        data['Xlines'] = []
     1715        data['Ylines'] = []
     1716    Xlines = data['Xlines']
     1717    Ylines = data['Ylines']
    17001718    if 'Frames' not in data:
    17011719        data['Frames'] = []
     
    17971815                littleSizer.Add(arcDelete,0,WACV)
    17981816        mainSizer.Add(littleSizer,0,)
     1817       
     1818    if Xlines:
     1819        lbl = wx.StaticText(parent=G2frame.dataWindow,label=' X line masks')
     1820        lbl.SetBackgroundColour(wx.Colour(200,200,210))
     1821        mainSizer.Add(lbl,0,wx.EXPAND|wx.ALIGN_CENTER,0)
     1822        littleSizer = wx.FlexGridSizer(0,2,0,5)
     1823        for i in range(len(Xlines)):
     1824            if Xlines[i]:
     1825                littleSizer.Add(wx.StaticText(G2frame.dataWindow,label='at Y-pixel: %d'%(Xlines[i])),0,WACV)
     1826                xlineDelete = G2G.G2LoggedButton(G2frame.dataWindow,label='delete?',
     1827                    locationcode='Delete+Xlines+'+str(i),handler=onDeleteMask)
     1828                littleSizer.Add(xlineDelete,0,WACV)
     1829        mainSizer.Add(littleSizer,0,)
     1830       
     1831    if Ylines:
     1832        lbl = wx.StaticText(parent=G2frame.dataWindow,label=' Y line masks')
     1833        lbl.SetBackgroundColour(wx.Colour(200,200,210))
     1834        mainSizer.Add(lbl,0,wx.EXPAND|wx.ALIGN_CENTER,0)
     1835        littleSizer = wx.FlexGridSizer(0,2,0,5)
     1836        for i in range(len(Ylines)):
     1837            if Ylines[i]:
     1838                littleSizer.Add(wx.StaticText(G2frame.dataWindow,label='at X-pixel: %d'%(Ylines[i])),0,WACV)
     1839                ylineDelete = G2G.G2LoggedButton(G2frame.dataWindow,label='delete?',
     1840                    locationcode='Delete+Ylines+'+str(i),handler=onDeleteMask)
     1841                littleSizer.Add(ylineDelete,0,WACV)
     1842        mainSizer.Add(littleSizer,0,)
     1843       
    17991844    if Polygons:
    18001845        lbl = wx.StaticText(parent=G2frame.dataWindow,
Note: See TracChangeset for help on using the changeset viewer.