Skip to content

Commit

Permalink
Test exact equality, fix random seed
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Mar 20, 2020
1 parent c26b534 commit f824053
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ctapipe/image/tests/test_hillas.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ def test_straight_line_width_0():
trans = np.zeros(len(long))
pix_id = np.arange(len(long))

np.random.seed(0)

for dx in (-1, 0, 1):
for dy in (-1, 0, 1):
for psi in np.linspace(0, np.pi, 20):
Expand All @@ -231,9 +233,4 @@ def test_straight_line_width_0():

img = np.random.poisson(5, size=len(long))
result = hillas_parameters(geom, img)
if np.isnan(result.width):
print('img', img)
cov = np.cov(x, y, aweights=img)
print('cov', repr(cov))
print('eig', repr(np.linalg.eigh(cov)[0]))
assert np.isclose(result.width.value, 0)
assert result.width.value == 0

0 comments on commit f824053

Please sign in to comment.