diff --git a/ctapipe/image/cleaning.py b/ctapipe/image/cleaning.py index 62c199973f3..0fa73f8e29c 100644 --- a/ctapipe/image/cleaning.py +++ b/ctapipe/image/cleaning.py @@ -133,9 +133,9 @@ def time_clustering( firstly applied. The cut is performed relative to the noise to account for, e.g., bright stars. Alternatively, a hard cut could also be performed. - DBSCAN runs with the reconstructed times and pixel positions after rescaling. The reconstructed times and - pixel positions are rescaled because eps is not dimension dependent. If scaling is performed properly, eps - can be set to 1. DBSCAN returns the cluster IDs of each point being -1 the label for noise pixels. + DBSCAN runs with the reconstructed times and pixel positions after scaling. Scaling is needed because eps + is not dimension dependent. If scaling is performed properly, eps can be set to 1. DBSCAN returns the + cluster IDs of each point being -1 the label for noise pixels. Parameters ---------- diff --git a/ctapipe/image/tests/test_cleaning.py b/ctapipe/image/tests/test_cleaning.py index b6e98cf95a4..92b03f1416c 100644 --- a/ctapipe/image/tests/test_cleaning.py +++ b/ctapipe/image/tests/test_cleaning.py @@ -343,7 +343,7 @@ def test_time_cleaning(): core_neighbors = geom.neighbors[core_pixel] charge[core_pixel], charge[core_neighbors] = 15, 5 - peak_time[core_pixel], peak_time[core_neighbors] = (18, 20) + peak_time[core_pixel], peak_time[core_neighbors] = (0.0, 0.0) mask = cleaning.time_clustering( geom, @@ -358,6 +358,48 @@ def test_time_cleaning(): assert np.count_nonzero(mask) == 0 + mask = cleaning.time_clustering( + geom, + charge, + peak_time, + eps=1.0, + space_scale_m=0.25, + time_scale_ns=4.0, + hard_cut_pe=1, + minpts=5, + ) + + assert np.count_nonzero(mask) == 7 + + mask = cleaning.time_clustering( + geom, + charge, + peak_time, + eps=1.0, + space_scale_m=0.25, + time_scale_ns=4.0, + hard_cut_pe=1, + minpts=8, + ) + + assert np.count_nonzero(mask) == 0 + + charge[core_pixel], charge[core_neighbors] = 15, 5 + peak_time[core_pixel], peak_time[core_neighbors] = (0.0, 30.0) + + mask = cleaning.time_clustering( + geom, + charge, + peak_time, + eps=1.0, + space_scale_m=0.25, + time_scale_ns=4.0, + hard_cut_pe=1, + minpts=5, + ) + + assert np.count_nonzero(mask) == 6 + def test_time_constrained_clean(): geom = CameraGeometry.from_name("LSTCam")