import numpy as np
from . import hexwave_cleaning, quadwave_cleaning, hextailcut_cleaning
from . import injunction_tables
[docs]def wavelet_cleaning(geom, image, alpha=2):
"""
Apply wavelet cleaning to an image and return the mask of the image
Parameters
----------
geom: `ctapipe.instrument.CameraGeometry` - camera geometry
image: `numpy.ndarray`
alpha: float - wavelet threshold parameter
Returns
-------
`numpy.ndarray` - array of boolean
"""
image = np.ascontiguousarray(image).astype(np.float32)
if geom.pix_type == 'hexagonal':
inj_table, n_col, n_row = injunction_tables[geom.cam_id].get_tuple()
cleaned = hexwave_cleaning(image, inj_table, n_row, n_col, alpha)
else:
cleaned = quadwave_cleaning(image, alpha)
return cleaned.astype(bool)
[docs]def tailcut_cleaning(geom, image, center=6, neighbours=3):
"""
Apply wavelet cleaning to an image and return the mask of the image
Parameters
----------
geom: `ctapipe.instrument.CameraGeometry` - camera geometry
image: `numpy.ndarray`
center: float - center threshold parameter
neighbours: float - neighbours threshold parameter
Returns
-------
`numpy.ndarray` - array of boolean
"""
image = np.ascontiguousarray(image).astype(np.float32)
if geom.pix_type == 'hexagonal':
inj_table, n_col, n_row = injunction_tables[geom.cam_id].get_tuple()
cleaned = hextailcut_cleaning(image, inj_table, n_row, n_col, center,neighbours)
else:
cleaned = hextailcut_cleaning(image, center,neighbours)
return cleaned.astype(bool)