Name
       average - cube averaging

Synopsis
       average [options] [parameters]

Description
       average  reduces  a FITS cube over its third dimension, by
       applying one  of  several  possible  algorithms  described
       below.  Users  should  specify a cut and a method. The cut
       describes how planes in the input  cube  are  grouped  for
       averaging,  the  method  specifies what kind of average is
       applied.

Parameters
       -i <incube> or --in <incube>
              Specifies the name of the input cube (mandatory).

       -o <outcube> or --out <outcube>
              Specifies the name of the output  cube  (optional).
              Default   output  name  for  an  input  cube  named
              incube.fits is incube.avg.fits.

Options
       Cuts

       Cuts specify how to group the input planes  to  apply  the
       average. Default cut is --cut whole.

       --cut whole
              applies  the  average  on  the whole cube, i.e. all
              planes are averaged to a single  one  according  to
              the requested method.

       --cut cycle --step <n>
              applies  the  average  for  every <n> planes in the
              input cube. For example, if the input cube contains
              50  planes and this cut is specified with n=10, the
              planes will be averaged 10 by  10  to  produce  one
              cube in output containing 5 planes.

       --cut running --halfwidth <h>
              Performs  a  running  average: the output is a cube
              containing as many planes as the input  cube.  Each
              plane  is the result of an average over an interval
              centered on the same plane in the  input,  plus  or
              minus  <h>  planes.  This means that central planes
              will be the average of 2h+1 input planes, and  edge
              planes  will  be an average of between h+1 and 2h+1
              input planes.

       Example: the input cube has 6 planes, h=2.  Brackets  show
       where the central plane is at each iteration.

       Output plane 1 is averaged from input planes [1],2,3
       Output plane 2 is averaged from input planes 1,[2],3,4
       Output plane 3 is averaged from input planes 1,2,[3],4,5
       Output plane 4 is averaged from input planes 2,3,[4],5,6
       Output plane 5 is averaged from input planes 3,4,[5],6
       Output plane 6 is averaged from input planes 4,5,[6]

       Methods

       Methods  specify  how  to  perform the average. Default is
       linear.

       --method linear
              Performs a normal,  linear  average  of  the  input
              planes.

       --method sum
              Same  as  linear, but does not divide by the number
              of averaged planes at the  end.  Useful  for  cubes
              which do not have much signal.

       --method median
              Median filtering along the z-axis.

       --method filtered
              with  additional  parameters  --filt-low percentage
              and --filt-high percentage.  This  is  actually  an
              extension  of  the  median  average. A time line is
              extracted for each pixel position on  the  detector
              (along the z-axis), and then sorted out. The median
              average would only keep the central value,  whereas
              this  method  requests two percentages. They corre-
              spond to a proportion of low  and  high  values  to
              reject,  once  the  time  line has been sorted out.
              Pixels remaining after rejection are linearly aver-
              aged.   The  sum of both percentages may not exceed
              90%.

       Other options

       See eclipse-commands for generic options.

Files
       Input files shall all comply with FITS format.

       The original FITS header  of the first given FITS file  on
       command  line is conserved along, except for the following
       keywords: NAXIS, NAXISn, BITPIX, BSCALE, BZERO, which  are
       related to the newly created file.

       HISTORY  keywords are appended to the FITS header to indi-
       cate the eclipse process modifications.

See Also
       shiftadd

Bugs
       It is not yet possible to combine  a  running  filter  cut
       with a filtered average method.