Skip to content

Commit 0fa134b

Browse files
speed up code a bit
1 parent 69b45b4 commit 0fa134b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

ctapipe/image/cleaning.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,9 @@ def tailcuts_hysteresis_clean(
434434
# matrix (2d), we find all pixels that are above the boundary threshold
435435
# AND have any neighbor that is in the picture
436436
pixels_above_boundary = image >= boundary_thresh
437-
437+
pixels_with_boundary_neighbors = geom.neighbor_matrix_sparse.dot(
438+
pixels_above_boundary
439+
)
438440
for count in range(max_iter):
439441
pixels_in_picture_previous = pixels_in_picture.copy()
440442
pixels_with_picture_neighbors = geom.neighbor_matrix_sparse.dot(
@@ -445,9 +447,6 @@ def tailcuts_hysteresis_clean(
445447
pixels_above_boundary & pixels_with_picture_neighbors
446448
) | pixels_in_picture
447449
else:
448-
pixels_with_boundary_neighbors = geom.neighbor_matrix_sparse.dot(
449-
pixels_above_boundary
450-
)
451450
pixels_in_picture = (
452451
pixels_above_boundary & pixels_with_picture_neighbors
453452
) | (pixels_in_picture & pixels_with_boundary_neighbors)

0 commit comments

Comments
 (0)