[SCM] Handle World Coordinate Systems in Astronomy branch, upstream, updated. 892fb8f11bce5453b78f993e0f644b876913e94c

Ole Streicher debian at liska.ath.cx
Fri Aug 17 13:18:23 UTC 2012


The following commit has been merged in the upstream branch:
commit 892fb8f11bce5453b78f993e0f644b876913e94c
Author: Ole Streicher <debian at liska.ath.cx>
Date:   Fri Aug 17 14:51:10 2012 +0200

    New upstream version 7.0.6

diff --git a/ast.news b/ast.news
index 917b3f8..848b800 100644
--- a/ast.news
+++ b/ast.news
@@ -1,6 +1,6 @@
 AST Library
 -----------
-   A new release (V7.0.5) of the Starlink AST (astrometry) library is
+   A new release (V7.0.6) of the Starlink AST (astrometry) library is
 now available.
 
    AST provides a comprehensive range of facilities for attaching
@@ -16,6 +16,15 @@ environment-independent.
 Main Changes in this Version
 ----------------------------
 
+- A bug has been fixed in astRebinSeq<X> which could result in
+incorrect normalisation of the final binned data and variance values.
+
+- When reading a FrameSet from a FITS-DSS header, the keywords CNPIX1 and
+CNPIX2 now default to zero if absent. Previously an error was reported.
+
+Main Changes in V7.0.5
+----------------------
+
 - The FitsChan class can now read FITS headers that use the SAO
 convention for representing distorted TAN projections, based on the use
 of "COi_j" keywords to hold the coefficients of the distortion polynomial.
diff --git a/configure b/configure
index 29db493..51fd52e 100755
--- a/configure
+++ b/configure
@@ -1,9 +1,9 @@
 #! /bin/sh
 # From configure.ac Revision.
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by Starlink Autoconf 2.59 for ast 7.0.5.
+# Generated by Starlink Autoconf 2.59 for ast 7.0.6.
 #
-# Report bugs to <ussc at star.rl.ac.uk>.
+# Report bugs to <starlink at jiscmail.ac.uk>.
 #
 # Copyright (C) 2003 Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
@@ -424,9 +424,9 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='ast'
 PACKAGE_TARNAME='ast'
-PACKAGE_VERSION='7.0.5'
-PACKAGE_STRING='ast 7.0.5'
-PACKAGE_BUGREPORT='ussc at star.rl.ac.uk'
+PACKAGE_VERSION='7.0.6'
+PACKAGE_STRING='ast 7.0.6'
+PACKAGE_BUGREPORT='starlink at jiscmail.ac.uk'
 
 ac_unique_file="ast_link.in"
 ac_default_prefix=/usr/local
@@ -980,7 +980,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures ast 7.0.5 to adapt to many kinds of systems.
+\`configure' configures ast 7.0.6 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1046,7 +1046,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of ast 7.0.5:";;
+     short | recursive ) echo "Configuration of ast 7.0.6:";;
    esac
   cat <<\_ACEOF
 
@@ -1102,7 +1102,7 @@ Some influential environment variables:
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
-Report bugs to <ussc at star.rl.ac.uk>.
+Report bugs to <starlink at jiscmail.ac.uk>.
 _ACEOF
 fi
 
@@ -1198,7 +1198,7 @@ fi
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-ast configure 7.0.5
+ast configure 7.0.6
 generated by Starlink Autoconf 2.59
 
 Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1212,7 +1212,7 @@ cat >&5 <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by ast $as_me 7.0.5, which was
+It was created by ast $as_me 7.0.6, which was
 generated by Starlink Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
@@ -1857,7 +1857,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='ast'
- VERSION='7.0.5'
+ VERSION='7.0.6'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -6184,9 +6184,9 @@ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## --------------------------------- ##
-## Report this to ussc at star.rl.ac.uk ##
-## --------------------------------- ##
+## -------------------------------------- ##
+## Report this to starlink at jiscmail.ac.uk ##
+## -------------------------------------- ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -21647,9 +21647,9 @@ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## --------------------------------- ##
-## Report this to ussc at star.rl.ac.uk ##
-## --------------------------------- ##
+## -------------------------------------- ##
+## Report this to starlink at jiscmail.ac.uk ##
+## -------------------------------------- ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -21799,9 +21799,9 @@ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## --------------------------------- ##
-## Report this to ussc at star.rl.ac.uk ##
-## --------------------------------- ##
+## -------------------------------------- ##
+## Report this to starlink at jiscmail.ac.uk ##
+## -------------------------------------- ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -25083,7 +25083,7 @@ _ASBOX
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by ast $as_me 7.0.5, which was
+This file was extended by ast $as_me 7.0.6, which was
 generated by Starlink Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -25146,7 +25146,7 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-ast config.status 7.0.5
+ast config.status 7.0.6
 configured by $0, generated by Starlink Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
diff --git a/configure.ac b/configure.ac
index c87fa21..f3ca313 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,7 +7,7 @@ dnl   1.5.  It should work with autoconf versions 2.50 or better, and
 dnl   automake 1.6 or better.
 
 dnl   Initialisation: package name and version number
-AC_INIT(ast, 7.0.5, ussc at star.rl.ac.uk)
+AC_INIT(ast, 7.0.6, starlink at jiscmail.ac.uk)
 
 dnl   Require autoconf-2.50 at least
 AC_PREREQ(2.50)
diff --git a/err_drama.c b/err_drama.c
index cf4dd65..3d165df 100644
--- a/err_drama.c
+++ b/err_drama.c
@@ -118,5 +118,5 @@ void astPutErr_( int status, const char *message ) {
    report the error message through EMS and to associate the error
    status with it. Ignore any returned status value. */
    local_status = status;
-   ErsRep( 0, &local_status, message );
+   ErsRep( 0, &local_status, "%s", message );
 }
diff --git a/fitschan.c b/fitschan.c
index 3e29e83..9631741 100644
--- a/fitschan.c
+++ b/fitschan.c
@@ -1038,6 +1038,11 @@ f     - AST_WRITEFITS: Write all cards out to the sink function
 *     26-JUN-2012 (DSB):
 *        Correct call to astKeyFields in SAOTrans (thanks to Bill Joye
 *        for pointing out this error).
+*     8-AUG-2012 (DSB):
+*        Correct assignment to lonpole within CLASSFromStore.
+*     10-AUG-2012 (DSB):
+*        Default DSS keywords CNPIX1 and CNPIX2 to zero if they are
+*        absent, rather than reporting an error.
 *class--
 */
 
@@ -5819,7 +5824,7 @@ static int CLASSFromStore( AstFitsChan *this, FitsStore *store,
    FITS-CLASS imposes a no rotation restriction, it can tolerate lonpole
    values of +/- 180 degrees. */
    if( ok && ( naxis2 != 1 || naxis3 != 1 ) ) {
-      lonpole =  GetItem( &(store->latpole), 0, 0, s, NULL, method, class, status );
+      lonpole =  GetItem( &(store->lonpole), 0, 0, s, NULL, method, class, status );
       if( lonpole != AST__BAD && lonpole != -180.0 && lonpole == 180 ) ok = 0;
       if( GetItem( &(store->latpole), 0, 0, s, NULL, method, class, status )
           != AST__BAD ) ok = 0;
@@ -8470,9 +8475,13 @@ static void DSSToStore( AstFitsChan *this, FitsStore *store,
 /* Check the inherited status. */
    if( !astOK ) return;
 
+/* Get the optional DSS keywords, supplying defaults for any missing keywords. */
+   cnpix1 = 0.0;
+   cnpix2 = 0.0;
+   GetValue( this, "CNPIX1", AST__FLOAT, &cnpix1, 0, 1, method, class, status );
+   GetValue( this, "CNPIX2", AST__FLOAT, &cnpix2, 0, 1, method, class, status );
+
 /* Get the required DSS keywords. Report an error if any are missing. */
-   GetValue( this, "CNPIX1", AST__FLOAT, &cnpix1, 1, 1, method, class, status );
-   GetValue( this, "CNPIX2", AST__FLOAT, &cnpix2, 1, 1, method, class, status );
    GetValue( this, "PPO3", AST__FLOAT, &ppo3, 1, 1, method, class, status );
    GetValue( this, "PPO6", AST__FLOAT, &ppo6, 1, 1, method, class, status );
    GetValue( this, "XPIXELSZ", AST__FLOAT, &xpixelsz, 1, 1, method, class, status );
diff --git a/mapping.c b/mapping.c
index 454aa48..251a5f3 100644
--- a/mapping.c
+++ b/mapping.c
@@ -309,6 +309,17 @@ f     - AST_TRANN: Transform N-dimensional coordinates
 *        performed, if set to "1" NaNs are changed to AST__BAD but no
 *        error is reported, if set to anything else NaNs are changed to
 *        AST__BAD and an error is reported.
+*     6-JUL-2012 (DSB):
+*        The astRebinSeq<X> family was normalising the returned data and
+*        variances values incorrectly, when the AST__REBINEND flag was
+*        supplied. The exact size of the error depended on the nature of
+*        the Mapping and the spreading method, and so is hard to predict.
+*     20-JUL-2012 (DSB):
+*        Major re-structuring of astRebinSeq<X> to add further
+*        corrections to the normalisation. The model is now that each
+*        input array is first rebinned and then scaled to preserve the
+*        total data sum, and then each final output pixel is the weighed
+*        mean of all the aligned rebinned  pixels.
 *class--
 */
 
@@ -561,17 +572,17 @@ static void SpreadKernel1##X( AstMapping *, int, const int *, const int *, \
                          const Xtype *, const Xtype *, int, const int *, \
                          const double *const *, \
                          void (*)( double, const double *, int, double *, int * ), \
-                         int, const double *, int, Xtype, int, Xtype *, \
+                         int, const double *, int, Xtype, int, double *, Xtype *, \
                          Xtype *, double *, int *, int * ); \
 \
 static void SpreadLinear##X( int, const int *, const int *, const Xtype *, \
                              const Xtype *, int, const int *, const double *const *, \
-                             int, Xtype, int, Xtype *, Xtype *, double *, int *, \
+                             int, Xtype, int, double *, Xtype *, Xtype *, double *, int *, \
                              int * ); \
 \
 static void SpreadNearest##X( int, const int *, const int *, const Xtype *, \
                               const Xtype *, int, const int *, const double *const *, \
-                              int, Xtype, int, Xtype *, Xtype *, double *, \
+                              int, Xtype, int, double *, Xtype *, Xtype *, double *, \
                               int *, int * );
 
 DECLARE_GENERIC(D,double)
@@ -642,9 +653,10 @@ static void Gauss( double, const double [], int, double *, int * );
 static void GlobalBounds( MapData *, double *, double *, double [], double [], int * );
 static void Invert( AstMapping *, int * );
 static void MapBox( AstMapping *, const double [], const double [], int, int, double *, double *, double [], double [], int * );
-static void RebinAdaptively( AstMapping *, int, const int *, const int *, const void *, const void *, DataType, int, const double *, int, double, int, const void *, int, const int *, const int *, const int *, const int *, int, void *, void *, double *, int *, int * );
-static void RebinSection( AstMapping *, const double *, int, const int *, const int *, const void *, const void *, DataType, int, const double *, int, const void *, int, const int *, const int *, const int *, const int *, int, void *, void *, double *, int *, int * );
-static void RebinWithBlocking( AstMapping *, const double *, int, const int *, const int *, const void *, const void *, DataType, int, const double *, int, const void *, int, const int *, const int *, const int *, const int *, int, void *, void *, double *, int *, int * );
+static void RebinAdaptively( AstMapping *, int, const int *, const int *, const void *, const void *, DataType, int, const double *, int, double, int, const void *, int, const int *, const int *, const int *, const int *, int, double *, void *, void *, double *, int *, int * );
+static void RebinSection( AstMapping *, const double *, int, const int *, const int *, const void *, const void *, DataType, int, const double *, int, const void *, int, const int *, const int *, const int *, const int *, int, double *, void *, void *, double *, int *, int * );
+static void RebinUpdate( DataType, int, const void *, int, void *, void *, double *, void *, void *, double *, double, int * );
+static void RebinWithBlocking( AstMapping *, const double *, int, const int *, const int *, const void *, const void *, DataType, int, const double *, int, const void *, int, const int *, const int *, const int *, const int *, int, double *, void *, void *, double *, int *, int * );
 static void ReportPoints( AstMapping *, int, AstPointSet *, AstPointSet *, int * );
 static void SetAttrib( AstObject *, const char *, int * );
 static void SetInvert( AstMapping *, int, int * );
@@ -10115,7 +10127,7 @@ static void Rebin##X( AstMapping *this, double wlim, int ndim_in, \
                     params, flags, tol, maxpix, \
                     (const void *) &badval, \
                     ndim_out, lbnd_out, ubnd_out, \
-                    lbnd, ubnd, npix_out, \
+                    lbnd, ubnd, npix_out, NULL, \
                     (void *) out, (void *) out_var, work, NULL, status ); \
 \
 /* If required set output pixels bad if they have a total weight less \
@@ -10166,8 +10178,9 @@ static void RebinAdaptively( AstMapping *this, int ndim_in,
                             int maxpix, const void *badval_ptr,
                             int ndim_out, const int *lbnd_out,
                             const int *ubnd_out, const int *lbnd,
-                            const int *ubnd, int npix_out, void *out,
-                            void *out_var, double *work, int *nused, int *status ){
+                            const int *ubnd, int npix_out, double *insum,
+                            void *out, void *out_var, double *work,
+                            int *nused, int *status ){
 /*
 *  Name:
 *     RebinAdaptively
@@ -10188,8 +10201,9 @@ static void RebinAdaptively( AstMapping *this, int ndim_in,
 *                          int maxpix, const void *badval_ptr,
 *                          int ndim_out, const int *lbnd_out,
 *                          const int *ubnd_out, const int *lbnd,
-*                          const int *ubnd, int npix_out, void *out,
-*                          void *out_var, double *work, int *nused, int *status )
+*                          const int *ubnd, int npix_out, double *insum,
+*                          void *out, void *out_var, double *work, int *nused,
+*                          int *status )
 
 *  Class Membership:
 *     Mapping member function.
@@ -10354,6 +10368,9 @@ static void RebinAdaptively( AstMapping *this, int ndim_in,
 *        grid lying outside this section will be ignored.
 *     npix_out
 *        The number of pixels in the output array.
+*     insum
+*        Pointer to a double in which to return the total input data sum
+*        pasted into "out". Ignored if NULL.
 *     out
 *        Pointer to an array with the same data type as the "in"
 *        array, into which the rebinned data will be returned.  The
@@ -10382,6 +10399,8 @@ static void RebinAdaptively( AstMapping *this, int ndim_in,
 */
 
 /* Local Variables: */
+   double insum1;                /* Total input data sum from 1st half */
+   double insum2;                /* Total input data sum from 2nd half */
    double *flbnd;                /* Array holding floating point lower bounds */
    double *fubnd;                /* Array holding floating point upper bounds */
    double *linear_fit;           /* Pointer to array of fit coefficients */
@@ -10514,7 +10533,8 @@ static void RebinAdaptively( AstMapping *this, int ndim_in,
          RebinWithBlocking( this, linear_fit, ndim_in, lbnd_in, ubnd_in,
                             in, in_var, type, spread,  params, flags,
                             badval_ptr, ndim_out, lbnd_out, ubnd_out, lbnd,
-                            ubnd, npix_out, out, out_var, work, nused, status );
+                            ubnd, npix_out, insum, out, out_var, work, nused,
+                            status );
 
 /* Otherwise, allocate workspace to perform the sub-division. */
       } else {
@@ -10539,7 +10559,8 @@ static void RebinAdaptively( AstMapping *this, int ndim_in,
             RebinAdaptively( this, ndim_in, lbnd_in, ubnd_in, in, in_var,
                              type, spread, params, flags, tol, maxpix,
                              badval_ptr, ndim_out, lbnd_out, ubnd_out,
-                             lo, hi, npix_out, out, out_var, work, nused, status );
+                             lo, hi, npix_out, &insum1, out, out_var, work,
+                             nused, status );
 
 /* Now set up a second section which covers the remaining half of the
    original input section. */
@@ -10552,8 +10573,12 @@ static void RebinAdaptively( AstMapping *this, int ndim_in,
                RebinAdaptively( this, ndim_in, lbnd_in, ubnd_in, in, in_var,
                                 type, spread, params, flags, tol, maxpix,
                                 badval_ptr,  ndim_out, lbnd_out, ubnd_out,
-                                lo, hi, npix_out, out, out_var, work, nused, status );
+                                lo, hi, npix_out, &insum2, out, out_var, work,
+                                nused, status );
             }
+
+/* Return the total input data sum if required. */
+            if( insum ) *insum = insum1 + insum2;
          }
 
 /* Free the workspace. */
@@ -10574,8 +10599,8 @@ static void RebinSection( AstMapping *this, const double *linear_fit,
                           const void *badval_ptr, int ndim_out,
                           const int *lbnd_out, const int *ubnd_out,
                           const int *lbnd, const int *ubnd, int npix_out,
-                          void *out, void *out_var, double *work,
-                          int *nused, int *status ) {
+                          double *insum, void *out, void *out_var,
+                          double *work, int *nused, int *status ) {
 /*
 *  Name:
 *     RebinSection
@@ -10595,7 +10620,7 @@ static void RebinSection( AstMapping *this, const double *linear_fit,
 *                        const void *badval_ptr, int ndim_out,
 *                        const int *lbnd_out, const int *ubnd_out,
 *                        const int *lbnd, const int *ubnd, int npix_out,
-*                        void *out, void *out_var, double *work,
+*                        double *insum, void *out, void *out_var, double *work,
 *                        int *nused )
 
 *  Class Membership:
@@ -10728,6 +10753,9 @@ static void RebinSection( AstMapping *this, const double *linear_fit,
 *        grid lying outside this section will be ignored.
 *     npix_out
 *        The number of pixels in the output array.
+*     insum
+*        Pointer to a double in which to return the total input data sum
+*        pasted into "out". Ignored if NULL.
 *     out
 *        Pointer to an array with the same data type as the "in"
 *        array, into which the rebinned data will be returned.  The
@@ -11153,7 +11181,7 @@ static void RebinSection( AstMapping *this, const double *linear_fit,
                                     npoint, offset, \
                                     (const double *const *) ptr_out, \
                                     flags, *( (Xtype *) badval_ptr ), \
-                                    npix_out, (Xtype *) out, \
+                                    npix_out, insum, (Xtype *) out, \
                                     (Xtype *) out_var, work, nused, status ); \
                   break;
 
@@ -11196,7 +11224,7 @@ static void RebinSection( AstMapping *this, const double *linear_fit,
                                    npoint, offset, \
                                    (const double *const *) ptr_out, \
                                    flags, *( (Xtype *) badval_ptr ), \
-                                   npix_out, (Xtype *) out, \
+                                   npix_out, insum, (Xtype *) out, \
                                    (Xtype *) out_var, work, nused, status ); \
                   break;
 
@@ -11394,7 +11422,7 @@ static void RebinSection( AstMapping *this, const double *linear_fit,
                                          (const double *const *) ptr_out, \
                                          kernel, neighb, par, flags, \
                                          *( (Xtype *) badval_ptr ), \
-                                         npix_out, (Xtype *) out, \
+                                         npix_out, insum, (Xtype *) out, \
                                          (Xtype *) out_var, work, nused, status ); \
                   break;
 
@@ -11534,11 +11562,11 @@ f     FLAGS argument.
 *     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
+*     the input and output grids. The normalised values are then multiplied
+*     by a constant scaling factor to ensure that the total data sum is
+*     unchanged. 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
 c     "wlim" are set to "badval".
 f     WLIM are set to BADVAL.
 *
@@ -11925,8 +11953,11 @@ f     OUT and OUT_VAR
 *     returned. The normalisation factor for each output data value is just the
 *     corresponding value from the weights array. The normalisation factor
 *     for each output variance value is the square of the data value
-*     normalisation factor. It also causes output data values to be set
-*     bad if the corresponding weight is less than the value supplied for
+*     normalisation factor. In addition the whole dat aarray is then
+*     scaled by a constant factor to ensure the total data value in the output
+*     is unchanged by the earlier normalisation. It also causes output data
+*     values to be set bad if the corresponding weight is less than the value
+*     supplied for
 c     parameter "wlim".
 f     argument WLIM.
 *     It also causes any temporary values stored in the output variance array
@@ -11966,7 +11997,7 @@ f     routine
 *     the generated output variances. If AST__DISVAR is not specified,
 *     generated variances represent variances on the output mean  values. If
 *     AST__DISVAR is specified, the generated variances represent the variance
-*     of the distribution from which the input values were taken. Eaxch output
+*     of the distribution from which the input values were taken. Each output
 *     variance created with AST__DISVAR will be larger than that created
 *     without AST__DISVAR by a factor equal to the number of input samples
 *     that contribute to the output sample.
@@ -12011,15 +12042,19 @@ static void RebinSeq##X( AstMapping *this, double wlim, int ndim_in, \
                      double weights[], int *nused, int *status ) { \
 \
 /* Local Variables: */ \
-   astDECLARE_GLOBALS            /* Thread-specific data */ \
    AstMapping *simple;           /* Pointer to simplified Mapping */ \
    Xtype *d;                     /* Pointer to next output data value */ \
    Xtype *v;                     /* Pointer to next output variance value */ \
+   Xtype *worka;                 /* Work array holding rebinned data values */ \
+   Xtype *workc;                 /* Work array holding rebinned variance values */ \
+   astDECLARE_GLOBALS            /* Thread-specific data */ \
    double *w;                    /* Pointer to next weight value */ \
-   double a;                     /* Weighted mean of input values */ \
+   double *workb;                /* Work array holding rebinned weights */ \
+   double insum;                /* Total input data sum to be pasted */ \
    double mwpip;                 /* Mean weight per input pixel */ \
-   double nn;                    /* Effective no. of i/p pixels combined */ \
+   double neff;                  /* Effective number of contributing input pixels */ \
    double sw;                    /* Sum of weights at output pixel */ \
+   double wgt;                   /* Output pixel weight */ \
    int i;                        /* Loop counter for output pixels */ \
    int idim;                     /* Loop counter for coordinate dimensions */ \
    int ipix_out;                 /* Index into output array */ \
@@ -12258,20 +12293,39 @@ static void RebinSeq##X( AstMapping *this, double wlim, int ndim_in, \
          *nused = 0; \
       } \
 \
-/* Perform the rebinning. Note that we pass all gridded data, the \
-   spread function and the bad pixel value by means of pointer \
-   types that obscure the underlying data type. This is to avoid \
-   having to replicate functions unnecessarily for each data \
-   type. However, we also pass an argument that identifies the data \
-   type we have obscured. */ \
+/* Allocate work arrays and fill with zeros. We paste the input data, weights \
+   and variances into these arrays, and then later on we add the work arrays \
+   onto the supplied arrays. We do this so that we can calculate the factors \
+   needed to ensure conservation of flux for each input array individually. */ \
+      worka = astCalloc( npix_out, sizeof( *worka ) ); \
+      workb = astCalloc( npix_out, sizeof( *workb ) ); \
+      workc = ( flags & AST__USEVAR ) ? astCalloc( npix_out, sizeof( *workc ) ) : NULL; \
+\
+/* Rebin the input array into the work arrays. Note that we pass all gridded \
+   data, the spread function and the bad pixel value by means of pointer \
+   types that obscure the underlying data type. This is to avoid having to \
+   replicate functions unnecessarily for each data type. However, we also \
+   pass an argument that identifies the data type we have obscured. */ \
       RebinAdaptively( simple, ndim_in, lbnd_in, ubnd_in, \
                        (const void *) in, (const void *) in_var, \
                        TYPE_##X, spread, \
                        params, flags, tol, maxpix, \
                        (const void *) &badval, \
                        ndim_out, lbnd_out, ubnd_out, \
-                       lbnd, ubnd, npix_out, \
-                       (void *) out, (void *) out_var, weights, nused, status ); \
+                       lbnd, ubnd, npix_out, &insum, \
+                       (void *) worka, (void *) workc, workb, nused, status ); \
+\
+/* Calculate the scaling factors needed to preserve the total data sum \
+   imported from the current input array, and then use the factor to \
+   increment the supplied arrays. */ \
+      RebinUpdate( TYPE_##X, flags, (const void *) &badval, npix_out, \
+                   (void *) worka, (void *) workc, workb, (void *) out, \
+                   (void *) out_var, weights, insum, status ); \
+\
+/* Free the work arrays. */ \
+      worka = astFree( worka ); \
+      workb = astFree( workb ); \
+      workc = astFree( workc ); \
 \
 /* Annul the pointer to the simplified/cloned Mapping. */ \
       simple = astAnnul( simple ); \
@@ -12284,78 +12338,69 @@ static void RebinSeq##X( AstMapping *this, double wlim, int ndim_in, \
 /* Ensure "wlim" is not zero. */ \
       if( wlim < 1.0E-10 ) wlim = 1.0E-10; \
 \
-/* Find the average weight per input pixel, if we do not already know it \
-   to be 1.0. Also scale "wlim" by the mean weight. */ \
-      if( flags & AST__VARWGT ) { \
-         if( *nused > 0 ) { \
-            sw = 0.0; \
-            for( i = 0; i < npix_out; i++ ) { \
-               sw += weights[ i ]; \
-            } \
-            mwpip = sw/( *nused ); \
-         } else { \
-            mwpip = AST__BAD; \
+/* If it will be needed, find the average weight per input pixel. */ \
+      if( !( flags & AST__GENVAR ) && *nused > 0 ) { \
+         sw = 0.0; \
+         for( i = 0; i < npix_out; i++ ) { \
+            sw += weights[ i ]; \
          } \
-         wlim *= mwpip; \
+         mwpip = sw/( *nused ); \
+       } else { \
+         mwpip = AST__BAD; \
+       } \
 \
-      } else { \
-         mwpip = 1.0; \
-      } \
-\
-/* If required set the output variances so that they are estimates of \
-   the variance on the mean of the distribution of input values. */ \
-      if( ( flags & AST__GENVAR ) && !( flags & AST__DISVAR ) ) { \
+/* Normalise each output pixel. */ \
+      for( i = 0; i < npix_out; i++ ) { \
 \
-/* Calculate the variance. We apply a factor that accounts for the \
-   reduction in the number of degrees of freedom when finding the \
-   variance. This factor is based on the number of input values included \
-   in each output value, and is taken to be the output weight dividided \
-   by the mean weight per input pixel. */ \
-         for( i = 0; i < npix_out; i++ ) { \
-            sw = weights[ i ]; \
-            nn = ( mwpip != AST__BAD ) ? sw/mwpip : 0.0; \
-            if( nn > 2.0 && fabs( sw ) >= wlim ) { \
-               a = out[ i ]/sw; \
-               out_var[ i ] = ( out_var[ i ]/sw - a*a )*weights[ i + npix_out ]; \
-               if( out_var[ i ] < 0.0 ) { \
-                  out_var[ i ] = badval; \
-               } else { \
-                  out_var[ i ] *= nn/( nn - 1.0 ); \
-               } \
+/* Find the effective number of input samples that contribute to the \
+   output sample. To do this properly requires the sum of the squared \
+   weights in each output pixel, but this is only available if AST__GENVAR \
+   flag is in use. In order to avoid changing the API for astRebinSeq, we \
+   honour this long-standing restriction, and use an approximation if \
+   AST__GENVAR is not in use. */ \
+         wgt = weights[ i ]; \
+         if( flags & AST__GENVAR ) { \
+            if( wgt > 0.0 ) { \
+               neff = (wgt*wgt)/weights[ i + npix_out ]; \
             } else { \
-               out_var[ i ] = badval; \
+               neff = 0.0; \
             } \
-         } \
 \
-/* If required set the output variances so that they are estimates of \
-   the variance of the distribution of input values. */ \
-      } else if( flags & AST__GENVAR ) { \
-         for( i = 0; i < npix_out; i++ ) { \
-            sw = weights[ i ]; \
-            if( fabs( sw ) >= wlim ) { \
-               a = out[ i ]; \
-               out_var[ i ] = ( sw*out_var[ i ] - a*a ); \
-               if( out_var[ i ] < 0.0 ) out_var[ i ] = badval; \
-            } else { \
-               out_var[ i ] = badval; \
-            } \
+/* If the sum of the squared weights is not available, compare the weight \
+   for this output pixel with the mean weight per input pixel. */ \
+         } else { \
+            neff = wgt/mwpip; \
          } \
-      } \
 \
-/* Normalise the returned data and variance arrays. */ \
-      for( i = 0; i < npix_out; i++ ) { \
-         if( fabs( weights[ i ] ) >= wlim && out[ i ] != badval ) { \
-            out[ i ] /= weights[ i ]; \
+/* Assign bad values to unused output pixels. */ \
+         if( neff < wlim ) { \
+            out[ i ] = badval;  \
+            if( out_var ) out_var[ i ] = badval; \
+\
+/* Otherwise, normalise the returned data value. */ \
          } else { \
-            out[ i ] = badval; \
-         } \
-      } \
-      if( out_var ) { \
-         for( i = 0; i < npix_out; i++ ) { \
-            if( fabs( weights[ i ] ) >= wlim && out_var[ i ] != badval ) { \
-               out_var[ i ] /= ( weights[ i ]*weights[ i ] ); \
-            } else { \
-               out_var[ i ] = badval; \
+            out[ i ] /= wgt; \
+\
+/* Normalise the returned variance: propagated from input variances... */ \
+            if( out_var ) { \
+               if( flags & AST__USEVAR ) { \
+                  out_var[ i ] /= wgt*wgt; \
+\
+/* Normalise the returned variance: from spread of input values... */ \
+               } else if( flags & AST__GENVAR ) {  \
+                  out_var[ i ] /= wgt; \
+                  out_var[ i ] -= out[ i ]*out[ i ]; \
+\
+/* If output variances are estimates of the variance of the distribution \
+   from which the input values were sampled... */ \
+                  if( flags & AST__DISVAR ) { \
+                     out_var[ i ] *= neff/( neff - 1.0 ); \
+\
+/* If output variances are estimates of the error on the mean data value... */ \
+                  } else { \
+                     out_var[ i ] *= 1.0/( neff - 1.0 ); \
+                  } \
+               } \
             } \
          } \
       } \
@@ -12374,6 +12419,204 @@ MAKE_REBINSEQ(I,int,1)
 /* Undefine the macro. */
 #undef MAKE_REBIN
 
+static void RebinUpdate( DataType type, int flags, const void *badval_ptr,
+                         int npix_out, void *worka, void *workc, double *workb,
+                         void *out, void *out_var, double *weights,
+                         double insum, int *status ){
+/*
+*  Name:
+*     RebinUpdate
+
+*  Purpose:
+*     Add a rebinned array into the arrays supplied to astRebinSeqRebin.
+
+*  Type:
+*     Private function.
+
+*  Synopsis:
+*     #include "mapping.h"
+*     void RebinUpdate( DataType type, int flags, const void *badval_ptr,
+*                       int npix_out, void *worka, void *workc, double *workb,
+*                       void *out, void *out_var, double *weights,
+*                       double insum, int *status )
+
+*  Class Membership:
+*     Mapping member function.
+
+*  Description:
+*     This function scales the values supplied in "worka", "workc" and
+*     "workb" so that they correspond to the same total data sum as the input
+*     array supplied to astRebinSeq. It then adds these scaled values
+*     into the supplied "out", "out_var" and "weights" arrays.
+
+*  Parameters:
+*     type
+*        A value taken from the "DataType" enum, which specifies the
+*        data type of the input and output arrays containing the
+*        gridded data (and variance) values.
+*     flags
+*        The bitwise OR of a set of flag values which provide additional
+*        control over the resampling operation.
+*     badval_ptr
+*        If the AST__USEBAD flag is set (above), this parameter is a
+*        pointer to a value which is used to identify bad data and/or
+*        variance values in the input array(s). The referenced value's
+*        data type must match that of the "in" (and "in_var")
+*        arrays. The same value will also be used to flag any output
+*        array elements for which rebinned values could not be
+*        obtained.  The output arrays(s) may be flagged with this
+*        value whether or not the AST__USEBAD flag is set (the
+*        function return value indicates whether any such values have
+*        been produced).
+*     npix_out
+*        The number of pixels in the output array.
+*     worka
+*        Pointer to an array with the same data type as the "in"
+*        array, into which the rebinned data will be returned.  The
+*        storage order should be such that the coordinate of the first
+*        dimension varies most rapidly and that of the final dimension
+*        least rapidly (i.e. Fortran array storage order is used).
+*     workc
+*        An optional pointer to an array with the same data type and
+*        size as the "out" array, into which variance estimates for
+*        the rebinned values may be returned. This array will only be
+*        used if the "in_var" array has been given.
+*
+*        If no output variance estimates are required, a NULL pointer
+*        should be given.
+*     workb
+*        An optional pointer to a double array with the same size as
+*        the "out" array. The contents of this array (if supplied) are
+*        incremented by the accumulated weights assigned to each output pixel.
+*        If no accumulated weights are required, a NULL pointer should be
+*        given.
+*     out
+*        The array containing the running sum of the data values pasted
+*        by all calls to astRebinSeq. Updated on output to include the
+*        data supplied in "worka", with suitable scaling to preserve the
+*        total data sum within the input array.
+*     out_var
+*        The array containing the running sum of the variance values pasted
+*        by all calls to astRebinSeq. Updated on output to include the
+*        values supplied in "workc", with suitable scaling to preserve the
+*        total data sum within the input array.
+*     weights
+*        The array containing the running sum of the weights pasted
+*        by all calls to astRebinSeq. Updated on output to include the
+*        weights supplied in "workb", with suitable scaling to preserve the
+*        total data sum within the input array.
+*     insum
+*        The total input data sum pasted into "worka".
+*     status
+*        Pointer to the inherited status variable.
+*/
+
+/* Local Variables: */
+   double alpha2;
+   double alpha;
+   double sum;
+   double wb;
+   int i;
+   int j;
+
+/* Check the global error status. */
+   if ( !astOK ) return;
+
+/* Calculate the scaling factor, alpha, to apply to the rebinned data values
+   in "worka" such that the scaled values would have the same total data value
+   as the used input pixel values (i.e. the value supplied in "insum").
+   Define a macro to use a "case" statement to define the code appropriate
+   to a given data type. */
+#define CASE_REBINUP(X,Xtype) \
+   case ( TYPE_##X ): {\
+      Xtype wa; \
+      sum = 0.0; \
+      for( i = 0; i < npix_out; i++ ) { \
+         wa = ((Xtype*)worka)[ i ]; \
+         wb = workb[ i ]; \
+         if( wa != *((Xtype *) badval_ptr) && wb != AST__BAD  && wb > 0.0 ) { \
+            sum += wa/wb; \
+         } \
+      } \
+      alpha = ( sum != 0.0 ) ? insum/sum : AST__BAD; \
+      break; \
+   }
+
+/* Use the above macro to invoke the appropriate code. */
+   switch ( type ) {
+
+#if HAVE_LONG_DOUBLE     /* Not normally implemented */
+      CASE_REBINUP(LD,long double)
+#endif
+      CASE_REBINUP(D,double)
+      CASE_REBINUP(F,float)
+      CASE_REBINUP(I,int)
+
+      case ( TYPE_L ): break;
+      case ( TYPE_K ): break;
+      case ( TYPE_B ): break;
+      case ( TYPE_S ): break;
+      case ( TYPE_UL ): break;
+      case ( TYPE_UI ): break;
+      case ( TYPE_UK ): break;
+      case ( TYPE_US ): break;
+      case ( TYPE_UB ): break;
+   }
+
+#undef CASE_REBINUP
+
+/* Scale each work value and add it onto the appropriate output array. */
+   if( alpha != AST__BAD ){
+      alpha2 = alpha*alpha;
+
+#define CASE_REBINUP(X,Xtype) \
+      case ( TYPE_##X ): {\
+         Xtype wa; \
+         j = npix_out; \
+         for( i = 0; i < npix_out; i++,j++ ) { \
+            wa = ((Xtype*)worka)[ i ]; \
+            wb = workb[ i ]; \
+            if( wa != *((Xtype *) badval_ptr) && wb != AST__BAD  && wb > 0.0 ) { \
+               sum += wa/wb; \
+               ((Xtype*)out)[ i ] += (Xtype) alpha*wa; \
+               weights[ i ] += wb; \
+               if( flags & AST__USEVAR ) { \
+                  ((Xtype*)out_var)[ i ] += alpha2*((Xtype*)workc)[ i ]; \
+               } else if( flags & AST__GENVAR ) { \
+                  ((Xtype*)out_var)[ i ] += alpha2*wa*wa/wb; \
+                  weights[ j ] += wb*wb; \
+               } \
+            } \
+         } \
+         break; \
+      }
+
+/* Use the above macro to invoke the appropriate code. */
+      switch ( type ) {
+
+#if HAVE_LONG_DOUBLE        /* Not normally implemented */
+         CASE_REBINUP(LD,long double)
+#endif
+         CASE_REBINUP(D,double)
+         CASE_REBINUP(F,float)
+         CASE_REBINUP(I,int)
+
+         case ( TYPE_L ): break;
+         case ( TYPE_K ): break;
+         case ( TYPE_B ): break;
+         case ( TYPE_S ): break;
+         case ( TYPE_UL ): break;
+         case ( TYPE_UI ): break;
+         case ( TYPE_UK ): break;
+         case ( TYPE_US ): break;
+         case ( TYPE_UB ): break;
+      }
+
+#undef CASE_REBINUP
+
+   }
+}
+
 static void RebinWithBlocking( AstMapping *this, const double *linear_fit,
                                int ndim_in, const int *lbnd_in,
                                const int *ubnd_in, const void *in,
@@ -12382,8 +12625,8 @@ static void RebinWithBlocking( AstMapping *this, const double *linear_fit,
                                const void *badval_ptr, int ndim_out,
                                const int *lbnd_out, const int *ubnd_out,
                                const int *lbnd, const int *ubnd, int npix_out,
-                               void *out, void *out_var, double *work,
-                               int *nused, int *status ) {
+                               double *insum, void *out, void *out_var,
+                               double *work, int *nused, int *status ) {
 /*
 *  Name:
 *     RebinWithBlocking
@@ -12404,8 +12647,8 @@ static void RebinWithBlocking( AstMapping *this, const double *linear_fit,
 *                             const void *badval_ptr, int ndim_out,
 *                             const int *lbnd_out, const int *ubnd_out,
 *                             const int *lbnd, const int *ubnd, int npix_out,
-*                             void *out, void *out_var, double *work,
-*                             int *nused )
+*                             double *insum, void *out, void *out_var,
+*                             double *work, int *nused )
 
 *  Class Membership:
 *     Mapping member function.
@@ -12543,6 +12786,9 @@ static void RebinWithBlocking( AstMapping *this, const double *linear_fit,
 *        grid lying outside this section will be ignored.
 *     npix_out
 *        The number of pixels in the output array.
+*     insum
+*        Pointer to a double in which to return the total input data sum
+*        pasted into "out". Ignored if NULL.
 *     out
 *        Pointer to an array with the same data type as the "in"
 *        array, into which the rebinned data will be returned.  The
@@ -12575,6 +12821,7 @@ static void RebinWithBlocking( AstMapping *this, const double *linear_fit,
                                     performance) */
 
 /* Local Variables: */
+   double binsum;                /* Input data sum within block */
    int *dim_block;               /* Pointer to array of block dimensions */
    int *lbnd_block;              /* Pointer to block lower bound array */
    int *ubnd_block;              /* Pointer to block upper bound array */
@@ -12586,6 +12833,9 @@ static void RebinWithBlocking( AstMapping *this, const double *linear_fit,
    int mxdim_block;              /* Maximum block dimension */
    int npix;                     /* Number of pixels in block */
 
+/* Initialise */
+   if( insum ) *insum = 0.0;
+
 /* Check the global error status. */
    if ( !astOK ) return;
 
@@ -12674,7 +12924,10 @@ static void RebinWithBlocking( AstMapping *this, const double *linear_fit,
          RebinSection( this, linear_fit, ndim_in, lbnd_in, ubnd_in, in,
                        in_var, type, spread, params, flags, badval_ptr,
                        ndim_out, lbnd_out, ubnd_out, lbnd_block, ubnd_block,
-                       npix_out, out, out_var, work, nused, status );
+                       npix_out, &binsum, out, out_var, work, nused, status );
+
+/* Update returned total input data sum,. */
+         if( insum ) *insum += binsum;
 
 /* Update the block extent to identify the next block of input pixels. */
          idim = 0;
@@ -16931,8 +17184,9 @@ static int SpecialBounds( const MapData *mapdata, double *lbnd, double *ubnd,
 *                           void (* kernel)( double, const double [], int,
 *                                            double *, int * ),
 *                           int neighb, const double *params, int flags,
-*                           <Xtype> badval, int npix_out,  <Xtype> *out,
-*                           <Xtype> *out_var, double *work, int *nused )
+*                           <Xtype> badval, int npix_out, double insum,
+*                           <Xtype> *out, <Xtype> *out_var, double *work,
+*                           int *nused )
 
 *  Class Membership:
 *     Mapping member function.
@@ -17055,6 +17309,9 @@ static int SpecialBounds( const MapData *mapdata, double *lbnd, double *ubnd,
 *        been produced).
 *     npix_out
 *        Number of pixels in output array.
+*     insum
+*        Pointer to a double in which to return the total input data sum
+*        pasted into "out". Ignored if NULL.
 *     out
 *        Pointer to an array with the same data type as the "in"
 *        array, into which the rebinned data will be returned. The
@@ -17099,7 +17356,7 @@ static void SpreadKernel1##X( AstMapping *this, int ndim_out, \
                               void (* kernel)( double, const double [], \
                                                int, double *, int * ), \
                               int neighb, const double *params, \
-                              int flags, Xtype badval, int npix_out, \
+                              int flags, Xtype badval, int npix_out, double  *insum, \
                               Xtype *out, Xtype *out_var, double *work, \
                               int *nused, int *status ) { \
 \
@@ -17118,6 +17375,7 @@ static void SpreadKernel1##X( AstMapping *this, int ndim_out, \
    double *xnl;                  /* Pointer to previous ofset array (n-d) */ \
    double pixwt;                 /* Weight to apply to individual pixel */ \
    double sum;                   /* Sum of all filter values */ \
+   double sumin;                 /* Sum of input data */ \
    double wgt;                   /* Weight for input value */ \
    double x;                     /* x coordinate value */ \
    double xn;                    /* Coordinate value (n-d) */ \
@@ -17179,6 +17437,7 @@ static void SpreadKernel1##X( AstMapping *this, int ndim_out, \
    kerror = 0; \
    sum = 0.0; \
    bad = 0; \
+   sumin = 0.0; \
 \
 /* Find the total number of pixels in the filter used to spread a single \
    input pixel into the output image. */ \
@@ -17397,6 +17656,9 @@ static void SpreadKernel1##X( AstMapping *this, int ndim_out, \
       filter = astFree( filter ); \
    }\
 \
+/* Return the total input data sum if needed. */ \
+   if( insum ) *insum = sumin; \
+\
 /* If an error occurred in the kernel function, then report a \
    contextual error message. */ \
    if ( kerror ) { \
@@ -17465,6 +17727,9 @@ static void SpreadKernel1##X( AstMapping *this, int ndim_out, \
 /* Increment the number of input pixels pasted into the output array. */ \
             if( nused ) (*nused)++; \
 \
+/* Increment the sum of the used input values. */ \
+            sumin += (double) in_val; \
+\
 /* Convert these output indices to the corresponding indices \
    within a box [ 0, 2*neighb ] holding the kernel values. */ \
             lo_jx = lo_ix - ix; \
@@ -17642,6 +17907,9 @@ static void SpreadKernel1##X( AstMapping *this, int ndim_out, \
 /* Increment the number of input pixels pasted into the output array. */ \
                if( nused ) (*nused)++; \
 \
+/* Increment the sum of the used input values. */ \
+               sumin += (double) in_val; \
+\
 /* Convert these output indices to the corresponding indices \
    within a box [ 0:2*neighb, 0:2*neighb ] holding the kernel values. */ \
                lo_jx = lo_ix - ix; \
@@ -18056,6 +18324,9 @@ static void SpreadKernel1##X( AstMapping *this, int ndim_out, \
 /* Increment the number of input pixels pasted into the output array. */ \
             if( nused ) (*nused)++; \
 \
+/* Increment the sum of the used input values. */ \
+            sumin += (double) in_val; \
+\
 /* Initialise, and loop over the neighbouring output pixels to divide up \
    the input pixel value between them. */ \
             idim = ndim_out - 1; \
@@ -18155,8 +18426,9 @@ MAKE_SPREAD_KERNEL1(I,int,1)
 *                           const <Xtype> *in, const <Xtype> *in_var,
 *                           int npoint, const int *offset,
 *                           const double *const *coords, int flags,
-*                           <Xtype> badval, int npix_out, <Xtype> *out,
-*                           <Xtype> *out_var, double *work, int *nused  )
+*                           <Xtype> badval, int npix_out, double *insum,
+*                           <Xtype> *out, <Xtype> *out_var, double *work,
+*                           int *nused  )
 
 *  Class Membership:
 *     Mapping member function.
@@ -18256,6 +18528,9 @@ MAKE_SPREAD_KERNEL1(I,int,1)
 *        been produced).
 *     npix_out
 *        Number of pixels in output array.
+*     insum
+*        Pointer to a double in which to return the total input data sum
+*        pasted into "out". Ignored if NULL.
 *     out
 *        Pointer to an array with the same data type as the "in"
 *        array, into which the rebinned data will be returned. The
@@ -18298,7 +18573,7 @@ static void SpreadLinear##X( int ndim_out, \
                             const Xtype *in, const Xtype *in_var, \
                             int npoint, const int *offset, \
                             const double *const *coords, int flags, \
-                            Xtype badval, int npix_out, Xtype *out, \
+                            Xtype badval, int npix_out, double *insum, Xtype *out, \
                             Xtype *out_var, double *work, int *nused, int *status ) { \
 \
 /* Local Variables: */ \
@@ -18315,6 +18590,7 @@ static void SpreadLinear##X( int ndim_out, \
    double frac_hi_y;             /* Pixel weight (y dimension) */ \
    double frac_lo_x;             /* Pixel weight (x dimension) */ \
    double frac_lo_y;             /* Pixel weight (y dimension) */ \
+   double sumin;                 /* Sum of input data */ \
    double wgt;                   /* Weight for input value */ \
    double x;                     /* x coordinate value */ \
    double xmax;                  /* x upper limit */ \
@@ -18366,6 +18642,9 @@ static void SpreadLinear##X( int ndim_out, \
    } \
    varwgt = ( flags & AST__VARWGT ) && in_var && work; \
 \
+/* Initialise total input data sum. */ \
+   sumin = 0.0; \
+\
 /* Handle the 1-dimensional case optimally. */ \
 /* ---------------------------------------- */ \
    if ( ndim_out == 1 ) { \
@@ -18559,6 +18838,9 @@ static void SpreadLinear##X( int ndim_out, \
       xn_min = astFree( xn_min ); \
    } \
 \
+/* Return the total input data sum if needed. */ \
+   if( insum ) *insum = sumin; \
+\
 }
 
 
@@ -18613,6 +18895,9 @@ static void SpreadLinear##X( int ndim_out, \
 /* Increment the number of input pixels pasted into the output array. */ \
          if( nused ) (*nused)++; \
 \
+/* Increment the sum of the used input values. */ \
+         sumin += (double) in_val; \
+\
 /* Obtain the offset within the output array of the first pixel to be \
    updated (the one with the smaller index). */ \
          off_lo = lo_x - lbnd_out[ 0 ]; \
@@ -18699,6 +18984,9 @@ static void SpreadLinear##X( int ndim_out, \
 /* Increment the number of input pixels pasted into the output array. */ \
             if( nused ) (*nused)++; \
 \
+/* Increment the sum of the used input values. */ \
+            sumin += (double) in_val; \
+\
 /* If OK, obtain the indices along the output grid x dimension of the \
    two adjacent pixels which recieve contributions from the input pixel. \
    Also obtain the fractional weight to be applied to each of \
@@ -18876,6 +19164,9 @@ static void SpreadLinear##X( int ndim_out, \
          if ( !bad ) { \
             if( nused ) (*nused)++; \
 \
+/* Increment the sum of the used input values. */ \
+            sumin += (double) in_val; \
+\
 /* Loop over adjacent output pixels to divide up the input value. */ \
             idim = ndim_out - 1; \
             wtprod[ idim ] = 1.0; \
@@ -18981,8 +19272,9 @@ MAKE_SPREAD_LINEAR(I,int,1)
 *                           const <Xtype> *in, const <Xtype> *in_var,
 *                           int npoint, const int *offset,
 *                           const double *const *coords, int flags,
-*                           <Xtype> badval, int npix_out, <Xtype> *out,
-*                           <Xtype> *out_var, double *work, int *nused )
+*                           <Xtype> badval, int npix_out, double *insum,
+*                           <Xtype> *out, <Xtype> *out_var, double *work,
+*                           int *nused )
 
 *  Class Membership:
 *     Mapping member function.
@@ -19086,6 +19378,9 @@ MAKE_SPREAD_LINEAR(I,int,1)
 *        been produced).
 *     npix_out
 *        Number of pixels in output array.
+*     insum
+*        Pointer to a double in which to return the total input data sum
+*        pasted into "out". Ignored if NULL.
 *     out
 *        Pointer to an array with the same data type as the "in"
 *        array, into which the rebinned data will be returned. The
@@ -19126,7 +19421,7 @@ static void SpreadNearest##X( int ndim_out, \
                              const Xtype *in, const Xtype *in_var, \
                              int npoint, const int *offset, \
                              const double *const *coords, int flags, \
-                             Xtype badval, int npix_out, Xtype *out, \
+                             Xtype badval, int npix_out, double *insum, Xtype *out, \
                              Xtype *out_var, double *work, int *nused, int *status ) { \
 \
 /* Local Variables: */ \
@@ -19135,6 +19430,7 @@ static void SpreadNearest##X( int ndim_out, \
    double *xn_max;               /* Pointer to upper limits array (n-d) */ \
    double *xn_min;               /* Pointer to lower limits array (n-d) */ \
    double cwgt;                  /* Product of input value and weight */ \
+   double sumin;                 /* Sum of input data */ \
    double wgt;                   /* Weight for input value */ \
    double x;                     /* x coordinate value */ \
    double xmax;                  /* x upper limit */ \
@@ -19173,6 +19469,9 @@ static void SpreadNearest##X( int ndim_out, \
    } \
    varwgt = ( flags & AST__VARWGT ) && in_var && work; \
 \
+/* Initialise total input data sum. */ \
+   sumin = 0.0; \
+\
 /* Handle the 1-dimensional case optimally. */ \
 /* ---------------------------------------- */ \
    if ( ndim_out == 1 ) { \
@@ -19352,6 +19651,9 @@ static void SpreadNearest##X( int ndim_out, \
       xn_min = astFree( xn_min ); \
    } \
 \
+/* Return the total input data sum if needed. */ \
+   if( insum ) *insum = sumin; \
+\
 }
 
 
@@ -19397,6 +19699,9 @@ static void SpreadNearest##X( int ndim_out, \
 /* Increment the number of input pixels pasted into the output array. */ \
                   if( nused ) (*nused)++; \
 \
+/* Increment the sum of the used input values. */ \
+                  sumin += (double) in_val; \
+\
 /* If not, then obtain the offset within the output grid of the pixel \
    which contains the current input point. */ \
                   off_out = (int) floor( x + 0.5 ) - lbnd_out[ 0 ]; \
@@ -19506,6 +19811,9 @@ static void SpreadNearest##X( int ndim_out, \
 /* Increment the number of input pixels pasted into the output array. */ \
                      if( nused ) (*nused)++; \
 \
+/* Increment the sum of the used input values. */ \
+                     sumin += (double) in_val; \
+\
 /* Obtain the offsets along each output grid dimension of the output \
    pixel which is to receive the input pixel value. */ \
                      ix = (int) floor( x + 0.5 ) - lbnd_out[ 0 ]; \
@@ -19627,6 +19935,9 @@ static void SpreadNearest##X( int ndim_out, \
 /* Increment the number of input pixels pasted into the output array. */ \
                      if( nused ) (*nused)++; \
 \
+/* Increment the sum of the used input values. */ \
+                     sumin += (double) in_val; \
+\
 /* Note the input data value. */ \
                      c = CONV(IntType,in_val); \
 \
@@ -24458,3 +24769,4 @@ f     MAP.
 
 
 
+
diff --git a/sun210.htx_tar b/sun210.htx_tar
index ecfd305..5c0020b 100644
Binary files a/sun210.htx_tar and b/sun210.htx_tar differ
diff --git a/sun210.ps b/sun210.ps
index 1566429..765d9d3 100644
--- a/sun210.ps
+++ b/sun210.ps
@@ -1,7 +1,7 @@
 %!PS-Adobe-2.0
 %%Creator: dvips(k) 5.96.1 Copyright 2007 Radical Eye Software
 %%Title: sun210.dvi
-%%CreationDate: Thu Jun 28 12:00:22 2012
+%%CreationDate: Fri Aug 10 10:03:13 2012
 %%Pages: 616
 %%PageOrder: Ascend
 %%BoundingBox: 0 0 595 842
@@ -13,7 +13,7 @@
 %DVIPSWebPage: (www.radicaleye.com)
 %DVIPSCommandLine: dvips -f sun210
 %DVIPSParameters: dpi=600
-%DVIPSSource:  TeX output 2012.06.28:1200
+%DVIPSSource:  TeX output 2012.08.10:1003
 %%BeginProcSet: tex.pro 0 0
 %!
 /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
@@ -49137,6 +49137,9 @@ b(.)f(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f
 (.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)60 b(606)136
 2158 y(G.51)23 b(Changes)31 b(In)m(tro)s(duced)e(in)h(V7.0.5)47
 b(.)f(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f
+(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)60 b(606)136
+2271 y(G.52)23 b(Changes)31 b(In)m(tro)s(duced)e(in)h(V7.0.6)47
+b(.)f(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f
 (.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)60 b(606)p
 eop end
 %%Page: 10 10
@@ -122259,20 +122262,20 @@ b(arra)n(ys)e(to)j(b)r(e)h(normalised)d(b)r(efore)i(b)r(eing)g
 (returned.)46 b(This)31 b(normalisation)p eop end
 %%Page: 332 342
 TeXDict begin 332 341 bop 0 52 a FG(332)2115 b Fz(B)92
-b(AST)29 b(R)m(OUTINE)i(DESCRIPTIONS)227 351 y Fj(consists)j(of)g
-(dividing)h(the)g(data)f(arra)n(y)e(b)n(y)i(the)h(w)n(eigh)n(ts)f(arra)
-n(y)-7 b(,)34 b(and)g(can)g(eliminate)h(artifacts)f(whic)n(h)g(ma)n(y)
-227 451 y(b)r(e)e(in)n(tro)r(duced)f(in)n(to)g(the)h(rebinned)f(data)g
-(as)g(a)g(consequence)f(of)i(aliasing)e(b)r(et)n(w)n(een)h(the)h(input)
-g(and)f(output)227 551 y(grids.)55 b(Ho)n(w)n(ev)n(er,)34
-b(it)g(can)g(also)f(result)g(in)i(small)e(c)n(hanges)g(to)h(the)g
-(total)g(pixel)g(v)-5 b(alue)34 b(in)g(an)n(y)f(giv)n(en)g(area)g(of)
-227 650 y(the)26 b(output)h(arra)n(y)-7 b(.)34 b(In)25
-b(addition)h(to)f(normalisation)f(of)i(the)g(output)g(data)g(v)-5
-b(alues,)25 b(an)n(y)g(output)h(v)-5 b(ariances)25 b(are)227
-750 y(also)h(appropriately)f(normalised,)h(and)h(an)n(y)f(output)h
-(data)f(v)-5 b(alues)27 b(with)g(w)n(eigh)n(t)f(less)h(than)g(WLIM)g
-(are)f(set)h(to)227 849 y(BAD)n(V)-9 b(AL.)227 977 y(Output)34
+b(AST)29 b(R)m(OUTINE)i(DESCRIPTIONS)227 351 y Fj(consists)c(of)g
+(dividing)g(the)g(data)g(arra)n(y)e(b)n(y)i(the)g(w)n(eigh)n(ts)f(arra)
+n(y)-7 b(,)25 b(and)i(can)g(eliminate)g(artifacts)g(whic)n(h)g(ma)n(y)f
+(b)r(e)227 451 y(in)n(tro)r(duced)e(in)n(to)f(the)i(rebinned)e(data)h
+(as)f(a)g(consequence)g(of)h(aliasing)e(b)r(et)n(w)n(een)i(the)g(input)
+h(and)e(output)i(grids.)227 551 y(The)e(normalised)e(v)-5
+b(alues)22 b(are)g(then)h(m)n(ultiplied)g(b)n(y)g(a)f(constan)n(t)f
+(scaling)h(factor)g(to)g(ensure)g(that)h(the)g(total)f(data)227
+650 y(sum)32 b(is)f(unc)n(hanged.)49 b(In)31 b(addition)h(to)f
+(normalisation)f(of)i(the)g(output)g(data)f(v)-5 b(alues,)32
+b(an)n(y)f(output)h(v)-5 b(ariances)227 750 y(are)24
+b(also)f(appropriately)f(normalised,)i(and)g(an)n(y)g(output)h(data)f
+(v)-5 b(alues)24 b(with)h(w)n(eigh)n(t)e(less)h(than)h(WLIM)f(are)g
+(set)227 849 y(to)k(BAD)n(V)-9 b(AL.)227 977 y(Output)34
 b(v)-5 b(ariances)32 b(can)h(b)r(e)g(generated)f(in)i(t)n(w)n(o)e(w)n
 (a)n(ys;)j(b)n(y)d(rebinning)h(the)h(supplied)f(input)h(v)-5
 b(ariances)32 b(with)227 1077 y(appropriate)21 b(w)n(eigh)n(ts,)i(or)f
@@ -122575,77 +122578,80 @@ b(to)f(zero)g(if)h(the)g(AST)p Ft(__)p Fj(REBININIT)f(\015ag)g(is)g
 %%Page: 335 345
 TeXDict begin 335 344 bop 3643 52 a FG(335)259 351 y
 Fc(ST)-8 b(A)g(TUS)34 b(=)e(INTEGER)f(\(Giv)m(en)h(and)g(Returned\))427
-451 y Fj(The)c(global)e(status.)-2 610 y Fc(Data)33 b(T)m(yp)s(e)g(Co)s
-(des)n(:)227 756 y Fj(T)-7 b(o)23 b(select)f(the)i(appropriate)d
+451 y Fj(The)c(global)e(status.)-2 602 y Fc(Data)33 b(T)m(yp)s(e)g(Co)s
+(des)n(:)227 748 y Fj(T)-7 b(o)23 b(select)f(the)i(appropriate)d
 (rebinning)h(function,)j(y)n(ou)d(should)g(replace)g
 Fl(<)p Fj(X)p Fl(>)g Fj(in)h(the)h(generic)d(function)j(name)227
-856 y(AST)p Ft(_)p Fj(REBINSEQ)p Fl(<)p Fj(X)p Fl(>)g
+848 y(AST)p Ft(_)p Fj(REBINSEQ)p Fl(<)p Fj(X)p Fl(>)g
 Fj(with)i(a)f(1-)f(or)h(2-c)n(haracter)d(data)j(t)n(yp)r(e)h(co)r(de,)f
 (so)g(as)g(to)g(matc)n(h)g(the)h(n)n(umerical)e(t)n(yp)r(e)227
-956 y Fl(<)p Fj(Xt)n(yp)r(e)p Fl(>)j Fj(of)h(the)g(data)f(y)n(ou)g(are)
-g(pro)r(cessing,)f(as)h(follo)n(ws:)340 1089 y Fi(\017)45
-b Fj(D:)28 b(DOUBLE)g(PRECISION)340 1220 y Fi(\017)45
-b Fj(R:)28 b(REAL)340 1350 y Fi(\017)45 b Fj(I:)28 b(INTEGER)227
-1510 y(F)-7 b(or)18 b(example,)i(AST)p Ft(_)p Fj(REBIND)e(w)n(ould)g(b)
+947 y Fl(<)p Fj(Xt)n(yp)r(e)p Fl(>)j Fj(of)h(the)g(data)f(y)n(ou)g(are)
+g(pro)r(cessing,)f(as)h(follo)n(ws:)340 1073 y Fi(\017)45
+b Fj(D:)28 b(DOUBLE)g(PRECISION)340 1195 y Fi(\017)45
+b Fj(R:)28 b(REAL)340 1317 y Fi(\017)45 b Fj(I:)28 b(INTEGER)227
+1468 y(F)-7 b(or)18 b(example,)i(AST)p Ft(_)p Fj(REBIND)e(w)n(ould)g(b)
 r(e)h(used)f(to)h(pro)r(cess)e(DOUBLE)h(PRECISION)f(data,)j(while)f
-(AST)p Ft(_)p Fj(REBINI)227 1609 y(w)n(ould)27 b(b)r(e)h(used)g(to)f
+(AST)p Ft(_)p Fj(REBINI)227 1568 y(w)n(ould)27 b(b)r(e)h(used)g(to)f
 (pro)r(cess)g(in)n(teger)g(data)g(\(stored)g(in)h(an)f(INTEGER)g(arra)n
-(y\),)f(etc.)227 1732 y(Note)d(that,)h(unlik)n(e)e(AST)p
+(y\),)f(etc.)227 1687 y(Note)d(that,)h(unlik)n(e)e(AST)p
 Ft(_)p Fj(RESAMPLE)p Fl(<)p Fj(X)p Fl(>)p Fj(,)g(the)h(AST)p
 Ft(_)p Fj(REBINSEQ)p Fl(<)p Fj(X)p Fl(>)e Fj(set)h(of)g(functions)h(do)
-r(es)f(not)h(y)n(et)227 1832 y(supp)r(ort)28 b(unsigned)f(in)n(teger)g
+r(es)f(not)h(y)n(et)227 1786 y(supp)r(ort)28 b(unsigned)f(in)n(teger)g
 (data)g(t)n(yp)r(es)g(or)g(in)n(tegers)g(of)g(di\013eren)n(t)h(sizes.)
--2 1979 y Fc(Con)m(trol)k(Flags)n(:)227 2125 y Fj(The)24
+-2 1925 y Fc(Con)m(trol)k(Flags)n(:)227 2071 y Fj(The)24
 b(follo)n(wing)f(\015ags)g(are)g(de\014ned)h(in)g(the)g(AST)p
 Ft(_)p Fj(P)-7 b(AR)24 b(include)g(\014le)g(and)g(ma)n(y)f(b)r(e)h
-(used)g(to)g(pro)n(vide)e(additional)227 2225 y(con)n(trol)32
+(used)g(to)g(pro)n(vide)e(additional)227 2171 y(con)n(trol)32
 b(o)n(v)n(er)e(the)j(rebinning)f(pro)r(cess.)51 b(Ha)n(ving)32
 b(selected)g(a)g(set)h(of)f(\015ags,)h(y)n(ou)f(should)g(supply)h(the)g
-(sum)g(of)227 2324 y(their)28 b(v)-5 b(alues)27 b(via)g(the)h(FLA)n(GS)
-g(argumen)n(t:)340 2581 y Fi(\017)45 b Fj(AST)p Ft(__)p
+(sum)g(of)227 2270 y(their)28 b(v)-5 b(alues)27 b(via)g(the)h(FLA)n(GS)
+g(argumen)n(t:)340 2515 y Fi(\017)45 b Fj(AST)p Ft(__)p
 Fj(REBININIT:)28 b(Used)g(to)f(mark)g(the)i(\014rst)e(call)h(in)g(a)g
 (sequence.)37 b(It)28 b(indicates)g(that)g(the)g(supplied)427
-2681 y(OUT,)k(OUT)p Ft(_)p Fj(V)-9 b(AR)32 b(and)f(WEIGHTS)i(arra)n(ys)
+2615 y(OUT,)k(OUT)p Ft(_)p Fj(V)-9 b(AR)32 b(and)f(WEIGHTS)i(arra)n(ys)
 c(should)j(b)r(e)g(\014lled)g(with)g(zeros)f(\(th)n(us)h(o)n(v)n
-(er-writing)d(an)n(y)427 2781 y(supplied)h(v)-5 b(alues\))30
+(er-writing)d(an)n(y)427 2714 y(supplied)h(v)-5 b(alues\))30
 b(b)r(efore)f(adding)g(the)h(rebinned)f(input)i(data)e(in)n(to)g(them.)
-43 b(This)30 b(\015ag)e(should)i(b)r(e)g(used)427 2880
+43 b(This)30 b(\015ag)e(should)i(b)r(e)g(used)427 2814
 y(when)e(rebinning)f(the)h(\014rst)g(input)g(arra)n(y)d(in)j(a)f
-(sequence.)340 3011 y Fi(\017)45 b Fj(AST)p Ft(__)p Fj(REBINEND:)34
+(sequence.)340 2936 y Fi(\017)45 b Fj(AST)p Ft(__)p Fj(REBINEND:)34
 b(Used)h(to)g(mark)f(the)h(last)f(call)g(in)h(a)g(sequence.)57
 b(It)35 b(causes)f(eac)n(h)g(v)-5 b(alue)34 b(in)h(the)427
-3110 y(OUT)30 b(and)h(OUT)p Ft(_)p Fj(V)-9 b(AR)30 b(arra)n(ys)d(to)k
+3036 y(OUT)30 b(and)h(OUT)p Ft(_)p Fj(V)-9 b(AR)30 b(arra)n(ys)d(to)k
 (b)r(e)f(divided)h(b)n(y)f(a)g(normalisation)e(factor)i(b)r(efore)g(b)r
-(eing)g(returned.)427 3210 y(The)38 b(normalisation)d(factor)h(for)h
-(eac)n(h)g(output)g(data)g(v)-5 b(alue)37 b(is)g(just)h(the)g(corresp)r
-(onding)d(v)-5 b(alue)37 b(from)427 3310 y(the)32 b(w)n(eigh)n(ts)e
-(arra)n(y)-7 b(.)46 b(The)32 b(normalisation)d(factor)i(for)g(eac)n(h)f
-(output)i(v)-5 b(ariance)30 b(v)-5 b(alue)32 b(is)f(the)h(square)e(of)
-427 3409 y(the)k(data)e(v)-5 b(alue)33 b(normalisation)e(factor.)53
-b(It)33 b(also)f(causes)g(output)h(data)g(v)-5 b(alues)33
-b(to)f(b)r(e)i(set)f(bad)g(if)g(the)427 3509 y(corresp)r(onding)26
-b(w)n(eigh)n(t)i(is)g(less)f(than)i(the)f(v)-5 b(alue)28
-b(supplied)h(for)e(argumen)n(t)g(WLIM.)i(It)f(also)f(causes)g(an)n(y)
-427 3608 y(temp)r(orary)e(v)-5 b(alues)25 b(stored)f(in)i(the)g(output)
-g(v)-5 b(ariance)25 b(arra)n(y)e(\(see)i(\015ag)g(AST)p
-Ft(__)p Fj(GENV)-9 b(AR)25 b(b)r(elo)n(w\))h(to)f(b)r(e)427
-3708 y(con)n(v)n(erted)h(in)n(to)i(usable)f(v)-5 b(ariance)26
-b(v)-5 b(alues.)340 3838 y Fi(\017)45 b Fj(AST)p Ft(__)p
-Fj(USEBAD:)33 b(Indicates)g(that)h(there)f(ma)n(y)f(b)r(e)i(bad)f
-(pixels)f(in)i(the)f(input)h(arra)n(y\(s\))d(whic)n(h)i(m)n(ust)427
-3938 y(b)r(e)26 b(recognised)d(b)n(y)i(comparing)e(with)j(the)f(v)-5
-b(alue)25 b(giv)n(en)g(for)f(BAD)n(V)-9 b(AL)26 b(and)e(propagated)g
-(to)h(the)g(output)427 4038 y(arra)n(y\(s\).)41 b(If)30
-b(this)g(\015ag)f(is)g(not)h(set,)g(all)f(input)h(v)-5
-b(alues)30 b(are)e(treated)h(literally)g(and)h(the)g(BAD)n(V)-9
-b(AL)30 b(v)-5 b(alue)427 4137 y(is)28 b(only)f(used)h(for)f
-(\015agging)f(output)i(arra)n(y)d(v)-5 b(alues.)340 4268
+(eing)g(returned.)427 3135 y(The)d(normalisation)d(factor)i(for)g(eac)n
+(h)f(output)i(data)f(v)-5 b(alue)26 b(is)g(just)h(the)g(corresp)r
+(onding)d(v)-5 b(alue)26 b(from)g(the)427 3235 y(w)n(eigh)n(ts)31
+b(arra)n(y)-7 b(.)46 b(The)31 b(normalisation)f(factor)g(for)h(eac)n(h)
+g(output)g(v)-5 b(ariance)31 b(v)-5 b(alue)31 b(is)g(the)h(square)e(of)
+h(the)427 3334 y(data)23 b(v)-5 b(alue)22 b(normalisation)f(factor.)35
+b(In)23 b(addition)g(the)g(whole)f(dat)h(aarra)n(y)d(is)j(then)g
+(scaled)f(b)n(y)h(a)f(constan)n(t)427 3434 y(factor)j(to)h(ensure)f
+(the)h(total)f(data)g(v)-5 b(alue)26 b(in)g(the)g(output)g(is)g(unc)n
+(hanged)f(b)n(y)g(the)h(earlier)e(normalisation.)427
+3534 y(It)32 b(also)e(causes)h(output)h(data)f(v)-5 b(alues)31
+b(to)g(b)r(e)h(set)g(bad)f(if)h(the)g(corresp)r(onding)d(w)n(eigh)n(t)i
+(is)h(less)f(than)g(the)427 3633 y(v)-5 b(alue)25 b(supplied)g(for)g
+(argumen)n(t)e(WLIM.)j(It)f(also)f(causes)f(an)n(y)i(temp)r(orary)e(v)
+-5 b(alues)25 b(stored)f(in)h(the)g(output)427 3733 y(v)-5
+b(ariance)26 b(arra)n(y)f(\(see)i(\015ag)f(AST)p Ft(__)p
+Fj(GENV)-9 b(AR)27 b(b)r(elo)n(w\))g(to)g(b)r(e)h(con)n(v)n(erted)d(in)
+n(to)i(usable)g(v)-5 b(ariance)26 b(v)-5 b(alues.)340
+3855 y Fi(\017)45 b Fj(AST)p Ft(__)p Fj(USEBAD:)33 b(Indicates)g(that)h
+(there)f(ma)n(y)f(b)r(e)i(bad)f(pixels)f(in)i(the)f(input)h(arra)n
+(y\(s\))d(whic)n(h)i(m)n(ust)427 3955 y(b)r(e)26 b(recognised)d(b)n(y)i
+(comparing)e(with)j(the)f(v)-5 b(alue)25 b(giv)n(en)g(for)f(BAD)n(V)-9
+b(AL)26 b(and)e(propagated)g(to)h(the)g(output)427 4054
+y(arra)n(y\(s\).)41 b(If)30 b(this)g(\015ag)f(is)g(not)h(set,)g(all)f
+(input)h(v)-5 b(alues)30 b(are)e(treated)h(literally)g(and)h(the)g(BAD)
+n(V)-9 b(AL)30 b(v)-5 b(alue)427 4154 y(is)28 b(only)f(used)h(for)f
+(\015agging)f(output)i(arra)n(y)d(v)-5 b(alues.)340 4276
 y Fi(\017)45 b Fj(AST)p Ft(__)p Fj(USEV)-9 b(AR:)36 b(Indicates)g(that)
 g(output)h(v)-5 b(ariance)35 b(estimates)h(should)f(b)r(e)i(created)e
-(b)n(y)h(rebinning)427 4367 y(the)g(supplied)f(input)h(v)-5
+(b)n(y)h(rebinning)427 4375 y(the)g(supplied)f(input)h(v)-5
 b(ariance)33 b(estimates.)59 b(An)35 b(error)e(will)j(b)r(e)f(rep)r
 (orted)f(if)i(b)r(oth)f(this)g(\015ag)f(and)h(the)427
-4467 y(AST)p Ft(__)p Fj(GENV)-9 b(AR)28 b(\015ag)f(are)f(supplied.)340
+4475 y(AST)p Ft(__)p Fj(GENV)-9 b(AR)28 b(\015ag)f(are)f(supplied.)340
 4597 y Fi(\017)45 b Fj(AST)p Ft(__)p Fj(GENV)-9 b(AR:)33
 b(Indicates)g(that)h(output)f(v)-5 b(ariance)32 b(estimates)h(should)g
 (b)r(e)g(created)g(based)f(on)h(the)427 4697 y(spread)19
@@ -122689,9 +122695,9 @@ b(ariances)42 b(represen)n(t)g(v)-5 b(ariances)42 b(on)h(the)h(output)g
 (mean)f(v)-5 b(alues.)83 b(If)427 650 y(AST)p Ft(__)p
 Fj(DISV)-9 b(AR)23 b(is)f(sp)r(eci\014ed,)i(the)f(generated)e(v)-5
 b(ariances)21 b(represen)n(t)g(the)h(v)-5 b(ariance)22
-b(of)g(the)g(distribution)427 750 y(from)i(whic)n(h)g(the)g(input)h(v)
--5 b(alues)23 b(w)n(ere)g(tak)n(en.)35 b(Eaxc)n(h)23
-b(output)h(v)-5 b(ariance)23 b(created)g(with)h(AST)p
+b(of)g(the)g(distribution)427 750 y(from)28 b(whic)n(h)f(the)h(input)h
+(v)-5 b(alues)27 b(w)n(ere)g(tak)n(en.)37 b(Eac)n(h)26
+b(output)i(v)-5 b(ariance)27 b(created)g(with)h(AST)p
 Ft(__)p Fj(DISV)-9 b(AR)427 849 y(will)29 b(b)r(e)h(larger)d(than)i
 (that)g(created)f(without)h(AST)p Ft(__)p Fj(DISV)-9
 b(AR)30 b(b)n(y)e(a)h(factor)f(equal)g(to)h(the)g(n)n(um)n(b)r(er)g(of)
@@ -143830,53 +143836,64 @@ Fy(_)p FG(pal)h(library)f(is)h(no)f(longer)h(built)f(if)g(the)h
 %%Page: 606 616
 TeXDict begin 606 615 bop 0 52 a FG(606)2013 b Fz(G)91
 b(CHANGES)31 b(AND)g(NEW)g(FEA)-8 b(TURES)0 351 y Fw(G.49)112
-b(Changes)39 b(In)m(tro)s(duced)f(in)f(V7.0.3)0 573 y
+b(Changes)39 b(In)m(tro)s(duced)f(in)f(V7.0.3)0 558 y
 FG(The)26 b(follo)m(wing)i(describ)s(es)d(the)i(most)f(signi\014can)m
 (t)i(c)m(hanges)f(whic)m(h)f(o)s(ccurred)g(in)g(the)g(AST)g(library)g
-(b)s(et)m(w)m(een)0 686 y(v)m(ersions)31 b(V7.0.2)h(and)e(V7.0.3:)111
-948 y(1.)46 b(A)32 b(bug)f(has)g(b)s(een)g(\014xed)g(whic)m(h)h(could)f
+(b)s(et)m(w)m(een)0 671 y(v)m(ersions)31 b(V7.0.2)h(and)e(V7.0.3:)111
+876 y(1.)46 b(A)32 b(bug)f(has)g(b)s(een)g(\014xed)g(whic)m(h)h(could)f
 (cause)i(an)e(incorrect)i(axis)f(to)g(b)s(e)f(used)g(when)g(accessing)i
-(axis)227 1061 y(attributes)27 b(within)e(CmpF)-8 b(rames.)39
+(axis)227 989 y(attributes)27 b(within)e(CmpF)-8 b(rames.)39
 b(This)25 b(could)h(happ)s(en)e(if)i(axes)g(within)f(the)h(CmpF)-8
-b(rame)26 b(ha)m(v)m(e)h(b)s(een)227 1174 y(p)s(erm)m(uted.)111
-1361 y(2.)46 b(A)28 b(bug)f(has)h(b)s(een)f(\014xed)g(in)h(the)g(SkyF)
+b(rame)26 b(ha)m(v)m(e)h(b)s(een)227 1102 y(p)s(erm)m(uted.)111
+1275 y(2.)46 b(A)28 b(bug)f(has)h(b)s(een)f(\014xed)g(in)h(the)g(SkyF)
 -8 b(rame)28 b(class)g(that)h(could)e(cause)i(the)f(t)m(w)m(o)h(v)-5
-b(alues)28 b(of)g(the)g(SkyRef)227 1474 y(and/or)j(SkyRefP)e
-(attributes)i(to)g(b)s(e)f(rev)m(ersed.)111 1662 y(3.)46
+b(alues)28 b(of)g(the)g(SkyRef)227 1388 y(and/or)j(SkyRefP)e
+(attributes)i(to)g(b)s(e)f(rev)m(ersed.)111 1561 y(3.)46
 b(Bugs)e(ha)m(v)m(e)h(b)s(een)e(\014xed)h(in)f(the)h(CmpRegion)g(class)
 g(that)h(should)e(allo)m(w)i(the)f(b)s(order)e(around)h(a)227
-1775 y(comp)s(ound)22 b(Region)j(to)f(b)s(e)f(plotted)h(more)g(quic)m
+1674 y(comp)s(ound)22 b(Region)j(to)f(b)s(e)f(plotted)h(more)g(quic)m
 (kly)-8 b(,)26 b(and)d(more)h(accurately)-8 b(.)41 b(Previously)-8
-b(,)25 b(comp)s(onen)m(t)227 1888 y(Regions)h(nested)g(deeply)f(inside)
+b(,)25 b(comp)s(onen)m(t)227 1787 y(Regions)h(nested)g(deeply)f(inside)
 g(a)g(CmpRegion)h(ma)m(y)f(ha)m(v)m(e)i(b)s(een)e(completely)i(or)e
-(partially)h(ignored.)111 2075 y(4.)46 b(A)d(bug)f(has)h(b)s(een)f
+(partially)h(ignored.)111 1960 y(4.)46 b(A)d(bug)f(has)h(b)s(een)f
 (\014xed)g(in)g(the)h(Plot3D)i(class)f(that)f(caused)g(a)g(segmen)m
-(tation)i(violation)g(if)d(the)227 2188 y(MinTic)m(k)31
-b(attribute)h(w)m(as)e(set)h(to)g(zero.)111 2376 y(5.)46
+(tation)i(violation)g(if)d(the)227 2073 y(MinTic)m(k)31
+b(attribute)h(w)m(as)e(set)h(to)g(zero.)111 2247 y(5.)46
 b(The)31 b(astResampleX)i(set)f(of)g(metho)s(ds)f(no)m(w)g(includes)g
-(astResampleK)h(and)f(astResampleUK)i(that)227 2489 y(handles)d(64)h
-(bit)g(in)m(teger)g(data.)0 2782 y Fw(G.50)112 b(Changes)39
-b(In)m(tro)s(duced)f(in)f(V7.0.4)0 3004 y FG(The)26 b(follo)m(wing)i
+(astResampleK)h(and)f(astResampleUK)i(that)227 2360 y(handles)d(64)h
+(bit)g(in)m(teger)g(data.)0 2632 y Fw(G.50)112 b(Changes)39
+b(In)m(tro)s(duced)f(in)f(V7.0.4)0 2839 y FG(The)26 b(follo)m(wing)i
 (describ)s(es)d(the)i(most)f(signi\014can)m(t)i(c)m(hanges)f(whic)m(h)f
 (o)s(ccurred)g(in)g(the)g(AST)g(library)g(b)s(et)m(w)m(een)0
-3116 y(v)m(ersions)31 b(V7.0.3)h(and)e(V7.0.4:)111 3379
+2952 y(v)m(ersions)31 b(V7.0.3)h(and)e(V7.0.4:)111 3156
 y(1.)46 b(The)30 b(previously)g(priv)-5 b(ate)31 b(grf3d.h)f(header)g
 (\014le)h(is)f(no)m(w)g(installed)i(in)m(to)f(pre\014x/include.)0
-3672 y Fw(G.51)112 b(Changes)39 b(In)m(tro)s(duced)f(in)f(V7.0.5)0
-3893 y FG(The)g(follo)m(wing)h(describ)s(es)f(the)g(most)h
+3429 y Fw(G.51)112 b(Changes)39 b(In)m(tro)s(duced)f(in)f(V7.0.5)0
+3636 y FG(The)26 b(follo)m(wing)i(describ)s(es)d(the)i(most)f
+(signi\014can)m(t)i(c)m(hanges)f(whic)m(h)f(o)s(ccurred)g(in)g(the)g
+(AST)g(library)g(b)s(et)m(w)m(een)0 3749 y(v)m(ersions)31
+b(V7.0.4)h(and)e(V7.0.5:)111 3953 y(1.)46 b(The)35 b(FitsChan)h(class)g
+(can)g(no)m(w)g(read)f(FITS)g(headers)h(that)g(use)f(the)h(SA)m(O)f
+(con)m(v)m(en)m(tion)j(for)e(repre-)227 4066 y(sen)m(ting)j(distorted)f
+(T)-8 b(AN)39 b(pro)5 b(jections,)41 b(based)c(on)h(the)g(use)g(of)g
+(\\COi)p Fy(_)p FG(m")g(k)m(eyw)m(ords)h(to)g(hold)e(the)227
+4179 y(co)s(e\016cien)m(ts)32 b(of)f(the)f(distortion)h(p)s(olynomial.)
+0 4451 y Fw(G.52)112 b(Changes)39 b(In)m(tro)s(duced)f(in)f(V7.0.6)0
+4658 y FG(The)g(follo)m(wing)h(describ)s(es)f(the)g(most)h
 (signi\014can)m(t)g(c)m(hanges)g(whic)m(h)f(ha)m(v)m(e)i(o)s(ccurred)d
-(in)h(the)g(AST)g(library)0 4006 y(b)s(et)m(w)m(een)31
-b(v)m(ersions)g(V7.0.4)h(and)e(V7.0.5)i(\(the)f(curren)m(t)f(v)m
-(ersion\):)111 4269 y(1.)46 b(The)35 b(FitsChan)h(class)g(can)g(no)m(w)
-g(read)f(FITS)g(headers)h(that)g(use)f(the)h(SA)m(O)f(con)m(v)m(en)m
-(tion)j(for)e(repre-)227 4382 y(sen)m(ting)j(distorted)f(T)-8
-b(AN)39 b(pro)5 b(jections,)41 b(based)c(on)h(the)g(use)g(of)g(\\COi)p
-Fy(_)p FG(m")g(k)m(eyw)m(ords)h(to)g(hold)e(the)227 4495
-y(co)s(e\016cien)m(ts)32 b(of)f(the)f(distortion)h(p)s(olynomial.)0
-4757 y(Programs)25 b(whic)m(h)g(are)h(statically)h(link)m(ed)f(will)f
-(need)g(to)h(b)s(e)f(re-link)m(ed)g(in)g(order)g(to)h(tak)m(e)h(adv)-5
-b(an)m(tage)27 b(of)e(these)0 4870 y(new)30 b(facilities.)p
-eop end
+(in)h(the)g(AST)g(library)0 4771 y(b)s(et)m(w)m(een)31
+b(v)m(ersions)g(V7.0.5)h(and)e(V7.0.6)i(\(the)f(curren)m(t)f(v)m
+(ersion\):)111 4976 y(1.)46 b(A)33 b(bug)g(has)f(b)s(een)g(\014xed)h
+(in)f(astRebinSeq<X>)i(whic)m(h)e(could)h(result)g(in)f(incorrect)i
+(normalisation)g(of)227 5089 y(the)d(\014nal)f(binned)f(data)i(and)f(v)
+-5 b(ariance)31 b(v)-5 b(alues.)111 5262 y(2.)46 b(When)30
+b(reading)f(a)h(F)-8 b(rameSet)31 b(from)e(a)h(FITS-DSS)f(header,)h
+(the)g(k)m(eyw)m(ords)g(CNPIX1)f(and)g(CNPIX2)227 5375
+y(no)m(w)i(default)f(to)h(zero)h(if)e(absen)m(t.)41 b(Previously)31
+b(an)f(error)g(w)m(as)h(rep)s(orted.)0 5580 y(Programs)25
+b(whic)m(h)g(are)h(statically)h(link)m(ed)f(will)f(need)g(to)h(b)s(e)f
+(re-link)m(ed)g(in)g(order)g(to)h(tak)m(e)h(adv)-5 b(an)m(tage)27
+b(of)e(these)0 5693 y(new)30 b(facilities.)p eop end
 %%Trailer
 
 userdict /end-hook known{end-hook}if
diff --git a/sun210.tex b/sun210.tex
index 9bf055f..532835d 100644
--- a/sun210.tex
+++ b/sun210.tex
@@ -25872,11 +25872,11 @@ Object             - Base class for all AST Objects
       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
+      the input and output grids. The normalised values are then multiplied
+      by a constant scaling factor to ensure that the total data sum is
+      unchanged. 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
@@ -26253,8 +26253,11 @@ Object             - Base class for all AST Objects
          returned. The normalisation factor for each output data value is just the
          corresponding value from the weights array. The normalisation factor
          for each output variance value is the square of the data value
-         normalisation factor. It also causes output data values to be set
-         bad if the corresponding weight is less than the value supplied for
+         normalisation factor. In addition the whole dat aarray is then
+         scaled by a constant factor to ensure the total data value in the output
+         is unchanged by the earlier normalisation. It also causes output data
+         values to be set bad if the corresponding weight is less than the value
+         supplied for
          argument WLIM.
          It also causes any temporary values stored in the output variance array
          (see flag AST\_\_GENVAR below) to be converted into usable variance values.
@@ -26298,7 +26301,7 @@ Object             - Base class for all AST Objects
          the generated output variances. If AST\_\_DISVAR is not specified,
          generated variances represent variances on the output mean  values. If
          AST\_\_DISVAR is specified, the generated variances represent the variance
-         of the distribution from which the input values were taken. Eaxch output
+         of the distribution from which the input values were taken. Each output
          variance created with AST\_\_DISVAR will be larger than that created
          without AST\_\_DISVAR by a factor equal to the number of input samples
          that contribute to the output sample.
@@ -50079,12 +50082,10 @@ prefix/include.
 \end{enumerate}
 
 
-\subsection{\xlabel{changes}\xlabel{list_of_most_recent_changes}Changes
-Introduced in V7.0.5}
+\subsection{Changes Introduced in V7.0.5}
 
-The following describes the most significant changes which have
-occurred in the AST library between versions V7.0.4 and V7.0.5 (the
-current version):
+The following describes the most significant changes which
+occurred in the AST library between versions V7.0.4 and V7.0.5:
 
 \begin{enumerate}
 
@@ -50095,6 +50096,24 @@ of ``COi\_m'' keywords to hold the coefficients of the distortion polynomial.
 \end{enumerate}
 
 
+\subsection{\xlabel{changes}\xlabel{list_of_most_recent_changes}Changes
+Introduced in V7.0.6}
+
+The following describes the most significant changes which have
+occurred in the AST library between versions V7.0.5 and V7.0.6 (the
+current version):
+
+\begin{enumerate}
+
+\item A bug has been fixed in astRebinSeq<X> which could result in
+incorrect normalisation of the final binned data and variance values.
+
+\item When reading a \htmlref{FrameSet}{FrameSet} from a FITS-DSS header, the keywords CNPIX1
+and CNPIX2 now default to zero if absent. Previously an error was reported.
+
+\end{enumerate}
+
+
 Programs which are statically linked will need to be re-linked in
 order to take advantage of these new facilities.
 
diff --git a/sun211.htx_tar b/sun211.htx_tar
index 6e901c4..3655898 100644
Binary files a/sun211.htx_tar and b/sun211.htx_tar differ
diff --git a/sun211.ps b/sun211.ps
index 39af2bc..a55c0fe 100644
--- a/sun211.ps
+++ b/sun211.ps
@@ -1,7 +1,7 @@
 %!PS-Adobe-2.0
 %%Creator: dvips(k) 5.96.1 Copyright 2007 Radical Eye Software
 %%Title: sun211.dvi
-%%CreationDate: Thu Jun 28 12:00:22 2012
+%%CreationDate: Fri Aug 10 10:03:13 2012
 %%Pages: 637
 %%PageOrder: Ascend
 %%BoundingBox: 0 0 595 842
@@ -13,7 +13,7 @@
 %DVIPSWebPage: (www.radicaleye.com)
 %DVIPSCommandLine: dvips -f sun211
 %DVIPSParameters: dpi=600
-%DVIPSSource:  TeX output 2012.06.28:1200
+%DVIPSSource:  TeX output 2012.08.10:1003
 %%BeginProcSet: tex.pro 0 0
 %!
 /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
@@ -49227,6 +49227,9 @@ b(.)f(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f
 (.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)60 b(627)136
 2948 y(H.51)26 b(Changes)31 b(In)m(tro)s(duced)e(in)h(V7.0.5)47
 b(.)f(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f
+(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)60 b(627)136
+3061 y(H.52)26 b(Changes)31 b(In)m(tro)s(duced)e(in)h(V7.0.6)47
+b(.)f(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f
 (.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)60 b(627)p
 eop end
 %%Page: 10 10
@@ -122533,20 +122536,20 @@ b(\015ag.)227 2121 y(The)36 b(last)g(call)g(in)g(a)g(sequence)f(is)h
 Fi(REBINEND)e(\015ag.)62 b(This)36 b(causes)227 2221
 y(the)c(output)f(data)g(and)f(v)-5 b(ariance)30 b(arra)n(ys)e(to)j(b)r
 (e)h(normalised)d(b)r(efore)i(b)r(eing)g(returned.)46
-b(This)31 b(normalisation)227 2321 y(consists)j(of)g(dividing)h(the)g
-(data)f(arra)n(y)e(b)n(y)i(the)h(w)n(eigh)n(ts)f(arra)n(y)-7
-b(,)34 b(and)g(can)g(eliminate)h(artifacts)f(whic)n(h)g(ma)n(y)227
-2420 y(b)r(e)e(in)n(tro)r(duced)f(in)n(to)g(the)h(rebinned)f(data)g(as)
-g(a)g(consequence)f(of)i(aliasing)e(b)r(et)n(w)n(een)h(the)h(input)g
-(and)f(output)227 2520 y(grids.)55 b(Ho)n(w)n(ev)n(er,)34
-b(it)g(can)g(also)f(result)g(in)i(small)e(c)n(hanges)g(to)h(the)g
-(total)g(pixel)g(v)-5 b(alue)34 b(in)g(an)n(y)f(giv)n(en)g(area)g(of)
-227 2619 y(the)26 b(output)h(arra)n(y)-7 b(.)34 b(In)25
-b(addition)h(to)f(normalisation)f(of)i(the)g(output)g(data)g(v)-5
-b(alues,)25 b(an)n(y)g(output)h(v)-5 b(ariances)25 b(are)227
-2719 y(also)g(appropriately)e(normalised,)i(and)h(an)n(y)e(output)j
-(data)e(v)-5 b(alues)25 b(with)h(w)n(eigh)n(t)f(less)g(than)h
-Ft(")p Fi(wlim)p Ft(")f Fi(are)f(set)i(to)227 2819 y
+b(This)31 b(normalisation)227 2321 y(consists)c(of)g(dividing)g(the)g
+(data)g(arra)n(y)e(b)n(y)i(the)g(w)n(eigh)n(ts)f(arra)n(y)-7
+b(,)25 b(and)i(can)g(eliminate)g(artifacts)g(whic)n(h)g(ma)n(y)f(b)r(e)
+227 2420 y(in)n(tro)r(duced)e(in)n(to)f(the)i(rebinned)e(data)h(as)f(a)
+g(consequence)g(of)h(aliasing)e(b)r(et)n(w)n(een)i(the)g(input)h(and)e
+(output)i(grids.)227 2520 y(The)e(normalised)e(v)-5 b(alues)22
+b(are)g(then)h(m)n(ultiplied)g(b)n(y)g(a)f(constan)n(t)f(scaling)h
+(factor)g(to)g(ensure)g(that)h(the)g(total)f(data)227
+2619 y(sum)32 b(is)f(unc)n(hanged.)49 b(In)31 b(addition)h(to)f
+(normalisation)f(of)i(the)g(output)g(data)f(v)-5 b(alues,)32
+b(an)n(y)f(output)h(v)-5 b(ariances)227 2719 y(are)31
+b(also)g(appropriately)f(normalised,)i(and)g(an)n(y)f(output)i(data)e
+(v)-5 b(alues)32 b(with)g(w)n(eigh)n(t)g(less)f(than)h
+Ft(")p Fi(wlim)p Ft(")g Fi(are)227 2819 y(set)c(to)f
 Ft(")p Fi(badv)-5 b(al)p Ft(")p Fi(.)227 2938 y(Output)34
 b(v)-5 b(ariances)32 b(can)h(b)r(e)g(generated)f(in)i(t)n(w)n(o)e(w)n
 (a)n(ys;)j(b)n(y)d(rebinning)h(the)h(supplied)f(input)h(v)-5
@@ -122925,110 +122928,114 @@ b Fi(AST)p Ft(__)p Fi(REBINEND:)34 b(Used)h(to)g(mark)f(the)h(last)f
 b(alue)34 b(in)h(the)427 451 y Ft(")p Fi(out)p Ft(")c
 Fi(and)h Ft(")p Fi(out)p Ft(_)p Fi(v)-5 b(ar)p Ft(")30
 b Fi(arra)n(ys)g(to)i(b)r(e)g(divided)g(b)n(y)g(a)g(normalisation)e
-(factor)h(b)r(efore)h(b)r(eing)g(returned.)427 551 y(The)38
-b(normalisation)d(factor)h(for)h(eac)n(h)g(output)g(data)g(v)-5
-b(alue)37 b(is)g(just)h(the)g(corresp)r(onding)d(v)-5
-b(alue)37 b(from)427 650 y(the)32 b(w)n(eigh)n(ts)e(arra)n(y)-7
-b(.)46 b(The)32 b(normalisation)d(factor)i(for)g(eac)n(h)f(output)i(v)
--5 b(ariance)30 b(v)-5 b(alue)32 b(is)f(the)h(square)e(of)427
-750 y(the)k(data)e(v)-5 b(alue)33 b(normalisation)e(factor.)53
-b(It)33 b(also)f(causes)g(output)h(data)g(v)-5 b(alues)33
-b(to)f(b)r(e)i(set)f(bad)g(if)g(the)427 849 y(corresp)r(onding)22
-b(w)n(eigh)n(t)i(is)g(less)f(than)i(the)f(v)-5 b(alue)24
-b(supplied)g(for)g(parameter)f Ft(")p Fi(wlim)p Ft(")p
-Fi(.)35 b(It)24 b(also)f(causes)g(an)n(y)427 949 y(temp)r(orary)i(v)-5
-b(alues)25 b(stored)f(in)i(the)g(output)g(v)-5 b(ariance)25
-b(arra)n(y)e(\(see)i(\015ag)g(AST)p Ft(__)p Fi(GENV)-9
-b(AR)25 b(b)r(elo)n(w\))h(to)f(b)r(e)427 1049 y(con)n(v)n(erted)h(in)n
-(to)i(usable)f(v)-5 b(ariance)26 b(v)-5 b(alues.)340
-1194 y Fh(\017)45 b Fi(AST)p Ft(__)p Fi(USEBAD:)33 b(Indicates)g(that)h
+(factor)h(b)r(efore)h(b)r(eing)g(returned.)427 551 y(The)27
+b(normalisation)d(factor)i(for)g(eac)n(h)f(output)i(data)f(v)-5
+b(alue)26 b(is)g(just)h(the)g(corresp)r(onding)d(v)-5
+b(alue)26 b(from)g(the)427 650 y(w)n(eigh)n(ts)31 b(arra)n(y)-7
+b(.)46 b(The)31 b(normalisation)f(factor)g(for)h(eac)n(h)g(output)g(v)
+-5 b(ariance)31 b(v)-5 b(alue)31 b(is)g(the)h(square)e(of)h(the)427
+750 y(data)23 b(v)-5 b(alue)22 b(normalisation)f(factor.)35
+b(In)23 b(addition)g(the)g(whole)f(dat)h(aarra)n(y)d(is)j(then)g
+(scaled)f(b)n(y)h(a)f(constan)n(t)427 849 y(factor)j(to)h(ensure)f(the)
+h(total)f(data)g(v)-5 b(alue)26 b(in)g(the)g(output)g(is)g(unc)n
+(hanged)f(b)n(y)g(the)h(earlier)e(normalisation.)427
+949 y(It)32 b(also)e(causes)h(output)h(data)f(v)-5 b(alues)31
+b(to)g(b)r(e)h(set)g(bad)f(if)h(the)g(corresp)r(onding)d(w)n(eigh)n(t)i
+(is)h(less)f(than)g(the)427 1049 y(v)-5 b(alue)21 b(supplied)g(for)f
+(parameter)f Ft(")p Fi(wlim)p Ft(")p Fi(.)34 b(It)21
+b(also)f(causes)g(an)n(y)f(temp)r(orary)h(v)-5 b(alues)20
+b(stored)g(in)h(the)g(output)427 1148 y(v)-5 b(ariance)26
+b(arra)n(y)f(\(see)i(\015ag)f(AST)p Ft(__)p Fi(GENV)-9
+b(AR)27 b(b)r(elo)n(w\))g(to)g(b)r(e)h(con)n(v)n(erted)d(in)n(to)i
+(usable)g(v)-5 b(ariance)26 b(v)-5 b(alues.)340 1284
+y Fh(\017)45 b Fi(AST)p Ft(__)p Fi(USEBAD:)33 b(Indicates)g(that)h
 (there)f(ma)n(y)f(b)r(e)i(bad)f(pixels)f(in)i(the)f(input)h(arra)n
-(y\(s\))d(whic)n(h)i(m)n(ust)427 1293 y(b)r(e)27 b(recognised)f(b)n(y)g
+(y\(s\))d(whic)n(h)i(m)n(ust)427 1384 y(b)r(e)27 b(recognised)f(b)n(y)g
 (comparing)g(with)h(the)g(v)-5 b(alue)27 b(giv)n(en)f(for)g
 Ft(")p Fi(badv)-5 b(al)p Ft(")26 b Fi(and)g(propagated)f(to)i(the)g
-(output)427 1393 y(arra)n(y\(s\).)35 b(If)26 b(this)h(\015ag)e(is)h
+(output)427 1483 y(arra)n(y\(s\).)35 b(If)26 b(this)h(\015ag)e(is)h
 (not)g(set,)h(all)f(input)h(v)-5 b(alues)26 b(are)f(treated)h
 (literally)f(and)h(the)h Ft(")p Fi(badv)-5 b(al)p Ft(")25
-b Fi(v)-5 b(alue)26 b(is)427 1493 y(only)h(used)h(for)f(\015agging)f
-(output)i(arra)n(y)d(v)-5 b(alues.)340 1638 y Fh(\017)45
+b Fi(v)-5 b(alue)26 b(is)427 1583 y(only)h(used)h(for)f(\015agging)f
+(output)i(arra)n(y)d(v)-5 b(alues.)340 1719 y Fh(\017)45
 b Fi(AST)p Ft(__)p Fi(USEV)-9 b(AR:)36 b(Indicates)g(that)g(output)h(v)
 -5 b(ariance)35 b(estimates)h(should)f(b)r(e)i(created)e(b)n(y)h
-(rebinning)427 1737 y(the)g(supplied)f(input)h(v)-5 b(ariance)33
+(rebinning)427 1819 y(the)g(supplied)f(input)h(v)-5 b(ariance)33
 b(estimates.)59 b(An)35 b(error)e(will)j(b)r(e)f(rep)r(orted)f(if)i(b)r
-(oth)f(this)g(\015ag)f(and)h(the)427 1837 y(AST)p Ft(__)p
-Fi(GENV)-9 b(AR)28 b(\015ag)f(are)f(supplied.)340 1982
+(oth)f(this)g(\015ag)f(and)h(the)427 1918 y(AST)p Ft(__)p
+Fi(GENV)-9 b(AR)28 b(\015ag)f(are)f(supplied.)340 2054
 y Fh(\017)45 b Fi(AST)p Ft(__)p Fi(GENV)-9 b(AR:)33 b(Indicates)g(that)
 h(output)f(v)-5 b(ariance)32 b(estimates)h(should)g(b)r(e)g(created)g
-(based)f(on)h(the)427 2081 y(spread)19 b(of)h(input)h(data)e(v)-5
+(based)f(on)h(the)427 2154 y(spread)19 b(of)h(input)h(data)e(v)-5
 b(alues)19 b(con)n(tributing)h(to)f(eac)n(h)g(output)i(pixel.)34
 b(An)20 b(error)e(will)i(b)r(e)h(rep)r(orted)e(if)h(b)r(oth)427
-2181 y(this)29 b(\015ag)e(and)h(the)h(AST)p Ft(__)p Fi(USEV)-9
+2254 y(this)29 b(\015ag)e(and)h(the)h(AST)p Ft(__)p Fi(USEV)-9
 b(AR)28 b(\015ag)f(are)g(supplied.)39 b(If)29 b(the)g(AST)p
 Ft(__)p Fi(GENV)-9 b(AR)28 b(\015ag)f(is)h(sp)r(eci\014ed,)427
-2281 y(the)e(supplied)g(output)h(v)-5 b(ariance)24 b(arra)n(y)g(is)h
+2353 y(the)e(supplied)g(output)h(v)-5 b(ariance)24 b(arra)n(y)g(is)h
 (\014rst)h(used)f(as)g(a)h(w)n(ork)e(arra)n(y)f(to)j(accum)n(ulate)f
-(the)h(temp)r(orary)427 2380 y(v)-5 b(alues)33 b(needed)h(to)f
+(the)h(temp)r(orary)427 2453 y(v)-5 b(alues)33 b(needed)h(to)f
 (generate)g(the)h(output)g(v)-5 b(ariances.)53 b(When)34
 b(the)g(sequence)f(ends)g(\(as)g(indicated)h(b)n(y)427
-2480 y(the)h(AST)p Ft(__)p Fi(REBINEND)f(\015ag\),)i(the)f(con)n(ten)n
+2552 y(the)h(AST)p Ft(__)p Fi(REBINEND)f(\015ag\),)i(the)f(con)n(ten)n
 (ts)f(of)g(the)h(output)g(v)-5 b(ariance)33 b(arra)n(y)f(are)i(con)n(v)
-n(erted)f(in)n(to)427 2580 y(the)f(required)d(v)-5 b(ariance)30
+n(erted)f(in)n(to)427 2652 y(the)f(required)d(v)-5 b(ariance)30
 b(estimates.)47 b(If)31 b(the)g(generation)f(of)g(suc)n(h)h(output)g(v)
--5 b(ariances)30 b(is)h(required,)f(this)427 2679 y(\015ag)d(should)g
+-5 b(ariances)30 b(is)h(required,)f(this)427 2752 y(\015ag)d(should)g
 (b)r(e)h(used)g(on)f(ev)n(ery)f(in)n(v)n(o)r(cation)g(of)i(this)g
 (function)g(within)g(a)f(sequence,)g(and)h(an)n(y)e(supplied)427
-2779 y(input)37 b(v)-5 b(ariances)35 b(will)i(ha)n(v)n(e)e(no)h
+2851 y(input)37 b(v)-5 b(ariances)35 b(will)i(ha)n(v)n(e)e(no)h
 (e\013ect)h(on)f(the)h(output)g(v)-5 b(ariances)35 b(\(although)h
-(input)h(v)-5 b(ariances)35 b(will)427 2879 y(still)i(b)r(e)g(used)f
+(input)h(v)-5 b(ariances)35 b(will)427 2951 y(still)i(b)r(e)g(used)f
 (to)h(w)n(eigh)n(t)e(the)i(input)g(data)f(if)h(the)g(AST)p
 Ft(__)p Fi(V)-9 b(AR)g(W)n(GT)36 b(\015ag)g(is)g(also)g(supplied\).)64
-b(The)427 2978 y(statistical)29 b(meaning)f(of)g(these)h(output)g(v)-5
+b(The)427 3051 y(statistical)29 b(meaning)f(of)g(these)h(output)g(v)-5
 b(arianes)28 b(is)g(determined)h(b)n(y)g(the)g(presence)f(or)g(absence)
-g(of)g(the)427 3078 y(AST)p Ft(__)p Fi(DISV)-9 b(AR)28
-b(\015ag)f(\(see)h(b)r(elo)n(w\).)340 3223 y Fh(\017)45
+g(of)g(the)427 3150 y(AST)p Ft(__)p Fi(DISV)-9 b(AR)28
+b(\015ag)f(\(see)h(b)r(elo)n(w\).)340 3286 y Fh(\017)45
 b Fi(AST)p Ft(__)p Fi(DISV)-9 b(AR:)26 b(This)g(\015ag)f(is)g(ignored)f
 (unless)i(the)g(AST)p Ft(__)p Fi(GENV)-9 b(AR)25 b(\015ag)g(has)g(also)
-f(b)r(een)i(sp)r(eci\014ed.)427 3322 y(It)32 b(determines)g(the)g
+f(b)r(een)i(sp)r(eci\014ed.)427 3386 y(It)32 b(determines)g(the)g
 (statistical)g(meaning)f(of)h(the)g(generated)e(output)j(v)-5
 b(ariances.)48 b(If)32 b(AST)p Ft(__)p Fi(DISV)-9 b(AR)427
-3422 y(is)43 b(not)h(sp)r(eci\014ed,)j(generated)42 b(v)-5
+3485 y(is)43 b(not)h(sp)r(eci\014ed,)j(generated)42 b(v)-5
 b(ariances)42 b(represen)n(t)g(v)-5 b(ariances)42 b(on)h(the)h(output)g
-(mean)f(v)-5 b(alues.)83 b(If)427 3522 y(AST)p Ft(__)p
+(mean)f(v)-5 b(alues.)83 b(If)427 3585 y(AST)p Ft(__)p
 Fi(DISV)-9 b(AR)23 b(is)f(sp)r(eci\014ed,)i(the)f(generated)e(v)-5
 b(ariances)21 b(represen)n(t)g(the)h(v)-5 b(ariance)22
-b(of)g(the)g(distribution)427 3621 y(from)i(whic)n(h)g(the)g(input)h(v)
--5 b(alues)23 b(w)n(ere)g(tak)n(en.)35 b(Eaxc)n(h)23
-b(output)h(v)-5 b(ariance)23 b(created)g(with)h(AST)p
-Ft(__)p Fi(DISV)-9 b(AR)427 3721 y(will)29 b(b)r(e)h(larger)d(than)i
+b(of)g(the)g(distribution)427 3685 y(from)28 b(whic)n(h)f(the)h(input)h
+(v)-5 b(alues)27 b(w)n(ere)g(tak)n(en.)37 b(Eac)n(h)26
+b(output)i(v)-5 b(ariance)27 b(created)g(with)h(AST)p
+Ft(__)p Fi(DISV)-9 b(AR)427 3784 y(will)29 b(b)r(e)h(larger)d(than)i
 (that)g(created)f(without)h(AST)p Ft(__)p Fi(DISV)-9
 b(AR)30 b(b)n(y)e(a)h(factor)f(equal)g(to)h(the)g(n)n(um)n(b)r(er)g(of)
-427 3821 y(input)g(samples)e(that)g(con)n(tribute)h(to)f(the)h(output)g
-(sample.)340 3966 y Fh(\017)45 b Fi(AST)p Ft(__)p Fi(V)-9
+427 3884 y(input)g(samples)e(that)g(con)n(tribute)h(to)f(the)h(output)g
+(sample.)340 4020 y Fh(\017)45 b Fi(AST)p Ft(__)p Fi(V)-9
 b(AR)g(W)n(GT:)29 b(Indicates)f(that)h(the)g(input)g(data)f(should)h(b)
 r(e)g(w)n(eigh)n(ted)f(b)n(y)g(the)h(recipro)r(cal)e(of)h(the)427
-4065 y(input)e(v)-5 b(ariances.)35 b(Otherwise,)25 b(all)g(input)h
+4120 y(input)e(v)-5 b(ariances.)35 b(Otherwise,)25 b(all)g(input)h
 (data)f(are)g(giv)n(en)f(equal)h(w)n(eigh)n(t.)36 b(If)25
-b(this)h(\015ag)f(is)g(sp)r(eci\014ed,)h(the)427 4165
+b(this)h(\015ag)f(is)g(sp)r(eci\014ed,)h(the)427 4219
 y(calculation)e(of)h(the)g(output)g(v)-5 b(ariances)23
 b(\(if)i(an)n(y\))g(is)f(mo)r(di\014ed)h(to)g(tak)n(e)f(accoun)n(t)f
-(of)i(the)g(v)-5 b(arying)24 b(w)n(eigh)n(ts)427 4264
+(of)i(the)g(v)-5 b(arying)24 b(w)n(eigh)n(ts)427 4319
 y(assigned)j(to)g(the)h(input)h(data)e(v)-5 b(alues.)-2
-4451 y Fd(Propagation)33 b(of)e(Missing)f(Data)n(:)227
-4597 y Fi(Instances)40 b(of)h(missing)f(data)g(\(bad)h(pixels\))g(in)f
+4487 y Fd(Propagation)33 b(of)e(Missing)f(Data)n(:)227
+4633 y Fi(Instances)40 b(of)h(missing)f(data)g(\(bad)h(pixels\))g(in)f
 (the)h(output)h(grid)e(are)f(iden)n(ti\014ed)i(b)n(y)g(o)r(ccurrences)e
-(of)h(the)227 4696 y Ft(")p Fi(badv)-5 b(al)p Ft(")38
+(of)h(the)227 4733 y Ft(")p Fi(badv)-5 b(al)p Ft(")38
 b Fi(v)-5 b(alue)39 b(in)g(the)g Ft(")p Fi(out)p Ft(")f
 Fi(arra)n(y)-7 b(.)68 b(These)38 b(are)g(only)h(pro)r(duced)f(if)h(the)
-g(AST)p Ft(__)p Fi(REBINEND)g(\015ag)f(is)227 4796 y(sp)r(eci\014ed)28
-b(and)g(a)f(pixel)g(has)g(zero)g(w)n(eigh)n(t.)227 4933
+g(AST)p Ft(__)p Fi(REBINEND)g(\015ag)f(is)227 4832 y(sp)r(eci\014ed)28
+b(and)g(a)f(pixel)g(has)g(zero)g(w)n(eigh)n(t.)227 4960
 y(An)d(input)g(pixel)f(is)f(considered)g(bad)h(\(and)g(is)g(consequen)n
 (tly)f(ignored\))g(if)i(its)f(data)g(v)-5 b(alue)23 b(is)f(equal)h(to)g
-Ft(")p Fi(badv)-5 b(al)p Ft(")227 5032 y Fi(and)28 b(the)g(AST)p
+Ft(")p Fi(badv)-5 b(al)p Ft(")227 5060 y Fi(and)28 b(the)g(AST)p
 Ft(__)p Fi(USEBAD)f(\015ag)g(is)h(set)f(via)g(the)h Ft(")p
-Fi(\015ags)p Ft(")e Fi(parameter.)227 5169 y(In)j(addition,)f(asso)r
+Fi(\015ags)p Ft(")e Fi(parameter.)227 5187 y(In)j(addition,)f(asso)r
 (ciated)f(output)i(v)-5 b(ariance)27 b(estimates)h(\(if)i(calculated\))
 e(ma)n(y)f(b)r(e)i(declared)e(bad)i(and)f(\015agged)227
-5269 y(with)g(the)g Ft(")p Fi(badv)-5 b(al)p Ft(")27
+5287 y(with)g(the)g Ft(")p Fi(badv)-5 b(al)p Ft(")27
 b Fi(v)-5 b(alue)27 b(in)h(the)g Ft(")p Fi(out)p Ft(_)p
 Fi(v)-5 b(ar)p Ft(")26 b Fi(arra)n(y)f(for)i(similar)g(reasons.)p
 0 5492 3780 12 v 0 5623 a Fz(astRemapF)-11 b(rame)1121
@@ -145315,21 +145322,32 @@ y Fw(H.50)112 b(Changes)39 b(In)m(tro)s(duced)e(in)h(V7.0.4)0
 b(V7.0.3)h(and)e(V7.0.4:)111 948 y(1.)46 b(The)30 b(previously)g(priv)
 -5 b(ate)31 b(grf3d.h)f(header)g(\014le)h(is)f(no)m(w)g(installed)i(in)
 m(to)f(pre\014x/include.)0 1241 y Fw(H.51)112 b(Changes)39
-b(In)m(tro)s(duced)e(in)h(V7.0.5)0 1463 y FF(The)f(follo)m(wing)h
-(describ)s(es)f(the)g(most)h(signi\014can)m(t)g(c)m(hanges)g(whic)m(h)f
-(ha)m(v)m(e)i(o)s(ccurred)d(in)h(the)g(AST)g(library)0
-1576 y(b)s(et)m(w)m(een)31 b(v)m(ersions)g(V7.0.4)h(and)e(V7.0.5)i
-(\(the)f(curren)m(t)f(v)m(ersion\):)111 1838 y(1.)46
-b(The)35 b(FitsChan)h(class)g(can)g(no)m(w)g(read)f(FITS)g(headers)h
-(that)g(use)f(the)h(SA)m(O)f(con)m(v)m(en)m(tion)j(for)e(repre-)227
-1951 y(sen)m(ting)j(distorted)f(T)-8 b(AN)39 b(pro)5
-b(jections,)41 b(based)c(on)h(the)g(use)g(of)g(\\COi)p
+b(In)m(tro)s(duced)e(in)h(V7.0.5)0 1463 y FF(The)26 b(follo)m(wing)i
+(describ)s(es)d(the)i(most)f(signi\014can)m(t)i(c)m(hanges)f(whic)m(h)f
+(o)s(ccurred)g(in)g(the)g(AST)g(library)g(b)s(et)m(w)m(een)0
+1576 y(v)m(ersions)31 b(V7.0.4)h(and)e(V7.0.5:)111 1838
+y(1.)46 b(The)35 b(FitsChan)h(class)g(can)g(no)m(w)g(read)f(FITS)g
+(headers)h(that)g(use)f(the)h(SA)m(O)f(con)m(v)m(en)m(tion)j(for)e
+(repre-)227 1951 y(sen)m(ting)j(distorted)f(T)-8 b(AN)39
+b(pro)5 b(jections,)41 b(based)c(on)h(the)g(use)g(of)g(\\COi)p
 Fp(_)p FF(m")g(k)m(eyw)m(ords)h(to)g(hold)e(the)227 2064
 y(co)s(e\016cien)m(ts)32 b(of)f(the)f(distortion)h(p)s(olynomial.)0
-2326 y(Programs)25 b(whic)m(h)g(are)h(statically)h(link)m(ed)f(will)f
-(need)g(to)h(b)s(e)f(re-link)m(ed)g(in)g(order)g(to)h(tak)m(e)h(adv)-5
-b(an)m(tage)27 b(of)e(these)0 2439 y(new)30 b(facilities.)p
-eop end
+2357 y Fw(H.52)112 b(Changes)39 b(In)m(tro)s(duced)e(in)h(V7.0.6)0
+2578 y FF(The)f(follo)m(wing)h(describ)s(es)f(the)g(most)h
+(signi\014can)m(t)g(c)m(hanges)g(whic)m(h)f(ha)m(v)m(e)i(o)s(ccurred)d
+(in)h(the)g(AST)g(library)0 2691 y(b)s(et)m(w)m(een)31
+b(v)m(ersions)g(V7.0.5)h(and)e(V7.0.6)i(\(the)f(curren)m(t)f(v)m
+(ersion\):)111 2954 y(1.)46 b(A)33 b(bug)g(has)f(b)s(een)g(\014xed)h
+(in)f(astRebinSeq<X>)i(whic)m(h)e(could)h(result)g(in)f(incorrect)i
+(normalisation)g(of)227 3067 y(the)d(\014nal)f(binned)f(data)i(and)f(v)
+-5 b(ariance)31 b(v)-5 b(alues.)111 3254 y(2.)46 b(When)30
+b(reading)f(a)h(F)-8 b(rameSet)31 b(from)e(a)h(FITS-DSS)f(header,)h
+(the)g(k)m(eyw)m(ords)g(CNPIX1)f(and)g(CNPIX2)227 3367
+y(no)m(w)i(default)f(to)h(zero)h(if)e(absen)m(t.)41 b(Previously)31
+b(an)f(error)g(w)m(as)h(rep)s(orted.)0 3629 y(Programs)25
+b(whic)m(h)g(are)h(statically)h(link)m(ed)f(will)f(need)g(to)h(b)s(e)f
+(re-link)m(ed)g(in)g(order)g(to)h(tak)m(e)h(adv)-5 b(an)m(tage)27
+b(of)e(these)0 3742 y(new)30 b(facilities.)p eop end
 %%Trailer
 
 userdict /end-hook known{end-hook}if
diff --git a/sun211.tex b/sun211.tex
index 59beb98..5d92145 100644
--- a/sun211.tex
+++ b/sun211.tex
@@ -26428,11 +26428,11 @@ Object             - Base class for all AST Objects
       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
+      the input and output grids. The normalised values are then multiplied
+      by a constant scaling factor to ensure that the total data sum is
+      unchanged. 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
       {\tt{"}}wlim{\tt{"}} are set to {\tt{"}}badval{\tt{"}}.
 
       Output variances can be generated in two ways; by rebinning the supplied
@@ -26824,8 +26824,11 @@ Object             - Base class for all AST Objects
          returned. The normalisation factor for each output data value is just the
          corresponding value from the weights array. The normalisation factor
          for each output variance value is the square of the data value
-         normalisation factor. It also causes output data values to be set
-         bad if the corresponding weight is less than the value supplied for
+         normalisation factor. In addition the whole dat aarray is then
+         scaled by a constant factor to ensure the total data value in the output
+         is unchanged by the earlier normalisation. It also causes output data
+         values to be set bad if the corresponding weight is less than the value
+         supplied for
          parameter {\tt{"}}wlim{\tt{"}}.
          It also causes any temporary values stored in the output variance array
          (see flag AST\_\_GENVAR below) to be converted into usable variance values.
@@ -26869,7 +26872,7 @@ Object             - Base class for all AST Objects
          the generated output variances. If AST\_\_DISVAR is not specified,
          generated variances represent variances on the output mean  values. If
          AST\_\_DISVAR is specified, the generated variances represent the variance
-         of the distribution from which the input values were taken. Eaxch output
+         of the distribution from which the input values were taken. Each output
          variance created with AST\_\_DISVAR will be larger than that created
          without AST\_\_DISVAR by a factor equal to the number of input samples
          that contribute to the output sample.
@@ -52332,12 +52335,10 @@ prefix/include.
 \end{enumerate}
 
 
-\subsection{\xlabel{changes}\xlabel{list_of_most_recent_changes}Changes
-Introduced in V7.0.5}
+\subsection{Changes Introduced in V7.0.5}
 
-The following describes the most significant changes which have
-occurred in the AST library between versions V7.0.4 and V7.0.5 (the
-current version):
+The following describes the most significant changes which
+occurred in the AST library between versions V7.0.4 and V7.0.5:
 
 \begin{enumerate}
 
@@ -52348,6 +52349,24 @@ of ``COi\_m'' keywords to hold the coefficients of the distortion polynomial.
 \end{enumerate}
 
 
+\subsection{\xlabel{changes}\xlabel{list_of_most_recent_changes}Changes
+Introduced in V7.0.6}
+
+The following describes the most significant changes which have
+occurred in the AST library between versions V7.0.5 and V7.0.6 (the
+current version):
+
+\begin{enumerate}
+
+\item A bug has been fixed in astRebinSeq<X> which could result in
+incorrect normalisation of the final binned data and variance values.
+
+\item When reading a \htmlref{FrameSet}{FrameSet} from a FITS-DSS header, the keywords CNPIX1
+and CNPIX2 now default to zero if absent. Previously an error was reported.
+
+\end{enumerate}
+
+
 Programs which are statically linked will need to be re-linked in
 order to take advantage of these new facilities.
 
diff --git a/version.h b/version.h
index b3d995f..869a51b 100644
--- a/version.h
+++ b/version.h
@@ -60,14 +60,14 @@
 *-
 */
 
-/* The current version of AST is 7.0.5 */
+/* The current version of AST is 7.0.6 */
 #define AST__VMAJOR    7
 #define AST__VMINOR    0
-#define AST__RELEASE   5
+#define AST__RELEASE   6
 
 /* Deprecated macros */
 #define AST_MAJOR_VERS 7
 #define AST_MINOR_VERS 0
-#define AST_RELEASE    5
+#define AST_RELEASE    6
 
 #endif /* #if ! defined(VERSION_INCLUDED) */

-- 
Handle World Coordinate Systems in Astronomy



More information about the debian-science-commits mailing list