Facilities > GBT > Observer Alerts > GBT Pipeline and idlToSdfits channel offset bug fix - May 8, 2015

GBT Pipeline and idlToSdfits channel offset bug fix - May 8, 2015

by Toney Minter last modified May 13, 2015

We discovered and fixed a bug in idlToSdfits (and the gbtpipeline) that affects the frequency and velocity scales of output FITS files when channel averaging was used.  The bug was triggered by the "-a" argument in the idlToSdfits program, and also invoked by the "-a" argument in the gbtpipeline program.

Affected FITS cubes have a systematic offset of channel frequencies by 0.25 to 0.5 channels, after averaging. Specifically, the correct frequency for each channel in the affected data should be:

f_correct = f - CDELT3 * (0.5 - 0.5 / W)

where "f" is the frequency associated with a channel, "W" is the number of channels that were averaged (the argument value when using "-a") and CDELT3 is the channel spacing after averaging, as recorded in the FITS header of the output image cube.

This bug was fixed on Friday, 8 May 2015 and the fix is included in idlToSdfits version 8.6 and beyond.  The idlToSdfits program now inserts a HISTORY card in the output FITS files to show the version number used.

It is not necessary to regenerate output FITS cubes to correct for this error.  Instead, you can correct affected FITS cubes by replacing the values of CRVAL3 and ALTRPIX in the FITS header with the correct values,  which are:

CRVAL3_correct  = CRVAL3 - CDELT3 * (0.5 - 0.5 / W)
ALTRPIX_correct = ALTRPIX + (0.5 - 0.5/W)

We are providing a tool to help you fix affected FITS cubes.  Keep in mind that you need to know what channel width was used in the original averaging with idlToSdfits when creating your image cube.  Our tool will check if the cube was processed with idlToSdfits, but it can not know the averaging parameters as they are not stored in the header.  If you do not remember the averaging parameters you used when creating the cube, your safest path is to recreate the image from the SDFITS spectra.

To use the tool you need to supply the image cube name and the channel width used for averaging by idlToSdfits when creating the cube. For example:

/home/gbtpipeline/bin/fix_idlToSdfits_header_bug    affected_image_cube.fits  16

Type '/home/gbtpipeline/bin/fix_idlToSdfits_header_bug -h’ at the command line to get full usage information.

Pipeline users who have used the "-a" option in the "image.py" script  are unaffected by this bug since image.py uses different code for the channel averaging.