This HTML automatically generated with rman for NEMO
Table of Contents

Name

fitshead - dump the header of a fits file, or convert ascii to fits header

Synopsis

fitshead in=fits_file [parameter=value]

Description

fitshead reads FITS file(s) from disk and dumps the headers. Since fits(3NEMO) routines are used, various FITS (mis)interpretations may be reported. Try using scanfits(1NEMO) if really stuck.

FITS Header-Data Unit’s (HDU) can be extracted individually by using the hdu= keyword.

Since fitshead can only process disk FITS files, FITS files on tape have to be extracted from tape using dd(1) or similar programs. See also notes in ccdfits(1NEMO) how to process fits files from tape.

Parameters

The following parameters are recognized in any order if the keyword is also given:
in=input_file
An input file. It can either be a fits file, or, if out= is also specified, a regular ascii file which is assumed to be in fits-header format. If the input file is in fits format, it may contain several HDU’s, and the hdu= keyword can be used to make sub-selections. [no default].
hdu=integer_list
List of file numbers of the FITS file that need to be worked on. For now each Header+Data counts as a FITS file, which is not perhaps meant to be its true meaning. Extensions would be counted as a separate FITS file: in such cases file=1,2 would have to be supplied to copy both the primary HDU and its first extension. Using a value of 0 will cause all FITS files to be read. [default: 0].
blocking=factor
Positive integer that denotes the blocking factor with which the input file was written. It is the multiple of blocks of 2880 bytes. The FITS standard allows the blocking factor to be from 1 to 10. [default: 1]. Not supported yet
out=
Optional output if conversion from ascii text to FITS header format is needed. If given, the input file should must be an ascii file, and not contain strange control characters. (a NULL can trigger erroneous conversions). However, no checking is done if the input file is properly formatted (see fits(5NEMO) ).
counter=t|fP
Add line counter to output? Not used yet.

Example

Consider fixing the CTYPE1 and CTYPE2 keywords of a large number of FITS files from ’LL’,’MM’ to ’RA---TAN’,’DEC--TAN’:
    % fitshead map1.fits | grep -i ctype > ctype.fix
    % $EDITOR ctype.fix
    % foreach f (*.fits)
        scanfits $f $f.new delete=CTYPE1,CTYPE2 fix=ctype.fix
      end

Generic editing of a FITS header can be done in the following way (assuming there is only one HDU in the FITS file):

    % fitshead map1.fits > map1.txt
    % $EDITOR map1.txt
    % fitshead map1.txt out=map1.head
    % scanfits map1.fits map1.data select=data
    % cat map1.head map1.data > map2.fits

The unix command fold(1) can also - with some limitations - be used to view a FITS header by specifying the width to be 80 characters, viz.

    % fold -80 map1.fits | more
equally so, dd(1) :
    % dd cbs=80 conv=unblock in=map1.fits | more
Stripping trailing white space is sometimes needed to compare fits headers with the diff(1) program:
    % fitshead ngc6503.fits | sed ’s/ *$//’ > ngc6503.fitshead

See Also

scanfits(1NEMO) , fits(5NEMO) , dd(1) , fold(1) , diff(1) , sed(1)

fitsheader is a popular program in many packages, e.g. in astropy-utils

Author

Peter Teuben

Files


~/src/image/fits         fitshead.c

Update History


12-apr-91    V1.0 Written, cloned off scanfits - and docced        PJT
13-apr-92    V1.1 Renamed file= to hdu=                           PJT
13-apr-94    V1.2a added out= to convert ascii to fits header    PJT
23-may-95    V1.2b fixed bug in conversion to header format          PJT
6-oct-11    V1.3b fixed bug for large files                PJT


Table of Contents