HBOXAVE
Name
HBOXAVE
Purpose
Box average an image array and update the FITS header array
Explanation
The function BOXAVE() is used. This procedure is recommended for
integer images when photometric precision is desired, because it
performs intermediate steps using REAL*4 arithmetic. Otherwise, the
procedure HREBIN is much faster.
Calling Sequence
HBOXAVE, Oldim, Oldhd, Newim, Hewhd, box
or
HBOXAVE, Oldim, Oldhd, box
Inputs
Oldim - the original image array
Oldhd - the original image FITS header, string array
Optional Inputs
box - the box size to be used, integer scalar. If omitted, then
HBOXAVE will prompt for this parameter.
Optional Outputs
Newim - the image after boxaveraging
Newhd - header for newim containing updated astrometry info
If output parameters are not supplied, the program
will modify the input parameters OLDIM and OLDHD
to contain the new array and updated header.
Optional Keyword Output
ERRMSG - If this keyword is supplied, then any error mesasges will be
returned to the user in this parameter rather than depending on
on the MESSAGE routine in IDL. If no errors are encountered
then a null string is returned.
Procedure
The parameters BSCALE, NAXIS1, NAXIS2, CRPIX1, and CRPIX2 and
the CD (or CDELT) parameters are updated for the new FITS header.
Example
Compress the image in a FITS file 'image.fits' by a factor of 4 and
update the astrometry in the FITS header
IDL> im = readfits('image.fits',hdr) ;Read FITS file into IDL arrays
IDL> hboxave, im, hdr, 4 ;Boxaverage by 4
IDL> writefits,'image.fits',im,hdr ;Write a new FITS file
CALLED PROCEDURES:
CHECK_FITS - Check that the FITS header is appropriate to the image
BOXAVE() - Performs box averaging of an image
SXPAR(), SXADDPAR - Read and write FITS keyword values
Modification History
Written, Aug. 1986 W. Landsman, STI Corp.
IDLV2 changes, sxaddpar format keyword added, J. Isensee, July,1990
Fix 0.5 pixel offset in new CRPIX computation W. Landsman, Dec, 1991
Update BSCALE even if no astrometry present W. Landsman, May 1997
Converted to IDL V5.0 W. Landsman September 1997
Added ERRMSG keyword, Use double formatting W. Landsman April 2000
Recognize PC matrix astrometry format W. Landsman December 2001