NAME:
  edgefit
 PURPOSE:
  Fit an edge between two signal levels
 DESCRIPTION:
 CATEGORY:
  Function fitting
 CALLING SEQUENCE:
  edgefit,x,y,err,xedge,xedgesig
 INPUTS:
  x - independent variable (vector)
  y - dependent variable (vector)
  err - uncertainties on y
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  Two plots are generated and the fitted values are printed to the screen.
  xedge - 3 element vector:
              0 - signal level on the left of the edge
              1 - signal level on the right of the edge
              2 - the x value of where the edge is
  xedgesig - 1-sigma uncertainty on the values in xedge
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
  Assumes data are strictly uniform in x (spacing does not vary).
 PROCEDURE:
 MODIFICATION HISTORY:
  1996/12/23, Written by Marc W. Buie, Lowell Observatory
  2017/01/19, MWB, many rewrites, may sort of work now but still a bit
                 fragile or non-general.  Use with extreme caution.