Changeset 2175 for trunk/GSASIIgrid.py


Ignore:
Timestamp:
Mar 17, 2016 1:52:26 PM (6 years ago)
Author:
vondreele
Message:

modify DIFFaXDialog - more parameters
add selected are plot as a pylab plot

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r2172 r2175  
    500500        self.panel = wx.Panel(self)         #just a dummy - gets destroyed in Draw!
    501501        self.ctrls = ctrls
     502        self.calcType = 'powder pattern'
     503        self.plane = 'h0l'
     504        self.planeChoice = ['h0l','0kl','hhl','h-hl',]
     505        self.lmax = '2'
     506        self.lmaxChoice = ['1','2','3','4','5',]
     507        self.mult = '2'
     508        self.multChoice = ['1','2','3','4','5','6','7','8','9',]
    502509        self.Draw()
    503510       
    504511    def Draw(self):
    505512       
    506        
     513        def OnCalcType(event):
     514            self.calcType = calcType.GetValue()
     515            self.Draw()
     516           
     517        def OnPlane(event):
     518            self.plane = plane.GetValue()
     519           
     520        def OnMaxL(event):
     521            self.lmax = lmax.GetValue()
     522           
     523        def OnMult(event):
     524            self.mult = mult.GetValue()
    507525       
    508526        self.panel.Destroy()
     
    510528        mainSizer = wx.BoxSizer(wx.VERTICAL)
    511529        mainSizer.Add(wx.StaticText(self.panel,label=' Controls for DIFFaX'),0,WACV)
    512        
    513 
     530        calcChoice = ['powder pattern','selected area']
     531        calcSizer = wx.BoxSizer(wx.HORIZONTAL)
     532        calcSizer.Add(wx.StaticText(self.panel,label=' Select calculation type: '),0,WACV)
     533        calcType = wx.ComboBox(self.panel,value=self.calcType,choices=calcChoice,
     534            style=wx.CB_READONLY|wx.CB_DROPDOWN)
     535        calcType.Bind(wx.EVT_COMBOBOX,OnCalcType)
     536        calcSizer.Add(calcType,0,WACV)
     537        mainSizer.Add(calcSizer)
     538        if 'selected' in self.calcType:
     539            planeSizer = wx.BoxSizer(wx.HORIZONTAL)
     540            planeSizer.Add(wx.StaticText(self.panel,label=' Select plane: '),0,WACV)
     541            plane = wx.ComboBox(self.panel,value=self.plane,choices=self.planeChoice,
     542                style=wx.CB_READONLY|wx.CB_DROPDOWN)
     543            plane.Bind(wx.EVT_COMBOBOX,OnPlane)
     544            planeSizer.Add(plane,0,WACV)
     545            planeSizer.Add(wx.StaticText(self.panel,label=' Max. l index: '),0,WACV)
     546            lmax = wx.ComboBox(self.panel,value=self.lmax,choices=self.lmaxChoice,
     547                style=wx.CB_READONLY|wx.CB_DROPDOWN)
     548            lmax.Bind(wx.EVT_COMBOBOX,OnMaxL)
     549            planeSizer.Add(lmax,0,WACV)           
     550            mainSizer.Add(planeSizer)
     551            multSizer = wx.BoxSizer(wx.HORIZONTAL)
     552            multSizer.Add(wx.StaticText(self.panel,label=' Image scale: '),0,WACV)
     553            mult = wx.ComboBox(self.panel,value=self.mult,choices=self.multChoice,
     554                style=wx.CB_READONLY|wx.CB_DROPDOWN)
     555            mult.Bind(wx.EVT_COMBOBOX,OnMult)
     556            multSizer.Add(mult,0,WACV)
     557            mainSizer.Add(multSizer)
    514558        OkBtn = wx.Button(self.panel,-1,"Ok")
    515559        OkBtn.Bind(wx.EVT_BUTTON, self.OnOk)
     
    529573       
    530574    def GetSelection(self):
    531         return self.ctrls
     575        if 'powder' in self.calcType:
     576            return '0\n0\n3\n',''
     577        elif 'selected' in self.calcType:
     578            return '0\n0\n4\n1\n%d\n%d\n16\n1\n%d\n0\nend\n'%    \
     579                (self.planeChoice.index(self.plane)+1,self.lmaxChoice.index(self.lmax)+1,
     580                self.multChoice.index(self.mult)+1),self.plane
    532581
    533582    def OnOk(self,event):
     
    16901739        self.LayerDataEdit.Append(id=wxID_LOADDIFFAX, kind=wx.ITEM_NORMAL,text='Load from DIFFaX file',
    16911740            help='Load layer info from DIFFaX file')
    1692         self.LayerDataEdit.Append(id=wxID_LAYERSIMULATE, kind=wx.ITEM_NORMAL,text='Simulate PWDR pattern',
    1693             help='Simulate powder pattern from layer stacking')
     1741        self.LayerDataEdit.Append(id=wxID_LAYERSIMULATE, kind=wx.ITEM_NORMAL,text='Simulate pattern',
     1742            help='Simulate diffraction pattern from layer stacking')
    16941743        self.PostfillDataMenu()
    16951744                 
Note: See TracChangeset for help on using the changeset viewer.