Пример #1
0
 def do_fit(self):
     print 'Fitting the template with unbinned likelihood...'
     template = LCTemplate(self.primitives,norms=self.norms)
     fitter   = LCFitter(template,self.phases,weights=self.weights)
     fitter.fit(estimate_errors=self.errors)
     print 'Fitting finished!'
     print fitter
     print 'Overlaying fitted template...'
     self.fig = pl.figure(self.fignum)
     self.ax = pl.gca()
     light_curve(self.phases,weights=self.weights,nbins=self.nbins,axes=self.ax,template=template)
     pl.show()
     self.fitter = fitter
Пример #2
0
 def __init__(self,phases,**kwargs):
     self.init()
     self.__dict__.update(**kwargs)
     self.phases = phases
     self.primitives = []
     self.norms = []
     self.dom = np.linspace(0,1,100)
     self.welcome()
     pl.close(self.fignum)
     self.fig = pl.figure(self.fignum)
     self.ax  = pl.gca()
     self.connect()
     light_curve(self.phases,weights=self.weights,nbins=self.nbins,axes=self.ax)
     pl.show()
Пример #3
0
    def on_release(self,event):
        x1 = event.xdata
        y1 = event.ydata

        fwhm  = x1 - self.x0
        peak  = (y1 + self.y0)/2.
        phase = (x1 + self.x0)/2.

        # just Gaussian for now
        sigma = fwhm/(8 * np.log(2))**0.5
        ampl  = peak * sigma * (2*np.pi)**0.5

        self.primitives.append(LCGaussian(p=[sigma,phase]))
        self.norms.append(ampl)
        template = LCTemplate(self.primitives,norms=self.norms)
        self.ax.clear()
        light_curve(self.phases,weights=self.weights,nbins=self.nbins,axes=self.ax,template=template)
        pl.draw()