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:
StarFinderBaseDetect 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;thresholdis applied to a convolved image) and have a size and shape similar to the defined 2D Gaussian kernel. The Gaussian kernel is defined by thefwhm,ratio,theta, andsigma_radiusinput parameters.DAOStarFinderfinds 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)dataimage.DAOStarFindercalculates the object roundness using two methods. Theroundness_rangebounds are applied to both measures of roundness. The first method (roundness1; calledSROUNDin 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; calledGROUNDin 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
thresholdis a 2D array, it must have the same shape as the inputdata. If the star finder is run on an image that is aQuantityarray, thenthresholdmust have the same units.By default,
thresholdis 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. Setscale_threshold=Falseto 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.
ratiomust 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
Trueto exclude sources found within half the size of the convolution kernel from the image borders. The default isFalse, 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_brightestis set toNone, 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_maxwill be rejected. This keyword may be used, for example, to exclude saturated sources. If the star finder is run on an image that is aQuantityarray, thenpeak_maxmust have the same units. Ifpeak_maxis set toNone, then no peak pixel value filtering will be performed.- xycoords
Noneor Nx2ndarray, optional The (x, y) pixel coordinates of the approximate centroid positions of identified sources. If
xycoordsare input, the algorithm will skip the source-finding step.- min_separation
Noneor float, optional The minimum separation (in pixels) for detected objects. If
None(default) then the minimum separation is calculated as2.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_separationchanged from 0 to2.5 * fwhm. To recover the previous behavior, setmin_separation=0.- scale_thresholdbool, optional
If
True(default), the inputthresholdis multiplied by the kernel relative error before being applied to the convolved data. This is the behavior of the original DAOFIND algorithm. IfFalse, the inputthresholdis 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. IfNone, 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. Bothroundness1androundness2are tested against this range. IfNone, no roundness filtering is performed. The default is(-1.0, 1.0).
- thresholdfloat or 2D
See also
Notes
If the star finder is run on an image that is a
Quantityarray, thenthresholdandpeak_maxmust 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'andconstant=0.0.The main differences between
DAOStarFinderandIRAFStarFinderare:IRAFStarFinderalways uses a 2D circular Gaussian kernel, whileDAOStarFindercan use an elliptical Gaussian kernel.IRAFStarFindercalculates the objects’ centroid, roundness, and sharpness using image moments.
References
[1]Stetson, P. 1987; PASP 99, 191 (https://ui.adsabs.harvard.edu/abs/1987PASP…99..191S/abstract)
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 aTruevalue indicates the corresponding element ofdatais masked. Masked pixels are ignored when searching for stars.
- Returns:
- 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 aTruevalue indicates the corresponding element ofdatais masked. Masked pixels are ignored when searching for stars.
- Returns:
- table
QTableorNone A table of found stars.
Noneis 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.
- table