Changeset 4339


Ignore:
Timestamp:
Mar 3, 2020 3:01:43 PM (4 years ago)
Author:
toby
Message:

set svn flags; improve compare F-test & add info & covariance plot

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Absorb.py

    • Property svn:eol-style set to native
    • Property svn:keywords set to Date Author Revision URL Id
    r4197 r4339  
    1212import matplotlib as mpl
    1313import GSASIIpath
    14 GSASIIpath.SetVersionNumber("$Revision: 3765 $")
     14GSASIIpath.SetVersionNumber("$Revision$")
    1515import GSASIIElem as G2elem
    1616import GSASIIElemGUI as G2elemGUI
  • trunk/G2AutoInt.py

    • Property svn:keywords set to Date Author Revision URL Id
    r4335 r4339  
    1717import wx
    1818import GSASIIpath
    19 GSASIIpath.SetVersionNumber("$Revision: $")
     19GSASIIpath.SetVersionNumber("$Revision$")
    2020import GSASIIautoInt as G2imG
    2121import GSASIIfiles as G2fil
  • trunk/G2compare.py

    • Property svn:keywords set to Date Author Revision URL Id
    r4335 r4339  
    33#GSAS-II Data/Model Comparison
    44########### SVN repository information ###################
    5 # $Date: $
    6 # $Author: toby $
    7 # $Revision: $
    8 # $URL: $
    9 # $Id: $
     5# $Date$
     6# $Author$
     7# $Revision$
     8# $URL$
     9# $Id$
    1010########### SVN repository information ###################
    1111'''
     
    1414'''
    1515
    16 #TODO: in OnDataTreeSelChanged want to plot patterns
    17 # Make PWDR unique (use histlist)
    18 # add graphics
    19 # implement project
     16#TODO:
     17# Prince-test next
     18# Make PWDR unique? (use histlist)
     19# more graphics
     20# display more in datawindow
    2021
    2122import sys
     
    4142
    4243import GSASIIpath
    43 GSASIIpath.SetVersionNumber("$Revision: 4154 $")
     44GSASIIpath.SetVersionNumber("$Revision$")
    4445import GSASIIfiles as G2fil
    4546import GSASIIplot as G2plt
     
    132133        wx.Frame.__init__(self, name='dComp', parent=parent,
    133134            size=size,style=wx.DEFAULT_FRAME_STYLE, title='GSAS-II data/model comparison')
     135        # misc vars
     136        self.VcovColor = 'RdYlGn'       
    134137        # plot window
     138        try:
     139            size = GSASIIpath.GetConfigValue('Plot_Size')
     140            if type(size) is tuple:
     141                pass
     142            elif type(size) is str:
     143                size = eval(size)
     144            else:
     145                raise Exception
     146        except:
     147            size = wx.Size(700,600)               
    135148        self.plotFrame = wx.Frame(None,-1,'dComp Plots',size=size,
    136149            style=wx.DEFAULT_FRAME_STYLE ^ wx.CLOSE_BOX)
     
    208221
    209222        self.PWDRfilter = None
     223        for win,var in ((self.plotFrame,'Plot_Pos'),):
     224        #for win,var in ((self,'Main_Pos'),(self.plotFrame,'Plot_Pos')):
     225            try:
     226                pos = GSASIIpath.GetConfigValue(var)
     227                if type(pos) is str: pos = eval(pos)
     228                win.SetPosition(pos)
     229                if GetDisplay(pos) is None: win.Center()
     230            except:
     231                if GSASIIpath.GetConfigValue(var):
     232                    print('Value for config {} {} is invalid'.format(var,GSASIIpath.GetConfigValue(var)))
     233                    win.Center()
    210234        self.SetModeMenu()
    211235       
     
    467491            wx.EndBusyCursor()
    468492        self.GPXtree.Expand(self.root)
    469        
     493
    470494    def OnDataTreeSelChanged(self,event):
     495        def ClearData(self):
     496            '''Initializes the contents of the dataWindow panel
     497            '''
     498            self.Unbind(wx.EVT_SIZE)
     499            self.SetBackgroundColour(wx.Colour(240,240,240))
     500            Sizer = self.GetSizer()
     501            if Sizer:
     502                try:
     503                    Sizer.Clear(True)
     504                except:
     505                    pass
     506        G2frame = self
    471507        item = event.GetItem()
    472         print('selected',item)
     508        #print('selected',item)
     509        if self.getMode() == "Project":
     510            ClearData(G2frame.dataWindow)
     511            data = G2frame.GPXtree.GetItemPyData(item)
     512            if data is None:
     513                self.plotFrame.Show(False)
     514                return
     515            text = ''
     516            if 'Rvals' in data:
     517                Nvars = len(data['varyList'])
     518                Rvals = data['Rvals']
     519                text = ('Residuals after last refinement:\n'+
     520                        '\twR = {:.3f}\n\tchi**2 = {:.1f}\n\tGOF = {:.2f}').format(
     521                        Rvals['Rwp'],Rvals['chisq'],Rvals['GOF'])
     522                text += '\n\tNobs = {}\n\tNvals = {}\n\tSVD zeros = {}'.format(
     523                    Rvals['Nobs'],Nvars,Rvals.get('SVD0',0.))
     524                text += '\n\tmax shift/esd = {:.3f}'.format(Rvals.get('Max shft/sig',0.0))
     525                if 'lamMax' in Rvals:
     526                    text += '\n\tlog10 MaxLambda = {:.1f}'.format(np.log10(Rvals['lamMax']))
     527                G2frame.dataWindow.GetSizer().Add(
     528                    wx.StaticText(G2frame.dataWindow,wx.ID_ANY,text)
     529                )
     530                self.plotFrame.Show(True)
     531                G2plt.PlotCovariance(G2frame,data)
     532        else:
     533            self.plotFrame.Show(False)
     534            ClearData(G2frame.dataWindow)
    473535       
    474536        #print(self.GPXtree._getTreeItemsList(item))
     
    557619            G2G.G2MessageBox(self,'F-test requires same number of observations in each refinement','F-test not valid')
    558620            return
     621        missingVars = []
     622        for var in baseDict['varyList']:
     623            if var not in relxDict['varyList']:
     624                missingVars.append(var)
     625        txt = ''
     626        postmsg = ''
     627        if missingVars:
     628            txt = ('*** Possible invalid use of F-test: '+
     629                'The F-test requires that the constrained model be a subset '+
     630                'of the relaxed model. Review the parameters shown below to '+
     631                'confirm missing var(s) have new names in the relaxed model. '+
     632                '***\n\n')
     633            postmsg = ('\n\nThese parameters are in the constrained '+
     634              'fit and are not in the relaxed fit:\n*  ')
     635            for i,var in enumerate(missingVars):
     636                if i > 0: postmsg += ', '
     637                postmsg += var
     638            postmsg += ('\nThese parameters are in the relaxed fit and not'+
     639                ' in the constrained fit:\n*  ')
     640            i = 0
     641            for var in relxDict['varyList']:
     642                if var not in baseDict['varyList']:
     643                    if i > 0: postmsg += ', '
     644                    i += 1
     645                    postmsg += var
     646        #GSASIIpath.IPyBreak_base()
    559647        prob = RwFtest(baseDict['Rvals']['Nobs'],
    560648                   baseDict['Rvals']['GOF'],len(baseDict['varyList']),
    561649                   relxDict['Rvals']['GOF'],len(relxDict['varyList']))
    562650        fmt = "{} model is \n*  {}\n*  {} variables and Reduced Chi**2 = {:.3f}"
    563         msg = fmt.format('Constrained',self.GPXtree.GetItemText(s0)[:-11],
     651        msg = txt
     652        msg += fmt.format('Constrained',self.GPXtree.GetItemText(s0)[:-11],
    564653                       len(baseDict['varyList']),
    565654                       baseDict['Rvals']['GOF']**2)
     
    575664        else:
    576665            msg += "The constrained model is statistically preferred to the relaxed model."
     666        msg += postmsg
    577667        G2G.G2MessageBox(self,msg,'F-test result')
    578         #GSASIIpath.IPyBreak_base()
    579668   
    580669if __name__ == '__main__':
  • trunk/G2shapes.py

    • Property svn:eol-style set to native
    • Property svn:keywords set to Date Author Revision URL Id
  • trunk/imports/G2img_SFRM.py

    • Property svn:eol-style set to native
    • Property svn:keywords set to Date Author Revision URL Id
    r3333 r4339  
    11# -*- coding: utf-8 -*-
    22########### SVN repository information ###################
    3 # $Date: 2017-12-26 20:18:10 -0600 (Tue, 26 Dec 2017) $
    4 # $Author: toby $
    5 # $Revision: 3207 $
    6 # $URL: https://subversion.xray.aps.anl.gov/pyGSAS/trunk/imports/G2img_CBF.py $
    7 # $Id: G2img_CBF.py 3207 2017-12-27 02:18:10Z toby $
     3# $Date$
     4# $Author$
     5# $Revision$
     6# $URL$
     7# $Id$
    88########### SVN repository information ###################
    99'''
     
    1818import GSASIIpath
    1919import numpy as np
    20 GSASIIpath.SetVersionNumber("$Revision: 3207 $")
     20GSASIIpath.SetVersionNumber("$Revision$")
    2121class SFRM_ReaderClass(G2obj.ImportImage):
    2222    '''Routine to read a Read Bruker Advance image data .sfrm file.
  • trunk/imports/G2pdf_gr.py

    • Property svn:eol-style set to native
    • Property svn:keywords set to Date Author Revision URL Id
    r4192 r4339  
    11# -*- coding: utf-8 -*-
    22########### SVN repository information ###################
    3 # $Date: 2017-03-04 08:34:05 -0600 (Sat, 04 Mar 2017) $
    4 # $Author: vondreele $
    5 # $Revision: 2738 $
    6 # $URL: https://subversion.xray.aps.anl.gov/pyGSAS/trunk/imports/G2sad_xye.py $
    7 # $Id: G2sad_xye.py 2738 2017-03-04 14:34:05Z vondreele $
     3# $Date$
     4# $Author$
     5# $Revision$
     6# $URL$
     7# $Id$
    88########### SVN repository information ###################
    99'''
     
    2121import GSASIIobj as G2obj
    2222import GSASIIpath
    23 GSASIIpath.SetVersionNumber("$Revision: 2738 $")
     23GSASIIpath.SetVersionNumber("$Revision$")
    2424
    2525class txt_PDFReaderClass(G2obj.ImportPDFData):
  • trunk/imports/G2phase_INS.py

    • Property svn:eol-style set to native
    • Property svn:keywords set to Date Author Revision URL Id
    r3455 r4339  
    11# -*- coding: utf-8 -*-
    22########### SVN repository information ###################
    3 # $Date: 2015-04-27 13:22:06 -0500 (Mon, 27 Apr 2015) $
    4 # $Author: vondreele $
    5 # $Revision: 1812 $
    6 # $URL: https://subversion.xray.aps.anl.gov/pyGSAS/trunk/imports/G2phase_GPX.py $
    7 # $Id: G2phase_GPX.py 1812 2015-04-27 18:22:06Z vondreele $
     3# $Date$
     4# $Author$
     5# $Revision$
     6# $URL$
     7# $Id$
    88########### SVN repository information ###################
    99'''
     
    2323import GSASIIlattice as G2lat
    2424import GSASIIpath
    25 GSASIIpath.SetVersionNumber("$Revision: 1812 $")
     25GSASIIpath.SetVersionNumber("$Revision$")
    2626
    2727class PhaseReaderClass(G2obj.ImportPhase):
  • trunk/imports/G2phase_rmc6f.py

    • Property svn:eol-style set to native
    • Property svn:keywords set to Date Author Revision URL Id
    r4208 r4339  
    11# -*- coding: utf-8 -*-
    22########### SVN repository information ###################
    3 # $Date: 2015-04-27 13:22:06 -0500 (Mon, 27 Apr 2015) $
    4 # $Author: vondreele $
    5 # $Revision: 1812 $
    6 # $URL: https://subversion.xray.aps.anl.gov/pyGSAS/trunk/imports/G2phase_GPX.py $
    7 # $Id: G2phase_GPX.py 1812 2015-04-27 18:22:06Z vondreele $
     3# $Date$
     4# $Author$
     5# $Revision$
     6# $URL$
     7# $Id$
    88########### SVN repository information ###################
    99'''
     
    2424import GSASIIctrlGUI as G2G
    2525import GSASIIpath
    26 GSASIIpath.SetVersionNumber("$Revision: 1812 $")
     26GSASIIpath.SetVersionNumber("$Revision$")
    2727
    2828class PhaseReaderClass(G2obj.ImportPhase):
  • trunk/imports/G2pwd_BrukerRAW.py

    • Property svn:eol-style set to native
    • Property svn:keywords set to Date Author Revision URL Id
    r3979 r4339  
    11# -*- coding: utf-8 -*-
    22########### SVN repository information ###################
    3 # $Date: 2014-12-27 11:14:59 -0600 (Sat, 27 Dec 2014) $
    4 # $Author: vondreele $
    5 # $Revision: 1620 $
    6 # $URL: https://subversion.xray.aps.anl.gov/pyGSAS/trunk/imports/G2pwd_xye.py $
    7 # $Id: G2pwd_xye.py 1620 2014-12-27 17:14:59Z vondreele $
     3# $Date$
     4# $Author$
     5# $Revision$
     6# $URL$
     7# $Id$
    88########### SVN repository information ###################
    99'''
     
    2121import GSASIIobj as G2obj
    2222import GSASIIpath
    23 GSASIIpath.SetVersionNumber("$Revision: 1620 $")
     23GSASIIpath.SetVersionNumber("$Revision$")
    2424class raw_ReaderClass(G2obj.ImportPowderData):
    2525    'Routines to import powder data from a binary Bruker .RAW file'
  • trunk/imports/G2pwd_FP.py

    • Property svn:eol-style set to native
    • Property svn:keywords set to Date Author Revision URL Id
    r3758 r4339  
    11# -*- coding: utf-8 -*-
    22########### SVN repository information ###################
    3 # $Date: 2014-12-27 11:14:59 -0600 (Sat, 27 Dec 2014) $
    4 # $Author: vondreele $
    5 # $Revision: 1620 $
    6 # $URL: https://subversion.xray.aps.anl.gov/pyGSAS/trunk/imports/G2pwd_xye.py $
    7 # $Id: G2pwd_xye.py 1620 2014-12-27 17:14:59Z vondreele $
     3# $Date$
     4# $Author$
     5# $Revision$
     6# $URL$
     7# $Id$
    88########### SVN repository information ###################
    99'''
     
    2020import GSASIIobj as G2obj
    2121import GSASIIpath
    22 GSASIIpath.SetVersionNumber("$Revision: 1620 $")
     22GSASIIpath.SetVersionNumber("$Revision$")
    2323class fp_ReaderClass(G2obj.ImportPowderData):
    2424    'Routines to import powder data from a FullProf 1-10 column .dat file'
  • trunk/imports/G2pwd_Panalytical.py

    • Property svn:eol-style set to native
    • Property svn:keywords set to Date Author Revision URL Id
    r3918 r4339  
    11# -*- coding: utf-8 -*-
    22########### SVN repository information ###################
    3 # $Date: $
    4 # $Author: von dreele $
    5 # $Revision: $
    6 # $URL: $
    7 # $Id: $
     3# $Date$
     4# $Author$
     5# $Revision$
     6# $URL$
     7# $Id$
    88########### SVN repository information ###################
    99
     
    1414import GSASIIobj as G2obj
    1515import GSASIIpath
    16 GSASIIpath.SetVersionNumber("$Revision: $")
     16GSASIIpath.SetVersionNumber("$Revision$")
    1717class Panalytical_ReaderClass(G2obj.ImportPowderData):
    1818    '''Routines to import powder data from a Pananalytical.xrdm (xml) file.
  • trunk/imports/G2pwd_rigaku.py

    • Property svn:keywords set to Date Author Revision URL Id
    r4132 r4339  
    11# -*- coding: utf-8 -*-
    22########### SVN repository information ###################
    3 # $Date: $
    4 # $Author: toby $
    5 # $Revision: $
    6 # $URL: $
    7 # $Id: $
     3# $Date$
     4# $Author$
     5# $Revision$
     6# $URL$
     7# $Id$
    88########### SVN repository information ###################
    99
     
    1414import GSASIIobj as G2obj
    1515import GSASIIpath
    16 GSASIIpath.SetVersionNumber("$Revision: $")
     16GSASIIpath.SetVersionNumber("$Revision$")
    1717class Rigaku_txtReaderClass(G2obj.ImportPowderData):
    1818    '''Routines to import powder data from a Rigaku .txt file with an angle and
  • trunk/imports/G2rfd_Panalytical.py

    • Property svn:eol-style set to native
    • Property svn:keywords set to Date Author Revision URL Id
    r4142 r4339  
    11# -*- coding: utf-8 -*-
    22########### SVN repository information ###################
    3 # $Date: $
    4 # $Author: von dreele $
    5 # $Revision: $
    6 # $URL: $
    7 # $Id: $
     3# $Date$
     4# $Author$
     5# $Revision$
     6# $URL$
     7# $Id$
    88########### SVN repository information ###################
    99
     
    1515import GSASIIpath
    1616sind = lambda x: np.sin(x*np.pi/180.)
    17 GSASIIpath.SetVersionNumber("$Revision: $")
     17GSASIIpath.SetVersionNumber("$Revision$")
    1818class Panalytical_ReaderClass(G2obj.ImportReflectometryData):
    1919    '''Routines to import reflectivity data from a Pananalytical.xrdm (xml) file.
  • trunk/imports/G2rfd_xye.py

    • Property svn:eol-style set to native
    • Property svn:keywords set to Date Author Revision URL Id
    r4213 r4339  
    11# -*- coding: utf-8 -*-
    22########### SVN repository information ###################
    3 # $Date: 2017-03-04 08:34:05 -0600 (Sat, 04 Mar 2017) $
    4 # $Author: vondreele $
    5 # $Revision: 2738 $
    6 # $URL: https://subversion.xray.aps.anl.gov/pyGSAS/trunk/imports/G2sad_xye.py $
    7 # $Id: G2sad_xye.py 2738 2017-03-04 14:34:05Z vondreele $
     3# $Date$
     4# $Author$
     5# $Revision$
     6# $URL$
     7# $Id$
    88########### SVN repository information ###################
    99'''
     
    2121import GSASIIobj as G2obj
    2222import GSASIIpath
    23 GSASIIpath.SetVersionNumber("$Revision: 2738 $")
     23GSASIIpath.SetVersionNumber("$Revision$")
    2424npasind = lambda x: 180.*np.arcsin(x)/np.pi
    2525npsind = lambda x: np.sin(np.pi*x/180.)
Note: See TracChangeset for help on using the changeset viewer.