Esempio n. 1
0
def test_minos_contour():
    dataset = MyDataset()
    dataset.models.parameters["x"].frozen = True
    fit = Fit([dataset])
    fit.optimize(backend="minuit")
    result = fit.minos_contour("y", "z")

    assert result["success"] is True

    x = result["x"]
    assert_allclose(len(x), 10)
    assert_allclose(x[0], 299, rtol=1e-5)
    assert_allclose(x[-1], 299.133975, rtol=1e-5)
    y = result["y"]
    assert_allclose(len(y), 10)
    assert_allclose(y[0], 0.04, rtol=1e-5)
    assert_allclose(y[-1], 0.54, rtol=1e-5)

    # Check that original value state wasn't changed
    assert_allclose(dataset.models.parameters["y"].value, 300)