Reactive ParameterEstimator tests
@@ -25,8 +25,9 @@ def PLmodel():
@pytest.fixture
def crab_datasets_fermi():
return Datasets.read(
- "$GAMMAPY_DATA/fermi-3fhl-crab/Fermi-LAT-3FHL_datasets.yaml",
- "$GAMMAPY_DATA/fermi-3fhl-crab/Fermi-LAT-3FHL_models.yaml",
+ "$GAMMAPY_DATA/fermi-3fhl-crab",
+ "Fermi-LAT-3FHL_datasets.yaml",
+ "Fermi-LAT-3FHL_models.yaml",
)
@@ -53,32 +54,17 @@ def test_parameter_estimator_1d(crab_datasets_1d, PLmodel):
assert_allclose(result["amplitude_scan"].shape, 10)
-@pytest.mark.xfail
-@requires_data()
-def test_parameter_estimator_3d(crab_datasets_fermi):
- datasets = crab_datasets_fermi
- parameter = datasets[0].models.parameters["amplitude"]
- estimator = ParameterEstimator(selection=["ts", "err"])
-
- result = estimator.run(datasets, parameter)
-
- assert_allclose(result["amplitude"], 0.328839, rtol=1e-3)
- assert_allclose(result["amplitude_err"], 0.002801, rtol=1e-3)
- assert_allclose(result["ts"], 13005.938702, rtol=1e-3)
-
-
-@pytest.mark.xfail
@requires_data()
def test_parameter_estimator_3d_no_reoptimization(crab_datasets_fermi):
datasets = crab_datasets_fermi
parameter = datasets[0].models.parameters["amplitude"]
- estimator = ParameterEstimator(reoptimize=False, n_scan_values=10)
+ estimator = ParameterEstimator(reoptimize=False, scan_n_values=10)
alpha_value = datasets[0].models.parameters["alpha"].value
result = estimator.run(datasets, parameter)
assert not datasets[0].models.parameters["alpha"].frozen
assert_allclose(datasets[0].models.parameters["alpha"].value, alpha_value)
- assert_allclose(result["amplitude"], 0.331505, rtol=1e-4)
+ assert_allclose(result["amplitude"], 0.018381, rtol=1e-4)
assert_allclose(result["amplitude_scan"].shape, 10)
- assert_allclose(result["amplitude_scan"][0], 0.312406, atol=1e-3)
+ assert_allclose(result["amplitude_scan"][0], 0.017282, atol=1e-3)
