MAGICClean#

class magicctapipe.image.MAGICClean(camera, configuration)[source]#

Bases: object

Implement the cleaning used by MAGIC.

Parameters:
cameractapipe.instrument.CameraGeometry

Camera geometry.

configurationdict

Dictionary for the configuration.

Methods Summary

GetListOfNN([NN_size, bad_pixels])

Get the list of next neighbor pixels.

clean_image(event_image, event_pulse_time[, ...])

Clean the input image.

group_calculation(mask, NN, clipNN, ...)

Calculate pixel groups.

magic_clean_step1()

Perform the 1st step of the cleaning.

magic_clean_step1Sum()

Perform the 1st step of the Sum cleaning.

magic_clean_step2(mask)

Perform the 2nd step of the cleaning.

magic_clean_step2b(mask)

Perform the 2nd step of the cleaning (b version).

magic_clean_step3(mask)

Perform the 3rd step of the cleaning.

magic_clean_step3b(mask)

Perform the 3rd step of the cleaning (b version).

single_island(neighbors, mask)

Find single islands in the image.

Methods Documentation

GetListOfNN(NN_size=2, bad_pixels=None)[source]#

Get the list of next neighbor pixels.

Parameters:
NN_sizeint, optional

Order of next neighbors to find, by default 2.

bad_pixelsnp.ndarray, optional

Array of bad pixels, by default None.

Returns:
np.ndarray

Array of neighbor pixels.

clean_image(event_image, event_pulse_time, unsuitable_mask=None)[source]#

Clean the input image.

Parameters:
event_imagenp.ndarray

Input array with event image (charge per each pixel).

event_pulse_timenp.ndarray

Input array with event times (time per each pixel).

unsuitable_masknp.ndarray, optional

Array of unsuitable pixels, by default None.

Returns:
clean_masknp.ndarray

Mask with pixels surviving the cleaning.

self.event_imagenp.ndarray

Image (charges) with only surviving pixels.

self.event_pulse_timenp.ndarray

Image (times) with only surviving pixels.

Raises:
ValueError

Raised if no unsuitable mask is provided but find_hotpixles is True.

group_calculation(mask, NN, clipNN, windowNN, thresholdNN)[source]#

Calculate pixel groups.

Parameters:
masknp.ndarray

Mask aray.

NNnp.ndarray

Neighbor pixels array.

clipNNfloat

Charge clipping value.

windowNNfloat

Time window cut.

thresholdNNfloat

Group charge threshold.

Returns:
np.ndarray

Updated mask array.

magic_clean_step1()[source]#

Perform the 1st step of the cleaning.

Returns:
np.ndarray

Mask array with excluded pixels.

magic_clean_step1Sum()[source]#

Perform the 1st step of the Sum cleaning.

Returns:
np.ndarray

Mask array with excluded pixels.

magic_clean_step2(mask)[source]#

Perform the 2nd step of the cleaning.

Parameters:
masknp.ndarray

Input mask.

Returns:
np.ndarray

Mask array with excluded pixels.

magic_clean_step2b(mask)[source]#

Perform the 2nd step of the cleaning (b version).

Parameters:
masknp.ndarray

Input mask.

Returns:
np.ndarray

Mask array with excluded pixels.

magic_clean_step3(mask)[source]#

Perform the 3rd step of the cleaning.

Parameters:
masknp.ndarray

Input mask.

Returns:
np.ndarray

Mask array with excluded pixels.

magic_clean_step3b(mask)[source]#

Perform the 3rd step of the cleaning (b version).

Parameters:
masknp.ndarray

Input mask.

Returns:
np.ndarray

Mask array with excluded pixels.

single_island(neighbors, mask)[source]#

Find single islands in the image.

Parameters:
neighborsnp.ndarray

Array with neighbor pixels.

masknp.ndarray

Input mask array.

Returns:
np.ndarray

Mask of pixels with single islands.