Changeset 362 for trunk/GSASIIgrid.py


Ignore:
Timestamp:
Sep 4, 2011 8:04:31 AM (11 years ago)
Author:
vondreele
Message:

add shift factor to LS controls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r360 r362  
    508508def UpdateControls(self,data):
    509509    #patch
     510    if 'shift factor' not in data:
     511        data['shift factor'] = 1.       
    510512    if 'deriv type' not in data:
    511513        data['deriv type'] = 'analytical'
    512514        data['min dM/M'] = 0.0001
     515        data['shift factor'] = 1.
    513516    #end patch
    514517    '''
     
    524527       
    525528    def OnConvergence(event):
     529        Obj = event.GetObject()
    526530        try:
    527             value = max(1.e-9,min(1.0,float(Cnvrg.GetValue())))
     531            value = max(1.e-9,min(1.0,float(Obj.GetValue())))
    528532        except ValueError:
    529533            value = 0.0001
    530534        data['min dM/M'] = value
    531         Cnvrg.SetValue('%.2g'%(value))
     535        Obj.SetValue('%.2g'%(value))
    532536       
    533537    def OnDerivType(event):
    534         data['deriv type'] = derivSel.GetValue()
     538        Obj = event.GetObject()
     539        data['deriv type'] = Obj.GetValue()
    535540        derivSel.SetValue(data['deriv type'])
     541       
     542    def OnFactor(event):
     543        Obj = event.GetObject()
     544        try:
     545            value = min(max(float(Obj.GetValue()),0.001),100.)
     546        except ValueError:
     547            value = 1.0
     548        data['shift factor'] = value
     549        Obj.SetValue('%.3f'%(value))
    536550       
    537551    if self.dataDisplay:
     
    546560    mainSizer.Add((5,5),0)
    547561    mainSizer.Add(wx.StaticText(self.dataDisplay,label=' Refinement Controls:'),0,wx.ALIGN_CENTER_VERTICAL)
    548     LSSizer = wx.FlexGridSizer(cols=4,vgap=5,hgap=5)
     562    LSSizer = wx.FlexGridSizer(cols=6,vgap=5,hgap=5)
    549563    LSSizer.Add(wx.StaticText(self.dataDisplay,label='Refinement derivatives: '),0,wx.ALIGN_CENTER_VERTICAL)
    550564    Choice=['analytic','numeric']
     
    559573    Cnvrg.Bind(wx.EVT_KILL_FOCUS,OnConvergence)
    560574    LSSizer.Add(Cnvrg,0,wx.ALIGN_CENTER_VERTICAL)
    561    
    562    
     575    LSSizer.Add(wx.StaticText(self.dataDisplay,label=' Initial shift factor: '),0,wx.ALIGN_CENTER_VERTICAL)
     576    Factr = wx.TextCtrl(self.dataDisplay,-1,value='%.3f'%(data['shift factor']),style=wx.TE_PROCESS_ENTER)
     577    Factr.Bind(wx.EVT_TEXT_ENTER,OnFactor)
     578    Factr.Bind(wx.EVT_KILL_FOCUS,OnFactor)
     579    LSSizer.Add(Factr,0,wx.ALIGN_CENTER_VERTICAL)
     580       
    563581    mainSizer.Add(LSSizer)
    564582    mainSizer.Add((5,5),0)
Note: See TracChangeset for help on using the changeset viewer.