NAME:
  pdm2
 PURPOSE: (one line)
  Period search by phase dispersion minimization ($\chi^2$ based)
 DESCRIPTION:
  This routine computes a Chi^2 statistic for period searching
  in time-series data loosely based on the technique described by
  Stellingwerf, ApJ, 224, pp. 953-960 (1978).

  This algorithm is discused more in Buie and Bus, Icarus, 100, 288-294
  (1992) "Physical Observations of (5145) Pholus".

 CATEGORY:
  Photometry
 CALLING SEQUENCE:
  pdm2,t,x0,sigx0,freq1,freq2,dfreq,freq,period,chi2
 INPUTS:
  t     - independent variable (usually time)
  x0    - dependent variable (usually magnitude or intensity)
  sigx0 - Uncertainty on x.
  freq1 - Lower limit to frequency to compute statistic  (units=[1/t])
  freq2 - Upper limit to frequency to compute statistic  (units=[1/t])
  dfreq - Frequency interval.  (units=[1/t])
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
  NBINS - Number of bins (default = 80)
  SILENT - Flag, if set, inhibits all printed output.
 OUTPUTS:
  freq   - Frequency vector.
  period - inverse frequency.
  chi2   - Chi^2 statistic.
  avgyes  - Average number of points contained within non-empty bins.
  nempty  - Total number of empty bins.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 1992 Feb 11, by Marc W. Buie, Lowell Observatory
  94/08/26 - MWB - added NBINS keyword
  94/10/04 - MWB - moved cr to front of print statement (v3.6 bug workaround)
  96/07/01 - MWB - added SILENT keyword