Changeset 4680


Ignore:
Timestamp:
Dec 22, 2020 4:09:47 PM (11 months ago)
Author:
toby
Message:

add UTF to config.py; covariance: add reduced Chi2 & help button; wx4.1 warning; RB param labeling

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrlGUI.py

    r4672 r4680  
    56465646            return True
    56475647    import datetime
    5648     fp.write("'''\n")
     5648    fp.write("# -*- coding: utf-8 -*-\n'''\n")
    56495649    fp.write("*config.py: Configuration options*\n----------------------------------\n")
    5650     fp.write("This file created in SelectConfigSetting on {:%d %b %Y %H:%M}\n".
     5650    fp.write("This file created in SelectConfigSetting on {:%d %m %Y %H:%M}\n".
    56515651             format(datetime.datetime.now()))
    56525652    fp.write("'''\n\n")
  • trunk/GSASIIdataGUI.py

    r4671 r4680  
    382382    compatible with older versions of wxpython, we are now testing with
    383383    version 4.0 only. Version 3.0 is pretty similar to 4.0 and should not
    384     have problems.
     384    have problems. wxpython 4.1 seems to create a lot of errors for
     385    conflicting options that will need to be checked up upon.
    385386
    386387* Matplotlib:
     
    407408                                 'matplotlib': ['3.1','3.2']}
    408409'versions of modules that are known to have bugs'
    409 versionDict['tooNewWarn'] = {'matplotlib': '3.3'}
     410versionDict['tooNewWarn'] = {'matplotlib': '3.3', 'wx':'4.1'}
    410411'module versions newer than what we have tested where problems are suspected'
    411412   
     
    51635164            refPlotUpdate = None
    51645165        try:
    5165             OK,Msg = G2stMn.Refine(self.GSASprojectfile,dlg,refPlotUpdate=refPlotUpdate)    #Msg is Rvals dict if Ok=True
     5166            OK,Rvals = G2stMn.Refine(self.GSASprojectfile,dlg,refPlotUpdate=refPlotUpdate)
    51665167        finally:
    51675168            dlg.Update(101.) # forces the Auto_Hide; needed after move w/Win & wx3.0
     
    51695170#            wx.Yield()
    51705171        if OK:
    5171             Rw = Msg['Rwp']
    5172             rtext = 'LS Refinement: Rw = %.3f%%, GOF = %.2f, Nobs = %d, Max delt/sig = %.3f'%(Msg['Rwp'],Msg['GOF'],Msg['Nobs'],Msg['Max shft/sig'])
    5173             lamMax = Msg.get('lamMax',0.001)
     5172            Rw = Rvals['Rwp']
     5173            rtext = 'LS Refinement: Rw = %.3f%%, GOF = %.2f, Nobs = %d, Max delt/sig = %.3f'%(Rvals['Rwp'],Rvals['GOF'],Rvals['Nobs'],Rvals['Max shft/sig'])
     5174            lamMax = Rvals.get('lamMax',0.001)
    51745175            lst = os.path.splitext(os.path.abspath(self.GSASprojectfile))[0]
    51755176            text = 'Detailed results are in ' + lst + '.lst\n'
    5176             if 'GOF0' in Msg and 'GOF' in Msg:
     5177            if 'GOF0' in Rvals and 'GOF' in Rvals:
    51775178                text += '\nReduced Chi^2 before refinement={:.3f} and after={:.3f}\n'.format(
    5178                     Msg['GOF0']**2,Msg['GOF']**2)
    5179             if 'Max shft/sig' in Msg:
    5180                 text += '\nMax shift/sigma={:.3f}\n'.format(Msg['Max shft/sig'])
    5181             if 'msg' in Msg: text += '\n' + Msg['msg'] + '\n'
     5179                    Rvals['GOF0']**2,Rvals['GOF']**2)
     5180            if 'Max shft/sig' in Rvals:
     5181                text += '\nMax shift/sigma={:.3f}\n'.format(Rvals['Max shft/sig'])
     5182            if 'msg' in Rvals: text += '\n' + Rvals['msg'] + '\n'
    51825183            text += '\nLoad new result?'
    51835184            if lamMax >= 10.:
    51845185                text += '\nWARNING: Steepest descents dominates;'+   \
    51855186                ' minimum may not have been reached\nor result may be false minimum.'+  \
    5186                 ' You should reconsider your parameter suite'
     5187                ' You should reconsider which parameters you refine'
    51875188            dlg2 = wx.MessageDialog(self,text,'Refinement results, Rw =%.3f'%(Rw),wx.OK|wx.CANCEL)
    51885189            try:
     
    51945195            finally:
    51955196                dlg2.Destroy()
     5197        elif 'SingVars' in Rvals:
     5198            if 'msg' in Rvals:
     5199                msg = 'Refinement results:\n\n'
     5200                msg += Rvals['msg']
     5201                msg += '\n\n'
     5202            else:
     5203                msg = ''
     5204            if len(Rvals['SingVars']) == 1:
     5205                h = 'This variable appears'
     5206                # that = 'that variable'
     5207            else:
     5208                h = 'These variables appear'
     5209                # that = 'those variables'
     5210            msg += h + ' to cause a singular matrix:\n\t'
     5211            for i,var in enumerate(Rvals['SingVars']):
     5212                if i: msg += ', '
     5213                msg += var
     5214            # msg += '\n\nRefine again with '+that+' frozen?'
     5215            result = wx.ID_NO
     5216            try:
     5217                # dlg = wx.MessageDialog(self, msg,'Refine again?',
     5218                #     wx.YES_NO | wx.ICON_QUESTION)
     5219                dlg = wx.MessageDialog(self, msg,'Note singularities',
     5220                    wx.OK)
     5221                dlg.SetSize((700,300)) # does not resize on Mac
     5222                result = dlg.ShowModal()
     5223            finally:
     5224                dlg.Destroy()
     5225            # if result != wx.ID_YES: return
     5226            # Controls = self.GPXtree.GetItemPyData(GetGPXtreeItemId(self,self.root, 'Controls'))
     5227            # if 'parmFrozen' not in Controls:
     5228            #     Controls['parmFrozen'] = {}
     5229            # if 'FrozenList' not in Controls['parmFrozen']:
     5230            #     Controls['parmFrozen']['FrozenList'] = []
     5231            # Controls['parmFrozen']['FrozenList'] += [
     5232            #     G2obj.G2VarObj(i) for i in Rvals['SingVars']]
     5233            # wx.CallAfter(self.OnRefine,event)
    51965234        else:
    5197             self.ErrorDialog('Refinement error',Msg)
     5235            self.ErrorDialog('Refinement error',Rvals['msg'])
    51985236           
    51995237    def reloadFromGPX(self,rtext=None):
     
    87838821            data = G2frame.GPXtree.GetItemPyData(item)
    87848822            text = ''
     8823            subSizer = wx.BoxSizer(wx.HORIZONTAL)
     8824            subSizer.Add((-1,-1),1,wx.EXPAND)
     8825            if 'Rvals' in data:
     8826                lbl = 'Refinement results'
     8827            else:
     8828                lbl = 'No refinement results'
     8829            subSizer.Add(wx.StaticText(G2frame.dataWindow,label=lbl),0,WACV)
     8830            subSizer.Add((-1,-1),1,wx.EXPAND)
     8831            subSizer.Add(G2G.HelpButton(G2frame.dataWindow,helpIndex='Covariance'))
     8832            G2frame.dataWindow.GetSizer().Add(subSizer,0,wx.EXPAND)
    87858833            if 'Rvals' in data:
    87868834                Nvars = len(data['varyList'])
    87878835                Rvals = data['Rvals']
    8788                 text = ('Residuals after last refinement:\n'+
     8836                text = ('\nResiduals after last refinement:\n'+
    87898837                        '\twR = {:.3f}\n\tchi**2 = {:.1f}\n\tGOF = {:.2f}').format(
    87908838                        Rvals['Rwp'],Rvals['chisq'],Rvals['GOF'])
     
    87948842                if 'lamMax' in Rvals:
    87958843                    text += '\n\tlog10 MaxLambda = {:.1f}'.format(np.log10(Rvals['lamMax']))
     8844                if '2' not in platform.python_version_tuple()[0]: # greek OK in Py2?
     8845                    text += '\n\tReduced χ**2 = {:.2f}'.format(Rvals['GOF']**2)
    87968846                G2frame.dataWindow.GetSizer().Add(
    87978847                    wx.StaticText(G2frame.dataWindow,wx.ID_ANY,text)
    87988848                )
     8849            G2frame.dataWindow.GetSizer().Add((-1,-1),1,wx.EXPAND,1)
    87998850            G2plt.PlotCovariance(G2frame,data)
    88008851        elif G2frame.GPXtree.GetItemText(item) == 'Constraints':
  • trunk/GSASIIobj.py

    r4671 r4680  
    18521852        'DebyeU' : 'Debye model Uiso',
    18531853        'RBV.*' : 'Vector rigid body parameter',
    1854         'RBRO([aijk])' : 'Residue rigid body orientation parameter',
    1855         'RBRP([xyz])' : 'Residue rigid body position parameter',
     1854        'RBRO([aijk])' : 'Residue rigid body orientation parameter \\1',
     1855        'RBRP([xyz])' : 'Residue rigid body \\1 position parameter',
    18561856        'RBRTr;.*' : 'Residue rigid body torsion parameter',
    18571857        'RBR([TLS])([123AB][123AB])' : 'Residue rigid body group disp. param.',
Note: See TracChangeset for help on using the changeset viewer.