make_source_mask

photutils.segmentation.make_source_mask(data, nsigma, npixels, mask=None, filter_fwhm=None, filter_size=3, filter_kernel=None, sigclip_sigma=3.0, sigclip_iters=5, dilate_size=11)[source]

Make a source mask using source segmentation and binary dilation.

Parameters
dataarray_like

The 2D array of the image.

nsigmafloat

The number of standard deviations per pixel above the background for which to consider a pixel as possibly being part of a source.

npixelsint

The number of connected pixels, each greater than threshold, that an object must have to be detected. npixels must be a positive integer.

maskarray_like, bool, optional

A boolean mask with the same shape as data, where a True value indicates the corresponding element of data is masked. Masked pixels are ignored when computing the image background statistics.

filter_fwhmfloat, optional

The full-width at half-maximum (FWHM) of the Gaussian kernel to filter the image before thresholding. filter_fwhm and filter_size are ignored if filter_kernel is defined.

filter_sizefloat, optional

The size of the square Gaussian kernel image. Used only if filter_fwhm is defined. filter_fwhm and filter_size are ignored if filter_kernel is defined.

filter_kernelarray-like (2D) or Kernel2D, optional

The 2D array of the kernel used to filter the image before thresholding. Filtering the image will smooth the noise and maximize detectability of objects with a shape similar to the kernel. filter_kernel overrides filter_fwhm and filter_size.

sigclip_sigmafloat, optional

The number of standard deviations to use as the clipping limit when calculating the image background statistics.

sigclip_itersint, optional

The maximum number of iterations to perform sigma clipping, or None to clip until convergence is achieved (i.e., continue until the last iteration clips nothing) when calculating the image background statistics.

dilate_sizeint, optional

The size of the square array used to dilate the segmentation image.

Returns
mask2D bool ndarray

A 2D boolean image containing the source mask.