Most astronomical images have collections of numeric, character or logical values associated with them. Typically these consist of important calibration values, but they are also often used to describe the history or status of the data. Collections of such data, which are not actually part of the image array, are known as “header” information (this name derives from the fact that FITS1 stores these values at the beginning – head – of a file). IMG refers to a single piece of such information as a “header item” and a separate set of subroutines exists to read, write, copy and make enquiries about them.
This example (taken from a complete program called hdrread.f
– see §2) shows how to read the value
of a header item from an image associated with the parameter ’IN’
:
HDR_IN
specifies the image by using its parameter name – ’IN’
(argument 1). If you have
not previously accessed this image you will probably be prompted for its file name at this
point.
The 2nd, blank argument, indicates that an “ordinary” FITS header item is required (there are other possible “sources” of header information which are described later – §4.2.2).
The 3rd argument ’OBSERVER’
specifies the name of the header item required and the 4th argument 1
indicates that you want the first occurrence of that item (just in case it occurs several times, which
some items are allowed to do).
The 5th argument VALUE
returns the header item value as a character string. If the header item you requested
doesn’t exist, then VALUE
is returned unchanged, so you may want to set it to a sensible value (say
’<unknown>’
)
beforehand.
This example (taken from a complete program hdrwrite.f
– see §2) shows how to write the value of a
header item to an image associated with the parameter ’OUT’
:
HDR_OUT
specifies the image by using its parameter name – ’OUT’
(argument
1). If you have not previously accessed this image you will probably be prompted for its
file name at this point. If you have already accessed the image then it should be either
an output image or one accessed for modification, as you cannot write items to images
accessed by ??x]]IMG_IN
.
The 2nd, blank argument, indicates that an “ordinary” FITS header item is to be written.
The 3rd argument (’OBSERVER’
) specifies the name of the header item and the 4th
argument ’The observer’
is a comment to store with the item.
The 5th argument (’Fred Bloggs’
) is the header item value.
1FITS, the “Flexible Image Transport System” is the de facto standard for the interchange of astronomical data.