def periodic_gauss(self, pars, x): """ Fit function periodic_gauss(pars, x) pars = [npeaks, delta, height, position, fwhm] """ newpars = numpy.zeros((pars[0], 3), numpy.float) for i in range(int(pars[0])): newpars[i, 0] = pars[2] newpars[i, 1] = pars[3] + i * pars[1] newpars[:, 2] = pars[4] return SpecfitFuns.gauss(newpars,x)
def test(): import numpy from PyMca import SpecfitFuns x = numpy.arange(1000.) data = numpy.zeros((50, 1000), numpy.float) #the peaks to be fitted p0 = [100., 300., 50., 200., 500., 30., 300., 800., 65] #generate the data to be fitted for i in range(data.shape[0]): nPeaks = 3 - i % 3 data[i, :] = SpecfitFuns.gauss(p0[:3 * nPeaks], x) oldShape = data.shape data.shape = 1, oldShape[0], oldShape[1] instance = StackSimpleFit() instance.setData(x, data) instance.setConfigurationFile("C:\StackSimpleFit.cfg") instance.processStack()
def test(): import numpy from PyMca import SpecfitFuns x = numpy.arange(1000.) data = numpy.zeros((50, 1000), numpy.float) #the peaks to be fitted p0 = [100., 300., 50., 200., 500., 30., 300., 800., 65] #generate the data to be fitted for i in range(data.shape[0]): nPeaks = 3 - i % 3 data[i,:] = SpecfitFuns.gauss(p0[:3*nPeaks],x) oldShape = data.shape data.shape = 1,oldShape[0], oldShape[1] instance = StackSimpleFit() instance.setData(x, data) instance.setConfigurationFile("C:\StackSimpleFit.cfg") instance.processStack()
def gauss(self,pars,x): """ A fit function. """ return SpecfitFuns.gauss(pars,x)