hfix: Fix image headers with a user specified command

Package: proto

Usage

hfix images

Parameters

images
List of images whose headers are to be fixed. If update is yes then the user must have write permission on the image headers.
command = "edit $fname"
Command to be applied to a file containing the image header. The command may be any CL command which includes escapes to host commands. The file containing the header in text form is specified by the special string "$fname". The command should modify this file to the desired form. The default is to invoke a text editor but there are many other possibilities. The image name may also be specified with "$image". See the EXAMPLES section for some ideas.
update = yes
Update the image header with the modified header.

Description

This task allows you to extract the image headers into a text file, modify this file with a specified command, and update the image header with the modified file. The command to be applied is specified with the command parameter. In this command the text file containing the header to be acted upon is referenced with the string "$fname". If it is desired to update the image header with the modified file the update switch must be set. You must have write permission to update the image headers.

A common command, which is the default, is to use a text editor. Other possibilities are to save the file, use a non-interactive host command such as sed in UNIX, or write your own program or script.

This task does very little processing on the header after you are finished editing. It checks for legal FITS characters in the first 8 columns and if there is an '=' in column 9 then there must be a ' ' (blank) in column 10. Lines violating these checks are skipped. It also sets each line in the header to the correct length. Because you have total freedom to change the header parameters while in the text editor, you must make sure that the header has a legal format after you are through editing it. In particular, be sure each field in the header parameters that you add or change begin in the proper columns.

Examples

1. Edit the header of the image test.imh:

cl> hfix test.imh
<Edit the header text>

2. Get the header of a single image and save the file:

cl> hfix myim command="copy $fname save" update-

3. A image header was created with an incorrect format such that the equal sign is in column 10 instead of 9:

cl> hfix *.imh \
>>> command="!sed 's/ =/=/' $fname >temp;mv temp $fname"

Note that this example should not be tried on a valid header where the equal sign is in column 9.

See also

images.hedit noao.artdata.mkheader