Skip to content

Commit

Permalink
Remove last lstchain functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
aleberti committed Aug 29, 2023
1 parent 9ca857d commit 7e52be4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 175 deletions.
11 changes: 1 addition & 10 deletions magicctapipe/image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,17 @@
PixelTreatment,
get_num_islands_MAGIC,
clean_image_params,
apply_dynamic_cleaning,
)

from .leakage import (
get_leakage,
)
from .modifier import (
add_noise_in_pixels,
random_psf_smearer,
set_numba_seed,
)


__all__ = [
"MAGICClean",
"PixelTreatment",
"get_num_islands_MAGIC",
"clean_image_params",
"get_leakage",
"apply_dynamic_cleaning",
"add_noise_in_pixels",
"random_psf_smearer",
"set_numba_seed",
]
33 changes: 0 additions & 33 deletions magicctapipe/image/cleaning.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"PixelTreatment",
"get_num_islands_MAGIC",
"clean_image_params",
"apply_dynamic_cleaning",
]


Expand Down Expand Up @@ -720,35 +719,3 @@ def clean_image_params(geom, image, clean, peakpos):
# time_grad[tel_id] = 1

return hillas_p, leakage_p, timing_p


def apply_dynamic_cleaning(image, signal_pixels, threshold, fraction):
"""
Application of the dynamic cleaning
Parameters
----------
image: `np.ndarray`
Pixel charges
signal_pixels
threshold: `float`
Minimum average charge in the 3 brightest pixels to apply
the dynamic cleaning (else nothing is done)
fraction: `float`
Pixels below fraction * (average charge in the 3 brightest pixels)
will be removed from the cleaned image
Returns
-------
mask_dynamic_cleaning: `np.ndarray`
Mask with the selected pixels after the dynamic cleaning
"""

max_3_value_index = np.argsort(image)[-3:]
mean_3_max_signal = np.mean(image[max_3_value_index])

if mean_3_max_signal < threshold:
return signal_pixels

dynamic_threshold = fraction * mean_3_max_signal
mask_dynamic_cleaning = (image >= dynamic_threshold) & signal_pixels

return mask_dynamic_cleaning
132 changes: 0 additions & 132 deletions magicctapipe/image/modifier.py

This file was deleted.

0 comments on commit 7e52be4

Please sign in to comment.