% @(#)bin_tabl.hlq	19.1 (ESO-IPG) 02/25/03 13:19:15 
\se
SECTION./TABLE
\es\co
BIN/TABLE                                                       10-JAN-91 JEH
\oc\su
BIN/TABLE table col1 col2 [bin] [min] [max] [sigma]
	creates a table, bin.tbl with averages of col2 in bins of col1
\us\pu
Purpose:  
          Creates a table, bin.tbl with averages of col2 in bins of col1
\up\sy
Syntax:   
          BIN/TABLE table col1 col2 [bin] [min] [max] [sigma]
\ys\pa
          table     = name of table file
\ap\pa
          col1      = column to be binned (x-axis)
\ap\pa
          col2      = column to be averaged (y-axis)
\ap\pa
          bin       = if greater than zero: size of bin along col1
                      if less than zero   : number of points in single bin
\ap\pa
          min       = start-point of lowest bin, defaulted to minimum of col1
\ap\pa
          max       = end-point of highest bin, defaulted to maximum of col1
\ap\pa
          sigma     = points deviating more than sigma*standard_deviation
                      will be excluded.
\ap\no
Note:     
          If [min] is larger than [max], the binning happens in reverse
          order (only relevant if [bin]<0).
\\
          There is a hard limit to the maximum number of entries in the
          table (16000), and to the maximum number of bins (1024).
\\
          The program creates an output table: bin.tbl, tables already
          existing with this name will be overwritten!!!! (UNIX).
          The format of this table is:\\
            column 1: centre of bin\\
            column 2: average of col2 in bin\\
            column 3: standard deviation in the mean\\
            column 4: width of distribution\\
            column 5: number of points in bin\\
\\
          If [sigma] is specified, the bins are not rearranged, so bins may
          contain less points than specified by [bin] (negative number).
\\
          bugs: none sofar (?).
\on\exs
Examples:
\ex
          BIN/TABLE mytable \#2 \#3 0.05 0.0 1.0
          Computes the averages of \#3 in bins of 0.05 in \#2, starting
          at 0.0 through 1.0
\xe\ex
          BIN/TABLE mytable \#2 \#3 -5 1.0 0.0
          The same as above, only now each bin contains 5 points. Binning
          starts at 1.0, so the bin at 0.0 may contain less than 5 points.
\xe\ex
          BIN/TABLE mytable \#2 \#3 -50 0.0 1.0 2
          Computes averages of \#3 in bins containing 50 points. Then
          points deviating more than 2 sigma are excluded, and average and
          s.d. are recomputed. This way bins may contain less than 50 points
\xe\sxe
