Name
replacekey - replace placeholder in a FITS header
Synopsis
replacekey <in> <card> [placeholder]
Description
replacekey is aimed at replacing placeholder cards in a
FITS file's header by cards provided by the user on the
command-line. The idea is to decouple the process doing
the actual image processing on the data from the process
that needs to update the FITS header. To do this, it is
enough to place "blank" cards (or placeholders) in the
files produced by the image processing routine, and update
the output header with this utility. The default place-
holder is a comment card as:
COMMENT PLACEHOLDER
You can change the name of the placeholder by providing it
(in quotes) on the command-line as third argument. You
need to provide the name of the input FITS file you want
to modify, the value to place in the header, and option-
ally this placeholder name. You can actually use
replacekey to do plain search and replace in a FITS
header, by providing any character string as placeholder.
The first card matching the string you provide will be
replaced.
Examples:
You want to place a card containing VALUE=32 in the
header, in place of the default placeholder (COMMENT
PLACEHOLDER), in the file named myfile.fits:
% replacekey myfile.fits "VALUE = 32"
If your do not care about the HISTORY cards you have in
the header, and want to replace the first one by VALUE=32,
you would do:
% replacekey myfile.fits "VALUE = 32" "HISTORY"
If you want to replace the previous VALUE=32 by VALUE=64,
you would simply do:
% replacekey myfile.fits "VALUE = 64" "VALUE"
Notice that the character string you give as second argu-
ment will be placed verbatim in the header. If you provide
more than 80 characters, they will be truncated to the
first 80 characters. If you provide less characters,
blanks will be added up to character 80. You should be
careful when adding cards, that they respect the FITS for-
mat. Nothing prevents you from doing:
% replacekey myfile.fits "VALUE= 1 2 3 4 /" "HISTORY"
which will replace the first occurence of a HISTORY card
by the line you provided, but the replacing line is not
FITS-compliant. No tests are performed internally to check
the compliance of the FITS line you are adding.
Options
None
See Also
hierarch28 to convert HIERARCH ESO keywords to regular
8-char keywords.
Files
Files shall all comply with FITS format
Bugs
Modifications are so far only possible in the main header,
not in the extensions.