In addition, the weights associated with each output pixel are returned. The weight of an output pixel indicates the number of input pixels which have been accumulated in that output pixel. If the entire value of an input pixel is assigned to a single output pixel, then the weight of that output pixel is incremented by one. If some fraction of the value of an input pixel is assigned to an output pixel, then the weight of that output pixel is incremented by the fraction used.
The start of a new sequence is indicated by specifying the AST__REBININIT flag via the FLAGS argument. This causes the supplied arrays to be filled with zeros before the rebinned input data is added into them. Subsequenct invocations within the same sequence should omit the AST__REBININIT flag.
The last call in a sequence is indicated by specifying the AST__REBINEND flag. This causes the output data and variance arrays to be normalised before being returned. This normalisation consists of dividing the data array by the weights array, and can eliminate artifacts which may be introduced into the rebinned data as a consequence of aliasing between the input and output grids. However, it can also result in small changes to the total pixel value in any given area of the output array. In addition to normalisation of the output data values, any output variances are also appropriately normalised, and any output data values with weight less than WLIM are set to BADVAL.
Output variances can be generated in two ways; by rebinning the supplied input variances with appropriate weights, or by finding the spread of input data values contributing to each output pixel (see the AST__GENVAR and AST__USEVAR flags).
The number of input coordinates used by this Mapping (as given by its Nin attribute) should match the number of input grid dimensions given by the value of NDIM_IN below. Similarly, the number of output coordinates (Nout attribute) should match the number of output grid dimensions given by NDIM_OUT.
Note that LBND_IN and UBND_IN together define the shape
and size of the input grid, its extent along a particular
(J'th) dimension being UBND_IN(J)-LBND_IN(J)1. They also define
the input grid's coordinate system, each pixel having unit
extent along each dimension with integral coordinate values
at its centre.
The storage order of data within this array should be such that the index of the first grid dimension varies most rapidly and that of the final dimension least rapidly (i.e. normal Fortran array storage order).
If no additional parameters are required, this array is not used. A dummy (e.g. one-element) array may then be supplied.
If piece-wise linear approximation is not required, a value of zero may be given. This will ensure that the Mapping is used without any approximation, but may increase execution time.
If the value is too high, discontinuities between the linear approximations used in adjacent panel will be higher, and may cause the edges of the panel to be visible when viewing the output image at high contrast. If this is a problem, reduce the tolerance value used.
If a smaller value is used, the input region will first be divided into sub-regions whose size does not exceed MAXPIX pixels in any dimension. Only at this point will attempts at approximation commence.
This value may occasionally be useful in preventing false convergence of the adaptive algorithm in cases where the Mapping appears approximately linear on large scales, but has irregularities (e.g. holes) on smaller scales. A value of, say, 50 to 100 pixels can also be employed as a safeguard in general-purpose software, since the effect on performance is minimal.
If too small a value is given, it will have the effect of inhibiting linear approximation altogether (equivalent to setting TOL to zero). Although this may degrade performance, accurate results will still be obtained.
If the AST__USEBAD flag is set via the FLAGS argument, then this value is used to test for bad pixels in the IN (and IN_VAR) array(s).
In all cases, this value is also used to flag any output elements in the OUT (and OUT_VAR) array(s) for which rebined values could not be obtained (see the "Propagation of Missing Data" section below for details of the circumstances under which this may occur).
Note that LBND_OUT and UBND_OUT together define the shape, size and coordinate system of the output grid in the same way as LBND_IN and UBND_IN define the shape, size and coordinate system of the input grid.
Note that LBND and UBND together define the shape and position of a (hyper-)rectangular region of the input grid which is to be included in the rebined output array. This region should lie wholly within the extent of the input grid (as defined by the LBND_IN and UBND_IN arrays). Regions of the input grid lying outside this region will not be used.
Note that, unlike
AST_RESAMPLEX
, the AST_REBINSEQ
X
set of functions does not yet support unsigned integer data types
or integers of different sizes.
An input pixel is considered bad (and is consequently ignored) if its data value is equal to BADVAL and the AST__USEBAD flag is set via the FLAGS argument.
In addition, associated output variance estimates (if calculated) may be declared bad and flagged with the BADVAL value in the OUT_VAR array for similar reasons.
AST A Library for Handling World Coordinate Systems in Astronomy