Skip to content

Commit

Permalink
speed up code a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
clara-escanuela committed Jan 16, 2024
1 parent 69b45b4 commit 0fa134b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ctapipe/image/cleaning.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,9 @@ def tailcuts_hysteresis_clean(
# matrix (2d), we find all pixels that are above the boundary threshold
# AND have any neighbor that is in the picture
pixels_above_boundary = image >= boundary_thresh

pixels_with_boundary_neighbors = geom.neighbor_matrix_sparse.dot(
pixels_above_boundary
)
for count in range(max_iter):
pixels_in_picture_previous = pixels_in_picture.copy()
pixels_with_picture_neighbors = geom.neighbor_matrix_sparse.dot(
Expand All @@ -445,9 +447,6 @@ def tailcuts_hysteresis_clean(
pixels_above_boundary & pixels_with_picture_neighbors
) | pixels_in_picture
else:
pixels_with_boundary_neighbors = geom.neighbor_matrix_sparse.dot(
pixels_above_boundary
)
pixels_in_picture = (
pixels_above_boundary & pixels_with_picture_neighbors
) | (pixels_in_picture & pixels_with_boundary_neighbors)
Expand Down

0 comments on commit 0fa134b

Please sign in to comment.