Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test for sliced geometries for hillas calculation #781

Merged
merged 4 commits into from
Oct 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions ctapipe/image/tests/test_hillas.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ def create_sample_image_zeros(psi='-30d'):
def create_sample_image_masked(psi='-30d'):
geom, image, clean_mask = create_sample_image(psi)

# threshold in pe
image = masked_array(image, mask=~clean_mask)

return geom, image


def create_sample_image_selected_pixel(psi='-30d'):
geom, image, clean_mask = create_sample_image(psi)

return geom[clean_mask], image[clean_mask]


def compare_result(x, y):
ux = u.Quantity(x)
uy = u.Quantity(y)
Expand Down Expand Up @@ -121,6 +125,28 @@ def test_hillas_masked():
# compare_result(results.kurtosis, results_ma.kurtosis)


def test_hillas_selected():
"""
test Hillas-parameter routines on a sample image with selected values
against a sample image with masked values set tozero
"""

geom, image = create_sample_image_zeros()
geom_selected, image_ma = create_sample_image_selected_pixel()

results = hillas_parameters_4(geom, image)
results_ma = hillas_parameters_4(geom_selected, image_ma)

compare_result(results.length, results_ma.length)
compare_result(results.width, results_ma.width)
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.skewness, results_ma.skewness)
# compare_result(results.kurtosis, results_ma.kurtosis)



def test_hillas_failure():
geom, image = create_sample_image_zeros(psi='0d')
blank_image = zeros_like(image)
Expand Down