iso_background_mask

laserbeamsize.background.iso_background_mask(image: ndarray, corner_fraction: float = 0.035, nT: float = 3) ndarray[tuple[Any, ...], dtype[bool]][source]

Return a mask indicating the background pixels in an image.

We estimate the mean and standard deviation using the values in the corners. All pixel values that fall below the mean+nT*stdev are considered unilluminated (background) pixels.

If the image is already masked, only unmasked pixels will be considered for background determination.

Parameters:
  • image – the image to work with (may be a masked array)

  • nT – how many standard deviations to subtract

  • corner_fraction – the fractional size of corner rectangles

Returns:

background_mask – 2D array of True/False values