Changeset 2508 for trunk/testDeriv.py


Ignore:
Timestamp:
Oct 27, 2016 12:50:38 PM (5 years ago)
Author:
vondreele
Message:

fix move difference curve problem
mag derivs are better but still not right - refinements work (sort of)
fix to testDeriv to show atom pos derivs for depVarList parameters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/testDeriv.py

    r2501 r2508  
    8585
    8686    def OnTestRead(self,event):
    87         dlg = wx.FileDialog(self, 'Open testDeriv.dat file', '.', 'testDeriv.dat')
     87        dlg = wx.FileDialog(self, 'Open testDeriv.dat file',defaultFile='testDeriv.dat',
     88            wildcard='testDeriv.dat')
    8889        if self.dirname:
    8990            dlg.SetDirectory(self.dirname)
     
    165166           
    166167        def test2(name,delt):
    167            
    168168            Title = 'derivatives test for '+name
    169169            varyList = self.varylist+self.depVarList
     
    171171            dMdV = G2stMth.dervRefine(self.values,self.HistoPhases,self.parmDict,
    172172                varyList,self.calcControls,self.pawleyLookup,None)
    173             hplot.plot(dMdV[varyList.index(name)],'b',label='analytic deriv')
     173            M2 = dMdV[varyList.index(name)]
     174            hplot.plot(M2,'b',label='analytic deriv')
    174175            if name in varyList:
    175176                mmin = np.min(dMdV[varyList.index(name)])
     
    184185                        varyList,self.calcControls,self.pawleyLookup,None)
    185186                    self.values[self.varylist.index(name)] -= delt
    186                 else:   #in depVarList
     187                elif name in self.depVarList:   #in depVarList
     188                    if 'dA' in name:
     189                        name = name.replace('dA','A')
     190                        delt *= -1
    187191                    self.parmDict[name] -= delt
    188192                    M0 = G2stMth.errRefine(self.values,self.HistoPhases,self.parmDict,
     
    192196                        varyList,self.calcControls,self.pawleyLookup,None)
    193197                    self.parmDict[name] -= delt   
    194                 Mn = (M1-M0)/(2.*delt)
     198                Mn = (M1-M0)/(2.*abs(delt))
    195199                hplot.plot(Mn,'r',label='numeric deriv')
    196                 hplot.plot(dMdV[varyList.index(name)]-Mn,'g',label='diff')
     200                hplot.plot(M2-Mn,'g',label='diff')
    197201#            GSASIIpath.IPyBreak()
    198202            hplot.legend(loc='best')           
Note: See TracChangeset for help on using the changeset viewer.