>  Docs Center  >  Libraries  >  ASTROLIB  >  CNTRD






      Compute the centroid of a star using a derivative search


      CNTRD uses an early DAOPHOT "FIND" centroid algorithm by locating the
      position where the X and Y derivatives go to zero. This is usually a
      more "robust" determination than a "center of mass" or fitting a 2d
      Gaussian if the wings in one direction are affected by the presence
      of a neighboring star.

Calling Sequence

      CNTRD, img, x, y, xcen, ycen, [ fwhm , /KEEPCENTER, /SILENT, /DEBUG
                                      EXTENDBOX = ]


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

Optional Input

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


      XCEN - the computed X centroid position, same number of points as X
      YCEN - computed Y centroid position, same number of points as Y,
              floating point
      Values for XCEN and YCEN will not be computed if the computed
      centroid falls outside of the box, or if the computed derivatives
      are non-decreasing. If the centroid cannot be computed, then a
      message is displayed and XCEN and YCEN are set to -1.

Optional Output Keywords

      /SILENT - Normally CNTRD prints an error message if it is unable
              to compute the centroid. Set /SILENT to suppress this.
      /DEBUG - If this keyword is set, then CNTRD will display the subarray
              it is using to compute the centroid.
      EXTENDBOX = {non-negative positive integer}. CNTRD searches a box with
              a half width equal to 1.5 sigma = 0.637* FWHM to find the
              maximum pixel. To search a larger area, set EXTENDBOX to
              the number of pixels to enlarge the half-width of the box.
              Default is 0; prior to June 2004, the default was EXTENDBOX= 3
      /KeepCenter = By default, CNTRD 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 then step of finding the maximum pixel, and instead use
              a box centered on the input X,Y coordinates.


      Maximum pixel within distance from input pixel X, Y determined
      from FHWM is found and used as the center of a square, within
      which the centroid is computed as the value (XCEN,YCEN) at which
      the derivatives of the partial sums of the input image over (y,x)
      with respect to (x,y) = 0. In order to minimize contamination from
      neighboring stars stars, a weighting factor W is defined as unity in
      center, 0.5 at end, and linear in between


      (1) Does not recognize (bad) pixels. Use the procedure GCNTRD.PRO
          in this situation.
      (2) DAOPHOT now uses a newer algorithm (implemented in GCNTRD.PRO) in
          which centroids are determined by fitting 1-d Gaussians to the
          marginal distributions in the X and Y directions.
      (3) The default behavior of CNTRD changed in June 2004 (from EXTENDBOX=3
          to EXTENDBOX = 0).
      (4) Stone (1989, AJ, 97, 1227) concludes that the derivative search
          algorithm in CNTRD is not as effective (though faster) as a
            Gaussian fit (used in GCNTRD.PRO).

Modification History

      Written 2/25/86, by J. K. Hill, S.A.S.C., following
      algorithm used by P. Stetson in DAOPHOT.
      Allowed input vectors G. Hennessy April, 1992
      Fixed to prevent wrong answer if floating pt. X & Y supplied
              W. Landsman March, 1993
      Convert byte, integer subimages to float W. Landsman May 1995
      Converted to IDL V5.0 W. Landsman September 1997
      Better checking of edge of frame David Hogg October 2000
      Avoid integer wraparound for unsigned arrays W.Landsman January 2001
      Handle case where more than 1 pixel has maximum value W.L. July 2002
      Added /KEEPCENTER, EXTENDBOX (with default = 0) keywords WL June 2004
      Some errrors were returning X,Y = NaN rather than -1,-1 WL Aug 2010

© 2023 NV5 Geospatial |  Legal
My Account    |    Contact Us