Skip to content

Commit 711e49e

Browse files
committed
Fix calc_fov_lon_lat unit test
1 parent f575c5b commit 711e49e

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/ctapipe/reco/telescope_event_handling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def calc_fov_lon_lat(tel_table, sign_score_limit, prefix="DispReconstructor_tel"
438438
if sign_score_limit is not None:
439439
sign_score = tel_table[f"{prefix}_sign_score"]
440440
mask_sign = np.sign(disp)[:, None] == signs
441-
sign_score[sign_score <= sign_score_limit] = 0
441+
sign_score[sign_score < sign_score_limit] = 0
442442
dist_weights[mask_sign] = 1 / (1 + sign_score)
443443

444444
cos_psi = np.cos(hillas_psi)

src/ctapipe/reco/tests/test_telescope_event_handling.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,26 @@ def test_calc_fov_lon_lat():
108108
from ctapipe.reco.telescope_event_handling import calc_fov_lon_lat
109109

110110
prefix = "disp"
111+
sign_score_limit = 0.85
111112
tel_table = Table(
112113
{
113114
"hillas_fov_lon": [1, 2, 3] * u.deg,
114115
"hillas_fov_lat": [4, 5, 6] * u.deg,
115116
"hillas_psi": [0, 45, 90] * u.deg,
116117
f"{prefix}_parameter": [1, 2.5, 3] * u.deg,
118+
f"{prefix}_sign_score": [0.7, 0.8, 0.9],
117119
}
118120
)
119121

120-
lon, lat = calc_fov_lon_lat(tel_table, prefix)
122+
lon, lat, dist_weights = calc_fov_lon_lat(tel_table, sign_score_limit, prefix)
121123

122124
exp_lon = np.array([[0.0, 2.0], [0.23223305, 3.76776695], [3.0, 3.0]])
123125
exp_lat = np.array([[4.0, 4.0], [3.23223305, 6.76776695], [3.0, 9.0]])
126+
exp_dist_weights = np.array([[1, 1], [1, 1], [1, 1 / (1 + 0.9)]])
124127

125128
assert np.allclose(lon, exp_lon)
126129
assert np.allclose(lat, exp_lat)
130+
assert np.allclose(dist_weights, exp_dist_weights)
127131

128132

129133
def test_create_combs_array():

0 commit comments

Comments
 (0)