def test_gaussian_constraint_sampling(): param1 = zfit.Parameter("Param1", 5) params = [param1] mu = [5] sigma = [1] constr = GaussianConstraint(params=params, mu=mu, sigma=sigma) sample = constr.sample(15000) assert np.mean(sample[param1]) == pytest.approx(mu[0], rel=0.01) assert np.std(sample[param1]) == pytest.approx(sigma[0], rel=0.01)
def test_gaussian_constraint_sampling(): param1 = zfit.Parameter("Param1", 5) params = [param1] observed = [5] sigma = [1] constr = GaussianConstraint(params=params, observation=observed, uncertainty=sigma) sample = constr.sample(15000) assert np.mean(sample[param1]) == pytest.approx(observed[0], rel=0.01) assert np.std(sample[param1]) == pytest.approx(sigma[0], rel=0.01)