﻿
>  Docs Center  >  Libraries  >  ASTROLIB  >  GCNTRD

GCNTRD

GCNTRD

## Purpose

Compute the stellar centroid by Gaussian fits to marginal X,Y, sums

## Explanation

GCNTRD uses the DAOPHOT "FIND" centroid algorithm by fitting Gaussians
to the marginal X,Y distributions. User can specify bad pixels
(either by using the MAXGOOD keyword or setting them to NaN) to be
ignored in the fit. Pixel values are weighted toward the center to
avoid contamination by neighboring stars.

## Calling Sequence

GCNTRD, img, x, y, xcen, ycen, [ fwhm , /SILENT, /DEBUG, MAXGOOD = ,
/KEEPCENTER ]

## Inputs

IMG - Two dimensional image array
X,Y - Scalar or vector integers giving approximate stellar center

## Optional Input

FWHM - floating scalar; Centroid is computed using a box of half
width equal to 1.5 sigma = 0.637* FWHM. GCNTRD will prompt
for FWHM if not supplied

## Outputs

XCEN - the computed X centroid position, same number of points as X
YCEN - computed Y centroid position, same number of points as Y
Values for XCEN and YCEN will not be computed if the computed
centroid falls outside of the box, or if there are too many bad pixels,
or if the best-fit Gaussian has a negative height. If the centroid
cannot be computed, then a message is displayed (unless /SILENT is
set) and XCEN and YCEN are set to -1.

## Optional Output Keywords

MAXGOOD= Only pixels with values less than MAXGOOD are used to in
Gaussian fits to determine the centroid. For non-integer
data, one can also flag bad pixels using NaN values.
/SILENT - Normally GCNTRD prints an error message if it is unable
to compute the centroid. Set /SILENT to suppress this.
/DEBUG - If this keyword is set, then GCNTRD will display the subarray
it is using to compute the centroid.
/KeepCenter By default, GCNTRD first convolves a small region around
the supplied position with a lowered Gaussian filter, and then
finds the maximum pixel in a box centered on the input X,Y
coordinates, and then extracts a new box about this maximum
pixel. Set the /KeepCenter keyword to skip the convolution
and finding the maximum pixel, and instead use a box
centered on the input X,Y coordinates.

## Procedure

Unless /KEEPCENTER is set, a small area around the initial X,Y is
convolved with a Gaussian kernel, and the maximum pixel is found.
This pixel is used as the center of a square, within
which the centroid is computed as the Gaussian least-squares fit
to the marginal sums in the X and Y directions.

## Example

Find the centroid of a star in an image im, with approximate center
631, 48. Assume that bad (saturated) pixels have a value of 4096 or
or higher, and that the approximate FWHM is 3 pixels.
IDL> GCNTRD, IM, 631, 48, XCEN, YCEN, 3, MAXGOOD = 4096

## Modification History

Written June 2004, W. Landsman following algorithm used by P. Stetson
in DAOPHOT2.
Modified centroid computation (as in IRAF/DAOFIND) to allow shifts of
more than 1 pixel from initial guess. March 2008
First perform Gaussian convolution prior to finding maximum pixel
to smooth out noise W. Landsman Jan 2009

© 2023 NV5 Geospatial |  Legal
My Account    |    Contact Us