elliptical_mask

laserbeamsize.background.elliptical_mask(image: ndarray, xc: float, yc: float, d_major: float, d_minor: float, phi: float) ndarray[tuple[Any, ...], dtype[bool]][source]

Create a boolean mask for a rotated elliptical disk.

The returned mask is the same size as image.

If the image is already masked, only unmasked pixels within the ellipse will be marked as True.

Parameters:
  • image – 2D array (may be a masked array)

  • xc – horizontal center of beam (in full image coordinates)

  • yc – vertical center of beam (in full image coordinates)

  • d_major – semi-major ellipse diameter

  • d_minor – semi-minor ellipse diameter

  • phi – angle between horizontal and major axes [radians]

Returns:

masked_image – 2D array with True values inside ellipse