NAME:
	phasebin
 PURPOSE: (one line)
	Compute a phase binned average lightcurve
 DESCRIPTION:
	This routine bins lightcurve data as a function of time into a
	binned composite lightcurve.  Bins with no data are not returned.
 CATEGORY:
       Photometry
 CALLING SEQUENCE:
	phasebin,t,x0,sigx0,t0,period,nbins,rotphase,x,sig
 INPUTS:
	t     - independent variable (usually time)
	x0    - dependent variable (usually magnitude or intensity)
	sigx0 - Uncertainty on x.
	t0    - Reference time for 0 phase.
	period- Rotational period to use when binning (same units as t).
	nbins - Number of bins to break rotation into.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	rotphase - Rotational phase for composite lightcurve.
	x        - composite lightcurve.
	sig      - Standard deviation of the mean in each bin.
	chi2     - Goodness of fit to data within bin.
	pop      - Number of points in each bin.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written 1992 Apr 22, by Marc W. Buie, Lowell Observatory
  2000/11/08, MWB, removed use of obsolete ()