class photutils.detection.StarFinder(threshold, kernel, min_separation=5.0, exclude_border=False, brightest=None, peakmax=None)[source]

Bases: StarFinderBase

Detect stars in an image using a user-defined kernel.


The absolute image value above which to select sources.


A 2D array of the PSF kernel.

min_separationfloat, optional

The minimum separation (in pixels) for detected objects. Note that large values may result in long run times.

exclude_borderbool, optional

Whether to exclude sources found within half the size of the convolution kernel from the image borders.

brightestNone or int, optional

The number of brightest objects to return in the output table. If brightest is set to None, all objects will be returned.

peakmaxNone or float, optional

The maximum allowed peak pixel value in an object. Only objects whose maximum pixel values are strictly smaller than peakmax will be selected. This may be used to exclude saturated sources. If set to None, all objects will be selected.


StarFinder automatically excludes objects whose maximum pixel values are negative. Therefore, setting peakmax to a non-positive value would result in excluding all objects.


For the convolution step, this routine sets pixels beyond the image borders to 0.0.

The source properties are calculated using image moments.

Methods Summary

__call__(data[, mask])

Call self as a function.

find_stars(data[, mask])

Find stars in an astronomical image.

Methods Documentation

__call__(data, mask=None)

Call self as a function.

find_stars(data, mask=None)[source]

Find stars in an astronomical image.

data2D array_like

The 2D image array.

mask2D bool array, 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 searching for stars.

tableQTable or None

A table of found objects with the following parameters:

  • id: unique object identification number.

  • xcentroid, ycentroid: object centroid.

  • fwhm: object FWHM.

  • roundness: object roundness.

  • pa: object position angle (degrees counter clockwise from the positive x axis).

  • max_value: the maximum pixel value in the source

  • flux: the source instrumental flux.

  • mag: the source instrumental magnitude calculated as -2.5 * log10(flux).

None is returned if no stars are found or no stars meet the roundness and peakmax criteria.