### 15 Reading FITS Files from Tape

This recipe gives some hints about reading FITS files from magnetic tape. Often you will return from an observing run with one or more exabyte tapes, or similar, containing the data you have acquired. Before you can reduce and analyse these observations you need to copy them from tape on to a magnetic disk on your local Starlink computer system. The files are usually written on the tapes using the FITS format (see Section 6.2) and this is the only alternative considered here.

Before you can start you will need to find the name and physical location of a suitable tape drive and determine which computers can access it; your site manager should be able to advise. The next step is to physically load the tape into the drive; again see your site manager for details.

The simplest way to read the files from tape is to use application fitsin in KAPPA. It is fully documented in SUN/95[6]. However, briefly, each FITS file is converted to a disk file in the Starlink NDF ($n$-dimensional Data Format; see SUN/33[31]) format. The NDF format is the most convenient for subsequent processing with CCDPACK and other Starlink applications. The details are not particularly germane here, but all the auxiliary information in the original FITS keywords is preserved in the ‘FITS’ extension to the NDF.

You need to start KAPPA prior to running fitsin. Simply type:

% kappa
First example
One example of using fitsin might be:
% fitsin mt=/dev/rmt/1n file=’[2-4,9]’ auto prefix=ccd nofmtcnv

Some points to note here are:

• files will be read from device /dev/rmt/1n,
• only files 2, 3, 4, and 9 will be read (files occur sequentially on the tape, the first file is numbered 1, the second 2 etc),
• NDF files will be created called ‘ccd2.sdf’, ‘ccd3.sdf’, ‘ccd4.sdf’ and ‘ccd9.sdf’,
• the nofmtcnv option specifies that data type conversion is not required: the NDF files will be created with the same data types (REAL, INTEGER or whatever) as the original FITS files.
Second example
Another example might be:

fitsin mt=\$TAPE files=’*’ auto prefix=ccd fmtcnv logfile=jkt.log

Points to note here are:

• prior to running the command, Unix shell variable TAPE should have been set to the name of the tape drive,
• files=’*’ indicates that all the files on the tape are to be read: here the asterisk is being used a ‘wild-card’,
• the NDF files created will have the prefix ‘ccd’,
• a record of the headers and the names of the output files are written to the text file jkt.log,
• the fmtcnv option specifies that INTEGER data arrays in the input files will be converted to REAL arrays in the output NDF files. Standard keywords in the FITS file can be used to supply a zero point and scale factor for this conversion.

Note that ‘nofmtcnv’ is equivalent to and inter-changeable with ‘fmtcnv=false’ or ‘fmtcnv=no’ and similarly ‘fmtcnv’, ‘fmtcnv=true’ and ‘fmtcnv=yes’ are equivalent.

If you experience problems reading FITS tapes then Section 17.10, I’ve Got This FITS Tape, of SUN/95[6] may contain some useful hints.