Name
peak - peak measurements
Synopsis
peak [options] image.fits [...]
Description
peak detects localizes bright object centroids in an
image. It takes as argument a list of FITS cube names and
outputs on stdout the center of each detected bright zone,
an estimation of FWHM in x and y, an average FWHM, a flux
estimation, and the minimum and maximum pixel values
around each object.
Bright objects are detected if and only if they contain a
peak of sufficient amplitude i.e. more than K deviations
above the median image value, AND if they cover a surface
at least of 3x3 pixels. To detect peaks located in a win-
dow smaller than 3x3, there is an option to smear out the
image by a low-pass filter before applying peak detection,
but of course it has associated drawbacks.
By default, peak will be looking at all the signal which
is more than 2 deviations above the median pixel value.
This value can be changed using the -t (or --thresh)
option.
Notice that this is not more than kappa-sigma clipping for
signal detection, except that to avoid mis-estimation of
the mean and sigma in crowded fields, the measurements are
done with the median and a deviation which is the average
absolute distance to the median.
In spite of calls to morphological filters, peak is sur-
prisingly faster than other usual algorithms. It should be
used as a peak position estimator more than a precise
locator, though.
Algorithms
If smearing is activated, the input image is smeared out
with a low-pass 5x5 filter before detection is applied.
This filtered version of the input image is only used for
detection purposes, and not for any kind of later measure-
ment.
peak creates first a binary map of all pixel positions
which have a value above a given threshold (by default,
median plus 2 deviations).
A binary morphological erosion, and a dilation are then
performed on the binary map to close all regions smaller
than 3x3, which removes all isolated bad pixels. If smear-
ing was applied, small objects would have been enlarged to
bigger than 3x3 and appear in the resulting pixel map.
A floodfill algorithm is applied to find the geometric
center of all white blobs, weighted by pixel values taken
from the original image.
If fine positioning is activated (-f or --finepos option),
a subsequent process is called, which requests 3 user-
defined radiuses in pixels: r1, r2, and r3. For each found
peak position in the image, a background is computed as
the median pixel value in the ring centered on the esti-
mated peak position, of radiuses r2 and r3. Then a
barycenter is computed within the disk centered on the
same spot, of radius r1, using background-subtracted pixel
values as weights. This fine positioning method proves
quite reliable, but requires all peaks in the image to
have more or less the same size to fit into the circles
defined by r1, r2, r3.
Options
-t cut or --thresh cut
Use this option to change the cut level in a factor
of deviations. The lower this value, the more
bright zones may be detected. The higher this fac-
tor is, the less detected peaks. The default of 2.0
seems to work fine on images having a high Signal
to Noise Ratios.
-f 'r1 r2 r3' or --finepos 'r1 r2 r3'
Fine positioning: provide three values r1 < r2 <
r3. The radiuses r2 and r3 specify a ring around
each detected point, from which an estimation of
the background is computed. A barycenter is then
computed in the disk of radius r1, using back-
ground-subtracted pixel values as weights. No
defaults are given to these parameters.
Be aware when using this position refining that it
assumes the following conditions.
All peaks are isolated, i.e. the closest distance between
2 peaks is strictly greater than 2 * r3.
There is a background zone around every peak, always
within the disk defined by r2 and r3. Otherwise, the back-
ground estimation is contaminated with peak signals.
All peaks are contained in a disk of radius r1.
-S or --smear
This option (low-pass filter) applies a 5x5 convo-
lution with a flat kernel before trying to detect
objects. The smearing is h.PPful to detect objects
which are smaller than a 3x3 window. It increases
the number of detections, but also the number of
false detections. Bad pixels, for example, are
smeared out to a 5x5 window and detected as proper
peaks. Another issue is that 2 close peaks will be
smeared out to a single one. Most probably, the
returned result will be a barycenter of the 2
regions instead of the 2 expected centers. Because
the smearing will lower the signal in all regions,
the default sigma cut is halved when this options
is used.
-b or --box halfsize
Changes the computation box half-size for FWHM (see
'fwhm').
-p or --pixel size
Declares how much the size of a pixel is in arcsec-
onds. This allows to get the FWHM measurements in
arcseconds instead of pixels.
-r or --radius 'r1 r2 r3'
Provides the radiuses used to compute photometry.
-u or --unit pixel|arcsec
Specifies units for the radiuses provided with -r
option.
See Also
detpeak, fwhm, photfits
Bugs
Peaks located on an image edge will not be detected.