DAOStarFinder¶
- class photutils.detection.DAOStarFinder(threshold, fwhm, ratio=1.0, theta=0.0, sigma_radius=1.5, sharplo=0.2, sharphi=1.0, roundlo=-1.0, roundhi=1.0, sky=0.0, exclude_border=False, brightest=None, peakmax=None, xycoords=None, min_separation=0.0)[source]¶
Bases:
StarFinderBase
Detect stars in an image using the DAOFIND (Stetson 1987) algorithm.
DAOFIND (Stetson 1987; PASP 99, 191) 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 thefwhm
,ratio
,theta
, andsigma_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. Theroundlo
androundhi
bounds are applied to both measures of roundness. The first method (roundness1
; calledSROUND
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
; calledGROUND
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
The absolute image value above which to select sources. If the star finder is run on an image that is a
Quantity
array, thenthreshold
must have the same units.- 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) [
1 sigma = FWHM / (2.0*sqrt(2.0*log(2.0)))
].- sharplofloat, optional
The lower bound on sharpness for object detection.
- sharphifloat, optional
The upper bound on sharpness for object detection.
- roundlofloat, optional
The lower bound on roundness for object detection.
- roundhifloat, optional
The upper bound on roundness for object detection.
- skyfloat or
Quantity
, optional Deprecated since version 1.13.0.
The background sky level of the image. Setting
sky
affects only the output values of the objectpeak
,flux
, andmag
values. The default is 0.0, which should be used to replicate the results from DAOFIND. If the star finder is run on an image that is aQuantity
array, thensky
must have the same units.- exclude_borderbool, optional
Set to
True
to 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.- brightestint, None, optional
The number of brightest objects to keep after sorting the source list by flux. If
brightest
is set toNone
, all objects will be selected.- peakmaxfloat, None, optional
The maximum allowed peak pixel value in an object. Only objects whose peak pixel values are strictly smaller than
peakmax
will be selected. This may be used, for example, to exclude saturated sources. If the star finder is run on an image that is aQuantity
array, thenpeakmax
must have the same units. Ifpeakmax
is set toNone
, then no peak pixel value filtering will be performed.- xycoords
None
or Nx2ndarray
, 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_separationfloat, optional
The minimum separation (in pixels) for detected objects. Note that large values may result in long run times.
See also
Notes
If the star finder is run on an image that is a
Quantity
array, thenthreshold
,sky
, andpeakmax
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 equivalent parameters in DAOFIND are
boundary='constant'
andconstant=0.0
.The main differences between
DAOStarFinder
andIRAFStarFinder
are:IRAFStarFinder
always uses a 2D circular Gaussian kernel, whileDAOStarFinder
can use an elliptical Gaussian kernel.IRAFStarFinder
calculates 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])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.
- 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 aTrue
value indicates the corresponding element ofdata
is masked. Masked pixels are ignored when searching for stars.
- Returns:
- table
QTable
orNone
A table of found stars with the following parameters:
id
: unique object identification number.xcentroid, ycentroid
: object centroid.sharpness
: object sharpness.roundness1
: object roundness based on symmetry.roundness2
: object roundness based on marginal Gaussian fits.npix
: the total number of pixels in the Gaussian kernel array.sky
: the inputsky
parameter.peak
: the peak, sky-subtracted, pixel value of the object.flux
: the object DAOFind “flux” calculated as the peak density in the convolved image divided by the detection threshold. This derivation matches that of DAOFIND ifsky
is 0.0.mag
: the object instrumental magnitude calculated as-2.5 * log10(flux)
. The derivation matches that of DAOFIND ifsky
is 0.0.
None
is returned if no stars are found.
- table