%N pkfit %F $MIR/src/subs/pkfit.for
%D Fit to the location of the peak pixel.
%: 
%P rjs
%B
      subroutine pkfit(z, width, zmax, pix, c)
      implicit none

      integer width
      real z(width,width), c(6), zmax
      double precision pix(2)

  Fit a parabola to the function in Z.

  Input:
    Width      Width of the support of Z.
    Z          Function values.

  Output:
    C          Coefficients of the fit.
    zmax       Estimated max value of the function.
    pix        Location, relative to the central pixel, of the maximum
