Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Jun 18, 2018
1 parent e289b11 commit 9c35845
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions ctapipe/image/tests/test_hillas.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
from numpy.ma import masked_array
import pytest

methods = (
hillas_parameters_1,
hillas_parameters_2,
hillas_parameters_3,
hillas_parameters_4,
hillas_parameters_5
)


def create_sample_image(psi='-30d'):

Expand Down Expand Up @@ -90,7 +98,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)

Expand All @@ -112,7 +119,6 @@ def test_hillas_masked():
compare_result(results.r, results_ma.r)
compare_result(results.phi.deg, results_ma.phi.deg)
compare_result(results.psi.deg, results_ma.psi.deg)
compare_result(results.miss, results_ma.miss)
compare_result(results.skewness, results_ma.skewness)
# compare_result(results.kurtosis, results_ma.kurtosis)

Expand All @@ -121,21 +127,9 @@ def test_hillas_failure():
geom, image = create_sample_image_zeros(psi='0d')
blank_image = zeros_like(image)

with pytest.raises(HillasParameterizationError):
hillas_parameters_1(geom, blank_image)

with pytest.raises(HillasParameterizationError):
hillas_parameters_2(geom, blank_image)

with pytest.raises(HillasParameterizationError):
hillas_parameters_3(geom, blank_image)

with pytest.raises(HillasParameterizationError):
hillas_parameters_4(geom, blank_image)

with pytest.raises(HillasParameterizationError):
hillas_parameters_5(geom, blank_image)

for method in methods:
with pytest.raises(HillasParameterizationError):
method(geom, blank_image)


def test_hillas_api_change():
Expand All @@ -145,5 +139,6 @@ def test_hillas_api_change():

def test_hillas_container():
geom, image = create_sample_image_zeros(psi='0d')

params = hillas_parameters_4(geom, image, container=True)
assert type(params) is HillasParametersContainer
assert isinstance(params, HillasParametersContainer)

0 comments on commit 9c35845

Please sign in to comment.