Changeset 2551


Ignore:
Timestamp:
Nov 30, 2016 3:17:17 PM (5 years ago)
Author:
vondreele
Message:

clean up G2imageGUI
Add start on autoSpot mask - not complete
some adjustments of window sizes

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIconstrGUI.py

    r2546 r2551  
    18001800        VectorRBDisplay.SetSizer(VectorRBSizer,True)
    18011801        Size = VectorRBSizer.GetMinSize()
    1802         Size[0] += 40
    1803         Size[1] = max(Size[1],450) + 20
     1802#        Size[0] += 40
     1803#        Size[1] = max(Size[1],450) + 20
    18041804        VectorRBDisplay.SetSize(Size)
    18051805        VectorRB.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1)
    18061806        VectorRB.Scroll(0,Scroll)
    1807         Size[1] = min(Size[1],450)
     1807        Size[1] = min(Size[1],500)
    18081808        G2frame.dataFrame.setSizePosLeft(Size)
    18091809       
     
    20852085        ResidueRBDisplay.SetSizer(ResidueRBSizer,True)
    20862086        Size = ResidueRBSizer.GetMinSize()
    2087         Size[0] += 40
    2088         Size[1] = max(Size[1],450) + 20
     2087#        Size[0] += 40
     2088#        Size[1] = max(Size[1],450) + 20
    20892089        ResidueRBDisplay.SetSize(Size)
    20902090        ResidueRB.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1)
    2091         Size[1] = min(600,Size[1])
     2091        Size[1] = min(500,Size[1])
    20922092        G2frame.dataFrame.setSizePosLeft(Size)
    20932093       
  • trunk/GSASIIgrid.py

    r2546 r2551  
    9999
    100100[ wxID_MASKCOPY, wxID_MASKSAVE, wxID_MASKLOAD, wxID_NEWMASKSPOT,wxID_NEWMASKARC,wxID_NEWMASKRING,
    101     wxID_NEWMASKFRAME, wxID_NEWMASKPOLY,  wxID_MASKLOADNOT,
    102 ] = [wx.NewId() for item in range(9)]
     101    wxID_NEWMASKFRAME, wxID_NEWMASKPOLY,  wxID_MASKLOADNOT,wxID_FINDSPOTS,
     102] = [wx.NewId() for item in range(10)]
    103103
    104104[ wxID_STRSTACOPY, wxID_STRSTAFIT, wxID_STRSTASAVE, wxID_STRSTALOAD,wxID_STRSTSAMPLE,
     
    21292129        self.MaskEdit.Append(help='Load mask from file; ignore threshold',
    21302130            id=wxID_MASKLOADNOT, kind=wx.ITEM_NORMAL,text='Load mask w/o threshold')
     2131        self.MaskEdit.Append(help='Auto search for spot masks',
     2132            id=wxID_FINDSPOTS, kind=wx.ITEM_NORMAL,text='Auto spot masks')
    21312133        submenu.Append(help='Create an arc mask with mouse input',
    21322134            id=wxID_NEWMASKARC, kind=wx.ITEM_NORMAL,text='Arc mask')
  • trunk/GSASIIimage.py

    r2546 r2551  
    11221122    return vals,sig
    11231123   
    1124        
     1124def AutoSpotMasks(Image,Masks,Controls):
     1125    rollImage = lambda rho,roll: np.roll(np.roll(rho,roll[0],axis=0),roll[1],axis=1)
     1126    print 'auto spot search'
     1127    spotMask = ma.array(Image,mask=(Image<10.*np.mean(Image)))
     1128    incre = np.array(Image.shape,dtype=np.float)
     1129    indices = (-1,0,1)
     1130    rolls = np.array([[ix,iy] for ix in indices for iy in indices])
     1131    for roll in rolls:
     1132        if np.any(roll):        #avoid [0,0]
     1133            spotMask = ma.array(spotMask,mask=(spotMask-rollImage(Image,roll)<=0.))
     1134    indx = np.transpose(spotMask.nonzero())
     1135    peaks = indx
     1136    mags = spotMask[spotMask.nonzero()]
     1137    print zip(peaks,mags)
     1138   
     1139       
  • trunk/GSASIIimgGUI.py

    r2477 r2551  
    1919import glob
    2020import re
    21 import bisect
    2221import math
    23 import time
    2422import sys
    2523import wx
     
    640638        calibSizer.Add(wx.StaticText(parent=G2frame.dataDisplay,label=' Calibration coefficients'),0,WACV)   
    641639        calibSizer.Add((5,0),0)
    642         cent = data['center']
    643640        Names = ['det-X','det-Y','wave','dist','tilt','phi']
    644641        if 'PWDR' in data['type']:
     
    11501147            try:
    11511148                if dlg.ShowModal() == wx.ID_OK:
    1152                     result = dlg.GetData()
     1149                    result = dlg.GetData()      #?? what was this for?
    11531150                    id, cookie = G2frame.PatternTree.GetFirstChild(G2frame.root)
    11541151                    while id:
     
    13891386            dlg.Destroy()
    13901387           
     1388    def OnAutoSpotMask(event):
     1389        'Do auto search for spot masks'
     1390        Controls = copy.deepcopy(G2frame.PatternTree.GetItemPyData(
     1391            G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId,'Image Controls')))
     1392        G2img.AutoSpotMasks(G2frame.ImageZ,data,Controls)
     1393        event.Skip()
     1394           
    13911395    def OnNewSpotMask(event):
    13921396        'Start a new spot mask'
     
    14251429    G2frame.dataFrame.Bind(wx.EVT_MENU, OnLoadMask, id=G2gd.wxID_MASKLOADNOT)
    14261430    G2frame.dataFrame.Bind(wx.EVT_MENU, OnSaveMask, id=G2gd.wxID_MASKSAVE)
     1431    G2frame.dataFrame.Bind(wx.EVT_MENU, OnAutoSpotMask, id=G2gd.wxID_FINDSPOTS)
    14271432    G2frame.dataFrame.Bind(wx.EVT_MENU, OnNewSpotMask, id=G2gd.wxID_NEWMASKSPOT)
    14281433    G2frame.dataFrame.Bind(wx.EVT_MENU, OnNewArcMask, id=G2gd.wxID_NEWMASKARC)
     
    14311436    G2frame.dataFrame.Bind(wx.EVT_MENU, OnNewFrameMask, id=G2gd.wxID_NEWMASKFRAME)
    14321437    if not G2frame.dataFrame.GetStatusBar():
    1433         Status = G2frame.dataFrame.CreateStatusBar()
     1438        G2frame.dataFrame.CreateStatusBar()
    14341439    if G2frame.MaskKey == 'f':
    14351440        G2frame.dataFrame.GetStatusBar().SetStatusText('Frame mask active - LB pick next point, RB close polygon')
     
    16671672                filename = dlg.GetPath()
    16681673                File = open(filename,'w')
    1669                 save = {}
    16701674                keys = ['Type','Sample phi','Sample z','Sample load']
    16711675                keys2 = ['Dset','Dcalc','pixLimit','cutoff','Emat']
     
    18211825                    continue
    18221826                goodnames.append(name)
    1823                 id = G2gd.GetPatternTreeItemId(G2frame, G2frame.root, name)
    18241827                Npix,imagefile,imagetag = G2frame.PatternTree.GetImageLoc(Id)
    18251828                image = GetImageZ(G2frame,Controls)
     1829                sig = []
     1830                varyList = []
     1831                variables = []
    18261832                if i and CopyForward:
    18271833                    for j,ring in enumerate(StaCtrls['d-zero']):
     
    18321838                parmDict = {'Sample load':StaCtrls['Sample load'],}
    18331839                varyNames = ['e11','e12','e22']
    1834                 sig = []
    1835                 varyList = []
    1836                 variables = []
    18371840                for j,item in enumerate(StaCtrls['d-zero']):
    18381841                    variables += item['Emat']
     
    20372040    G2frame.dataFrame.Bind(wx.EVT_MENU, OnStrStaSample, id=G2gd.wxID_STRSTSAMPLE)       
    20382041    if not G2frame.dataFrame.GetStatusBar():
    2039         Status = G2frame.dataFrame.CreateStatusBar()
     2042        G2frame.dataFrame.CreateStatusBar()
    20402043    if G2frame.StrainKey == 'a':    #probably doesn't happen
    20412044        G2frame.dataFrame.GetStatusBar().SetStatusText('Add strain ring active - LB pick d-zero value')
     
    21122115    type conversions
    21132116    '''
    2114     file_opt = options = {}
    21152117    save = {'filename':imctrl_file}
    21162118    immask_file = os.path.splitext(imctrl_file)[0]+'.immask'
     
    23092311        self.imageBase = G2frame.Image
    23102312
    2311         controlsId = G2frame.PatternTree.GetSelection()
     2313        G2frame.PatternTree.GetSelection()
    23122314        size,imagefile,imagetag = G2frame.PatternTree.GetImageLoc(self.imageBase)       
    23132315        self.imagedir,fileroot = os.path.split(imagefile)
     
    27092711        x = np.array([float(i) for i in parms[0]])
    27102712        closest = abs(x-dist).argmin()
    2711         closeX = x[closest]
    27122713        D = {'distance':dist}
    27132714        imctfile = IMfileList[closest]
     
    28452846                try:
    28462847                    float(tmpDict[key][0])
    2847                     parms.append([str(G2py3.FormatSigFigs(val,sigfigs=5)) for val in tmpDict[key]])
     2848                    parms.append([str(G2py3.FormatSigFigs(val1,sigfigs=5)) for val1 in tmpDict[key]])
    28482849                except ValueError:
    28492850                    parms.append(tmpDict[key])
     
    28762877        parms = []
    28772878        for c in range(cols):
    2878             lbl = self.ParmList[c]
    28792879            parms.append([])
    28802880            for r in range(rows):
  • trunk/GSASIIphsGUI.py

    r2550 r2551  
    7474    phasePage.SetSize(Size)
    7575    phasePage.Scroll(0,Scroll)
     76    Size[1] = min(500,Size[1])
    7677    mainFrame.setSizePosLeft(Size)
    7778   
  • trunk/GSASIIplot.py

    r2547 r2551  
    10211021    def SetLights():
    10221022        GL.glEnable(GL.GL_DEPTH_TEST)
    1023         GL.glShadeModel(GL.GL_SMOOTH)
     1023#        GL.glShadeModel(GL.GL_SMOOTH)
    10241024        GL.glEnable(GL.GL_LIGHTING)
    10251025        GL.glEnable(GL.GL_LIGHT0)
    10261026        GL.glLightModeli(GL.GL_LIGHT_MODEL_TWO_SIDE,0)
    1027         GL.glLightfv(GL.GL_LIGHT0,GL.GL_AMBIENT,[1,1,1,.8])
     1027        GL.glLightfv(GL.GL_LIGHT0,GL.GL_AMBIENT,[1,1,1,1])
    10281028        GL.glLightfv(GL.GL_LIGHT0,GL.GL_DIFFUSE,[1,1,1,1])
    10291029       
  • trunk/GSASIItestplot.py

    r1860 r2551  
    3131    'creates a Wx application and a plotting notebook'
    3232    def __init__(self, id = -1):
    33         self.app = wx.PySimpleApp()
     33        self.app = wx.App()
    3434        self.frame = wx.Frame(None,-1,'Plotter', size=wx.Size(600,600),
    3535            style=wx.DEFAULT_FRAME_STYLE ^ wx.CLOSE_BOX)
  • trunk/testDeriv.py

    r2550 r2551  
    147147            mainSizer.Add(delVal,0)
    148148        self.testDerivPanel.SetSizer(mainSizer)   
    149         Size = mainSizer.Fit(self.testDerivPanel)
    150         Size[0] = 800
    151         Size[1] = max(Size[1],290) + 35
     149        Size = mainSizer.GetMinSize()
    152150        self.testDerivPanel.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1)
     151        Size[1] = min(200,Size[1])
    153152        self.testDerivPanel.SetSize(Size)
    154153
Note: See TracChangeset for help on using the changeset viewer.