diff --git a/ctapipe/image/hillas.py b/ctapipe/image/hillas.py index 10ac365bf1e..ed2b20d4dda 100644 --- a/ctapipe/image/hillas.py +++ b/ctapipe/image/hillas.py @@ -704,6 +704,9 @@ def hillas_parameters_5(geom: CameraGeometry, image): delta_x = pix_x - cog_x delta_y = pix_y - cog_y + # The ddof=0 makes this comparable to the other methods, + # but ddof=1 should be more correct, mostly affects small showers + # on a percent level cov = np.cov(delta_x, delta_y, aweights=image, ddof=0) eig_vals, eig_vecs = np.linalg.eigh(cov) diff --git a/ctapipe/image/tests/test_hillas.py b/ctapipe/image/tests/test_hillas.py index e02143707ee..4a8a17d347b 100644 --- a/ctapipe/image/tests/test_hillas.py +++ b/ctapipe/image/tests/test_hillas.py @@ -58,7 +58,7 @@ def create_sample_image_masked(psi='-30d'): def compare_result(x, y): ux = u.Quantity(x) uy = u.Quantity(y) - assert isclose(ux.value, uy.value) + assert isclose(ux.value, uy.value, rtol=0.01) assert ux.unit == uy.unit @@ -78,7 +78,7 @@ def test_hillas(): results['v1'] = hillas_parameters_1(geom, image) results['v2'] = hillas_parameters_2(geom, image) results['v3'] = hillas_parameters_3(geom, image) - results['v4'] = hillas_parameters_4(geom, image) + results['v4'] = hillas_parameters_4(geom, image, container=True) results['v5'] = hillas_parameters_5(geom, image) # compare each method's output for aa in results: @@ -90,7 +90,6 @@ def test_hillas(): compare_result(results[aa].r, results[bb].r) compare_result(results[aa].phi.deg, results[bb].phi.deg) compare_result(results[aa].psi.deg, results[bb].psi.deg) - compare_result(results[aa].miss, results[bb].miss) compare_result(results[aa].skewness, results[bb].skewness) # compare_result(results[aa].kurtosis, results[bb].kurtosis) @@ -137,7 +136,6 @@ def test_hillas_failure(): hillas_parameters_5(geom, blank_image) - def test_hillas_api_change(): with pytest.raises(ValueError): hillas_parameters_4(arange(10), arange(10), arange(10))