Compute derivatives by default numerical differentiation for all non-frozen parameters, This must be overridden for fits which have analytic derivatives. See example in class documentation. Note in particular that the array returned is organized with all the values for a point in each row. The columns correspond to the parameters. Reimplemented from fit. Definition at line 15 of file gauss_deriv_fit.py. 00015 : 00016 #analytic derivatives for a 1-d gaussian*(x-mu) 00017 #z0+a*(x-mu)*exp( -(x-xmu)**2/(2*xsig**2) ) 00018 z0, a, xmu, xsigma = self.funcparams 00019 n=self.pointcount 00020 x=self.xarray[0,:n] 00021 xsigi=-1.0/(2.0*xsigma**2) 00022 dx=x-xmu 00023 dx2=dx*dx 00024 expfact=Numeric.exp(xsigi*dx2) 00025 z=a*expfact*dx 00026 00027 dd = Numeric.zeros((n, 4), self.atype) 00028 dd[:,0]=1.0 00029 dd[:,1]=expfact*dx 00030 dd[:,2]=(-2.0*xsigi*dx*dx - 1)*a*expfact 00031 dd[:,3]=(-2.0*xsigi/xsigma)*(dx2*z) 00032 00033 return dd 00034
|