Changeset 3161


Ignore:
Timestamp:
Nov 27, 2017 9:17:38 AM (4 years ago)
Author:
vondreele
Message:

convert isinstance(val,int) --> 'int' in striphist(type(val)), etc. in ValidatedTxtCtrl?. The isinstance fails in py 3.6 if val is np.int, etc.
reformat min/max sliders in Image & Mask GUI; put the Auto scale on it's own line so it is more easily found
fix bug in integration that dropped azimuth from inst parms.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r3157 r3161  
    734734                    polariz = 0.99
    735735        if 'PWDR' in Aname:
    736             parms = ['PXC',data['wavelength'],0.0,polariz,1.0,-0.10,0.4,0.30,1.0,0.0001,Azms[i]]
     736            parms = ['PXC',data['wavelength'],0.0,polariz,1.0,-0.10,0.4,0.30,1.0,0.0,0.0001,Azms[i]]
    737737        elif 'SASD' in Aname:
    738738            Sample['Trans'] = data['SampleAbs'][0]
  • trunk/GSASIIctrlGUI.py

    r3151 r3161  
    419419        else:
    420420            kw['style'] = wx.TE_PROCESS_ENTER
    421         if isinstance(val,int) or typeHint is int:
     421        if 'int' in str(type(val)) or typeHint is int:
    422422            self.type = int
    423423            wx.TextCtrl.__init__(self,parent,wx.ID_ANY,
     
    430430                self._IndicateValidity()
    431431
    432         elif isinstance(val,float) or typeHint is float:
     432        elif 'float' in str(type(val)) or typeHint is float:
    433433            self.type = float
    434434            wx.TextCtrl.__init__(self,parent,wx.ID_ANY,
  • trunk/GSASIIimgGUI.py

    r3158 r3161  
    712712        #   (Imin0, Imax0) => Range[0] = data['range'][0] # lowest to highest pixel intensity
    713713        #   [Imin, Imax] => Range[1] = data['range'][1] #   lowest to highest pixel intensity on cmap scale
    714         maxSizer = wx.GridBagSizer(0,0)
    715         r = c = 0
    716         maxSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label=' Max intensity'),(r,c))
    717         c += 1
     714        maxSizer = wx.BoxSizer(wx.VERTICAL)
     715        slideSizer = wx.FlexGridSizer(2,3,5,5)
     716        slideSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label=' Max intensity'),0,WACV)
    718717        # maxSel is a slider with 101 steps scaled from Imin+1 to Imax0 with sqrt scaling
    719718        # slider value = sv = 100 * sqrt((Imax-Imin-1)/(Imax0-Imin-1))
     
    722721        sqrtDeltOne  = math.sqrt(max(1.0,Range[1][1]-max(0.0,Range[1][0])-1)) # sqrt(Imax-Imin-1)
    723722        sv1 = min(100,max(0,int(0.5+100.*sqrtDeltOne/sqrtDeltZero)))
    724         maxSel = wx.Slider(parent=G2frame.dataWindow,style=wx.SL_HORIZONTAL,value=sv1,size=(300,-1))
    725         maxSizer.Add(maxSel,(r,c),flag=wx.EXPAND)
    726         maxSizer.AddGrowableCol(c)
    727         c += 1
     723        maxSel = wx.Slider(parent=G2frame.dataWindow,style=wx.SL_HORIZONTAL,value=sv1)
     724        slideSizer.AddGrowableCol(2)
    728725        maxSel.Bind(wx.EVT_SLIDER, OnMaxSlider)
    729726        maxVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,Range[1],1,min=Range[0][0]+1,
     727            max=Range[0][1],OnLeave=OnNewVal)
     728        slideSizer.Add(maxVal,0,WACV)
     729        slideSizer.Add(maxSel,flag=wx.EXPAND|wx.ALL)
     730        slideSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label=' Min intensity'),0,WACV)
     731        # minSel is a slider with 101 steps scaled from Imin0 to Imax-1 with linear scaling
     732        # slider value = sv0 = 100 * (Imin-Imin0)/(Imax-Imin0-1)
     733        # Imin = sv0 * (Imax-Imin0-1) / 100 + Imin0
     734        DeltOne  = max(1.0,Range[1][1]-max(0.0,Range[0][0])-1) # Imax-Imin0-1
     735        sv0 = min(100,max(0,int(0.5+100.*(Range[1][0]-Range[0][0])/DeltOne)))
     736        minSel = wx.Slider(parent=G2frame.dataWindow,style=wx.SL_HORIZONTAL,value=sv0)
     737        minSel.Bind(wx.EVT_SLIDER, OnMinSlider)
     738        minVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,Range[1],0,
    730739            max=Range[0][1],typeHint=int,OnLeave=OnNewVal)
    731         maxSizer.Add(maxVal,(r,c))
    732         c += 1
     740        slideSizer.Add(minVal,0,WACV)
     741        slideSizer.Add(minSel,flag=wx.EXPAND|wx.ALL)
     742        maxSizer.Add(slideSizer,flag=wx.EXPAND|wx.ALL)
     743        autoSizer = wx.BoxSizer(wx.HORIZONTAL)
     744        autoSizer.Add(wx.StaticText(G2frame.dataWindow,label=' Auto scaler '),0,WACV)
    733745        scaleChoices = ("100%","99%","95%","90%","80%","?")
    734746        scaleSel = wx.Choice(G2frame.dataWindow,choices=scaleChoices,size=(-1,-1))
     
    739751            scaleSel.SetSelection(len(scaleChoices)-1)
    740752        scaleSel.Bind(wx.EVT_CHOICE,OnAutoSet)
    741         maxSizer.Add(scaleSel,(r,c),(2,1),flag=wx.ALIGN_CENTER)
    742         c = 0
    743         r = 1
    744         maxSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label=' Min intensity'),(r,c))
    745         c += 1
    746         # minSel is a slider with 101 steps scaled from Imin0 to Imax-1 with linear scaling
    747         # slider value = sv0 = 100 * (Imin-Imin0)/(Imax-Imin0-1)
    748         # Imin = sv0 * (Imax-Imin0-1) / 100 + Imin0
    749         DeltOne  = max(1.0,Range[1][1]-max(0.0,Range[0][0])-1) # Imax-Imin0-1
    750         sv0 = min(100,max(0,int(0.5+100.*(Range[1][0]-Range[0][0])/DeltOne)))
    751         minSel = wx.Slider(parent=G2frame.dataWindow,style=wx.SL_HORIZONTAL,value=sv0,size=(300,-1))
    752         maxSizer.Add(minSel,(r,c),flag=wx.EXPAND|wx.ALL)
    753         c += 1
    754         minSel.Bind(wx.EVT_SLIDER, OnMinSlider)
    755         minVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,Range[1],0,
    756             max=Range[0][1],typeHint=int,OnLeave=OnNewVal)
    757         maxSizer.Add(minVal,(r,c))
     753        autoSizer.Add(scaleSel,0,WACV)
     754        maxSizer.Add(autoSizer)
    758755        return maxSizer
    759756       
     
    10391036            typeHint=float,OnLeave=OnMult)
    10401037        backSizer.Add(backMult,0,WACV)
     1038        backSizer.Add((5,5),0)
     1039        backSizer.Add((5,5),0)
    10411040        backSizer.Add(wx.StaticText(G2frame.dataWindow,-1,' Gain map'),0,WACV)
    10421041        gainMap = wx.ComboBox(parent=G2frame.dataWindow,value=data['Gain map'],choices=Choices,
     
    15411540        scaleSel.Bind(wx.EVT_CHOICE,OnAutoSet)
    15421541       
    1543         maxSizer = wx.GridBagSizer(0,0)
    1544         r = c = 0
    1545         maxSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label=' Max intensity'),(r,c))
    1546         c += 1
     1542        maxSizer = wx.BoxSizer(wx.VERTICAL)
     1543        slideSizer = wx.FlexGridSizer(2,3,5,5)
     1544        slideSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label=' Max intensity'),0,WACV)
    15471545        # maxSel is a slider with 101 steps scaled from Imin+1 to Imax0 with sqrt scaling
    15481546        # slider value = sv = 100 * sqrt((Imax-Imin-1)/(Imax0-Imin-1))
     
    15511549        sqrtDeltOne  = math.sqrt(max(1.0,Range[1][1]-max(0.0,Range[1][0])-1)) # sqrt(Imax-Imin-1)
    15521550        sv1 = min(100,max(0,int(0.5+100.*sqrtDeltOne/sqrtDeltZero)))
    1553         maxSel = wx.Slider(parent=G2frame.dataWindow,style=wx.SL_HORIZONTAL,value=sv1,size=(300,-1))
    1554         maxSizer.Add(maxSel,(r,c),flag=wx.EXPAND)
    1555         maxSizer.AddGrowableCol(c)
    1556         c += 1
     1551        maxSel = wx.Slider(parent=G2frame.dataWindow,style=wx.SL_HORIZONTAL,value=sv1)
     1552        slideSizer.Add(maxSel,flag=wx.EXPAND|wx.ALL)
     1553        slideSizer.AddGrowableCol(1)
    15571554        maxSel.Bind(wx.EVT_SLIDER, OnMaxSlider)
    15581555        maxVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,Range[1],1,min=Range[0][0]+1,
    1559             max=Range[0][1],typeHint=int,OnLeave=OnNewVal)
    1560         maxSizer.Add(maxVal,(r,c))
    1561         c += 1
    1562         maxSizer.Add(scaleSel,(r,c),(2,1),flag=wx.ALIGN_CENTER)
    1563         c = 0
    1564         r = 1
    1565         maxSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label=' Min intensity'),(r,c))
    1566         c += 1
     1556            max=Range[0][1],OnLeave=OnNewVal)
     1557        slideSizer.Add(maxVal,0,WACV)
     1558        slideSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label=' Min intensity'),0,WACV)
    15671559        # minSel is a slider with 101 steps scaled from Imin0 to Imax-1 with linear scaling
    15681560        # slider value = sv0 = 100 * (Imin-Imin0)/(Imax-Imin0-1)
     
    15701562        DeltOne  = max(1.0,Range[1][1]-max(0.0,Range[0][0])-1) # Imax-Imin0-1
    15711563        sv0 = min(100,max(0,int(0.5+100.*(Range[1][0]-Range[0][0])/DeltOne)))
    1572         minSel = wx.Slider(parent=G2frame.dataWindow,style=wx.SL_HORIZONTAL,value=sv0,size=(300,-1))
    1573         maxSizer.Add(minSel,(r,c),flag=wx.EXPAND|wx.ALL)
    1574         c += 1
     1564        minSel = wx.Slider(parent=G2frame.dataWindow,style=wx.SL_HORIZONTAL,value=sv0)
     1565        slideSizer.Add(minSel,flag=wx.EXPAND|wx.ALL)
    15751566        minSel.Bind(wx.EVT_SLIDER, OnMinSlider)
    15761567        minVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,Range[1],0,
    15771568            max=Range[0][1],typeHint=int,OnLeave=OnNewVal)
    1578         maxSizer.Add(minVal,(r,c))
     1569        slideSizer.Add(minVal,0,WACV)
     1570        maxSizer.Add(slideSizer,flag=wx.EXPAND|wx.ALL)
     1571        autoSizer = wx.BoxSizer(wx.HORIZONTAL)
     1572        autoSizer.Add(wx.StaticText(G2frame.dataWindow,label=' Auto scaler '),0,WACV)
     1573        scaleChoices = ("100%","99%","95%","90%","80%","?")
     1574        scaleSel = wx.Choice(G2frame.dataWindow,choices=scaleChoices,size=(-1,-1))
     1575        if (Range[1][0] == Range[0][0] and
     1576            Range[1][1] == Range[0][1]):
     1577            scaleSel.SetSelection(0)
     1578        else:
     1579            scaleSel.SetSelection(len(scaleChoices)-1)
     1580        scaleSel.Bind(wx.EVT_CHOICE,OnAutoSet)
     1581        autoSizer.Add(scaleSel,0,WACV)
     1582        maxSizer.Add(autoSizer)
    15791583        return maxSizer
    15801584
Note: See TracChangeset for help on using the changeset viewer.