def fit(self, x, y, dy, constraints,
            walkers=50, burnin=500, steps=500):
        ndim = 3
        # initialize walker parameters
        amp = y.max()
        mean = (x * y).sum() / y.sum()
        var = ((x - mean) ** 2 * y).sum() / y.sum()
        p0 = np.array([amp, mean, np.sqrt(var)]).reshape(1, -1)
        p0 = np.random.lognormal(sigma=.1, size=(walkers, ndim)) * p0
        sampler = emcee.EnsembleSampler(walkers, ndim, lnprob,
                                        args=[x, y, dy])

        # burnin
        pos, prob, state = sampler.run_mcmc(p0, burnin)
        sampler.reset()

        # run
        sampler.run_mcmc(pos, steps)
        return sampler
dataset/ETHPy150Open glue-viz/glue/doc/gui_guide/emcee_plugin.py/EmceeGaussianFitter.fit/original