DAOStarFinder#

class photutils.detection.DAOStarFinder(threshold, fwhm, ratio=1.0, theta=0.0, sigma_radius=1.5, sharplo=<deprecated>, sharphi=<deprecated>, roundlo=<deprecated>, roundhi=<deprecated>, exclude_border=False, n_brightest=None, peak_max=None, xycoords=None, min_separation=None, scale_threshold=True, *, sharpness_range=(0.2, 1.0), roundness_range=(-1.0, 1.0))[source]#

Bases: StarFinderBase

Detect stars in an image using the DAOFIND (Stetson 1987) algorithm.

DAOFIND searches images for local density maxima that have a peak amplitude greater than threshold (approximately; threshold is applied to a convolved image) and have a size and shape similar to the defined 2D Gaussian kernel. The Gaussian kernel is defined by the fwhm, ratio, theta, and sigma_radius input parameters.

DAOStarFinder finds the object centroid by fitting the marginal x and y 1D distributions of the Gaussian kernel to the marginal x and y distributions of the input (unconvolved) data image.

DAOStarFinder calculates the object roundness using two methods. The roundness_range bounds are applied to both measures of roundness. The first method (roundness1; called SROUND in DAOFIND) is based on the source symmetry and is the ratio of a measure of the object’s bilateral (2-fold) to four-fold symmetry. The second roundness statistic (roundness2; called GROUND in DAOFIND) measures the ratio of the difference in the height of the best fitting Gaussian function in x minus the best fitting Gaussian function in y, divided by the average of the best fitting Gaussian functions in x and y. A circular source will have a zero roundness. A source extended in x or y will have a negative or positive roundness, respectively.

The sharpness statistic measures the ratio of the difference between the height of the central pixel and the mean of the surrounding non-bad pixels in the convolved image, to the height of the best fitting Gaussian function at that point.

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.

By default, threshold is internally scaled by a factor derived from the Gaussian kernel, so the effective threshold applied to the convolved data may differ from the input value. Set scale_threshold=False to apply the value exactly as given.

fwhmfloat

The full-width half-maximum (FWHM) of the major axis of the Gaussian kernel in units of pixels.

ratiofloat, optional

The ratio of the minor to major axis standard deviations of the Gaussian kernel. ratio must be strictly positive and less than or equal to 1.0. The default is 1.0 (i.e., a circular Gaussian kernel).

thetafloat, optional

The position angle (in degrees) of the major axis of the Gaussian kernel measured counter-clockwise from the positive x axis.

sigma_radiusfloat, optional

The truncation radius of the Gaussian kernel in units of sigma (standard deviation) (\(\sigma = \mbox{FWHM} / (2 \sqrt{2 \log(2)})\)).

sharplofloat, optional

The lower bound on sharpness for object detection.

Deprecated since version 3.0: Use sharpness_range=(lower, upper) instead.

sharphifloat, optional

The upper bound on sharpness for object detection.

Deprecated since version 3.0: Use sharpness_range=(lower, upper) instead.

roundlofloat, optional

The lower bound on roundness for object detection.

Deprecated since version 3.0: Use roundness_range=(lower, upper) instead.

roundhifloat, optional

The upper bound on roundness for object detection.

Deprecated since version 3.0: Use roundness_range=(lower, upper) instead.

exclude_borderbool, optional

Set to True to exclude sources found within half the size of the convolution kernel from the image borders. The default is False, which is the mode used by DAOFIND.

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.

xycoordsNone or Nx2 ndarray, optional

The (x, y) pixel coordinates of the approximate centroid positions of identified sources. If xycoords are input, the algorithm will skip the source-finding step.

min_separationNone or float, optional

The minimum separation (in pixels) for detected objects. If None (default) then the minimum separation is calculated as 2.5 * fwhm. Set to 0 to disable minimum separation. Note that large values may result in long run times.

Changed in version 3.0: The default min_separation changed from 0 to 2.5 * fwhm. To recover the previous behavior, set min_separation=0.

scale_thresholdbool, optional

If True (default), the input threshold is multiplied by the kernel relative error before being applied to the convolved data. This is the behavior of the original DAOFIND algorithm. If False, the input threshold is used directly without any scaling.

sharpness_rangetuple of 2 floats or None, optional

The (lower, upper) inclusive bounds on sharpness for object detection. Objects with sharpness outside this range will be rejected. If None, no sharpness filtering is performed. The default is (0.2, 1.0).

roundness_rangetuple of 2 floats or None, optional

The (lower, upper) inclusive bounds on roundness for object detection. Objects with roundness outside this range will be rejected. Both roundness1 and roundness2 are tested against this range. If None, no roundness filtering is performed. The default is (-1.0, 1.0).

See also

IRAFStarFinder

Notes

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

For the convolution step, this routine sets pixels beyond the image borders to 0.0. The equivalent parameters in DAOFIND are boundary='constant' and constant=0.0.

The main differences between DAOStarFinder and IRAFStarFinder are:

  • IRAFStarFinder always uses a 2D circular Gaussian kernel, while DAOStarFinder can use an elliptical Gaussian kernel.

  • IRAFStarFinder calculates the objects’ centroid, roundness, and sharpness using image moments.

References

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 stars. None is returned if no stars are found. The table contains the following parameters:

  • id: unique object identification number.

  • x_centroid, y_centroid: object centroid.

  • sharpness: object sharpness.

  • roundness1: object roundness based on symmetry.

  • roundness2: object roundness based on marginal Gaussian fits.

  • n_pixels: the total number of pixels in the Gaussian kernel array.

  • peak: the peak pixel value of the object.

  • flux: the object instrumental flux calculated as the sum of data values within the kernel footprint.

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

  • daofind_mag: the “mag” parameter returned by the DAOFIND algorithm. It is a measure of the intensity ratio of the amplitude of the best fitting Gaussian function at the object position to the detection threshold. This parameter is reported only for comparison to the IRAF DAOFIND output. It should not be interpreted as a magnitude derived from an integrated flux.