Description

The imcollapse collapses an image along a specified axis or set of axes of N pixels to a single pixel on each specified axis. Both float valued and complex valued images are supported. It computes the specified aggregate function for pixel values along the specified axes and places those values in the single remaining plane of those axes in the output image. It returns an image analysis tool containing the newly created collapsed image if wantreturn=True. Choices of aggregate functions are: flux (see below for constraints), max, mean, median, min, rms, stdev, sum, variance. Minimal unique match is supported for the function parameter (eg, function="r" will compute the rms of the pixel values, "med" will compute the median).

If one specifies function='flux', the following constraints must be true:

  1. The image must have a direction coordinate,
  2. The image must have at least one beam,
  3. The specified axes must be exactly the direction coordinate axes,
  4. Only one of the non-directional axes may be non-degenerate,
  5. The image brightness unit must be conformant with x*yJy/beam, where x is an optional unit (such as km/s for moments images) and y is an optional SI prefix.                                                                                                                                                   

Axes can be specified as a single integer or array of integers indicating the zero-based axes along which to collapse the image. Axes may also be specified as a single or array of strings which minimally and uniquely match (ignoring case) world axes names in the image (eg "dec" or ["ri, "d"] for collapsing along the declination axis or along the right ascension and declination axes, respectively).

The reference pixel of the collapsed axis is set to 0 and its reference value is set to the mean of the the first and last values of that axis in the specified region of the input image.