StarFinder#

class photutils.detection.StarFinder(threshold, kernel, min_separation=None, exclude_border=False, n_brightest=None, peak_max=None)[source]#

Bases: StarFinderBase

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

Parameters:
thresholdfloat or 2D ndarray

The absolute image value above which to select sources. If threshold is a 2D array, it must have the same shape as the input data. If the star finder is run on an image that is a Quantity array, then threshold must have the same units.

kernelndarray

A 2D array of the PSF kernel.

min_separationNone or float, optional

The minimum separation (in pixels) for detected objects. If None (default) then the minimum separation is set to 2.5 * (min(kernel.shape) // 2). Note that large values may result in long run times.

Changed in version 3.0: The default min_separation changed from 5 to 2.5 * (min(kernel.shape) // 2). To recover the previous behavior, set min_separation=5.

exclude_borderbool, optional

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

n_brightestint, None, optional

The number of brightest objects to keep after sorting the source list by flux. If n_brightest is set to None, all objects will be selected.

peak_maxfloat, None, optional

The maximum allowed peak pixel value in an object. Objects with peak pixel values greater than peak_max will be rejected. This keyword may be used, for example, to exclude saturated sources. If the star finder is run on an image that is a Quantity array, then peak_max must have the same units. If peak_max is set to None, then no peak pixel value filtering will be performed.

Notes

If the star finder is run on an image that is a Quantity array, then threshold and peak_max must all have the same units as the image.

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])

Find stars in an astronomical image.

find_stars(data[, mask])

Find stars in an astronomical image.

Methods Documentation

__call__(data, mask=None)#

Find stars in an astronomical image.

Parameters:
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.

Returns:
tableTable or None

A table of found stars. If no stars are found then None is returned.

find_stars(data, mask=None)[source]#

Find stars in an astronomical image.

Parameters:
data2D array_like

The 2D image array. The image should be background-subtracted.

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.

Returns:
tableQTable or None

A table of found objects with the following parameters:

  • id: unique object identification number.

  • x_centroid, y_centroid: object centroid.

  • fwhm: object FWHM.

  • roundness: object roundness.

  • orientation: the angle between the x axis and the major axis source measured counter-clockwise in the range [0, 360) degrees.

  • 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 peak_max criteria.