ImageMask

class ctapointing.imagesolver.ImageMask(inverted=True)

Bases: object

Class that stores an image mask.

Attributes Summary

image

Methods Summary

dilate(dilation_radius)

Dilate the mask using a (num_pixels x num_pixels) quadratic kernel.

erode(erosion_radius)

Return erosion of mask using a (num_pix x num_pix) quadratic kernel.

estimate_masked_area()

Estimate the area masked by the mask, relative to the FoV of the image.

from_name(filename[, inverted])

Read a ImageMask config from either file or database.

read_mask_from_fits(input_url, **kwargs)

Read image mask from FITS file.

Attributes Documentation

image

Methods Documentation

dilate(dilation_radius: int) array

Dilate the mask using a (num_pixels x num_pixels) quadratic kernel.

Parameters:

dilation_radius (float) – dilation radius

Returns:

image_dilated – dilated image

Return type:

np.array or None

erode(erosion_radius: int) array

Return erosion of mask using a (num_pix x num_pix) quadratic kernel.

Parameters:

erosion_radius (float) – erosion radius

Returns:

image_eroded – erosion of mask image

Return type:

np.array or None

estimate_masked_area()

Estimate the area masked by the mask, relative to the FoV of the image.

classmethod from_name(filename: str, inverted=True, **kwargs)

Read a ImageMask config from either file or database.

Parameters:
  • filename (str) – filename of the mask fits file

  • kwargs (arguments forwarded to ImageMask.read_mask_from_fits())

Returns:

mask

Return type:

ImageMask object

read_mask_from_fits(input_url: str, **kwargs) None

Read image mask from FITS file. By default, the mask is flipped on the vertical axis, since this is the standard for the real images.

Parameters:
  • input_url (str or Path) – path to the FITS file

  • swap_y (bool) – flag to mirror mask along y-axis (default True)

__init__(inverted=True)
dilate(dilation_radius: int) array

Dilate the mask using a (num_pixels x num_pixels) quadratic kernel.

Parameters:

dilation_radius (float) – dilation radius

Returns:

image_dilated – dilated image

Return type:

np.array or None

erode(erosion_radius: int) array

Return erosion of mask using a (num_pix x num_pix) quadratic kernel.

Parameters:

erosion_radius (float) – erosion radius

Returns:

image_eroded – erosion of mask image

Return type:

np.array or None

estimate_masked_area()

Estimate the area masked by the mask, relative to the FoV of the image.

classmethod from_name(filename: str, inverted=True, **kwargs)

Read a ImageMask config from either file or database.

Parameters:
  • filename (str) – filename of the mask fits file

  • kwargs (arguments forwarded to ImageMask.read_mask_from_fits())

Returns:

mask

Return type:

ImageMask object

read_mask_from_fits(input_url: str, **kwargs) None

Read image mask from FITS file. By default, the mask is flipped on the vertical axis, since this is the standard for the real images.

Parameters:
  • input_url (str or Path) – path to the FITS file

  • swap_y (bool) – flag to mirror mask along y-axis (default True)