9 Importing Data

Note that this section describes KAPPA FITSDIN rather than CONVERT FITS2NDF because at the time of writing the latter aborts when presented with an ING nearly-FITS file. The underlying problem is with the ING file rather than FITS2NDF. It may be possible to switch to using FITS2NDF when it has been enhanced to handle ING nearly-FITS files. ACD, 11/5/99.

The CCD images that you plan to reduce may be available as FITS files (see Section 6.2) which are already resident on magnetic disk, as is the case for the examples provided with this cookbook. Most Starlink software can read data files in a variety of formats, including FITS. However, it is most simple, convenient and efficient to convert the files to Starlink’s NDF (n-dimensional Data Format; see SUN/33[31]) format at the outset.

If you have not already done so, you should copy the example data to a convenient directory where you can work on them, as described in Section 8.1. Make this directory your current directory, then proceed as follows.

(1)
First you must start the KAPPA package (see SUN/95[6]). Simply type:
  % kappa
(2)
Move to the subdirectory containing the astronomical images:
  % cd targets
(3)
You can list the header records in a FITS file using KAPPA application fitshead. Type:
  % fitshead ngc2336_r_1.fit

The header records will be listed to the terminal. This output should look similar to Figure 9.


  SIMPLE  =                    T
  BITPIX  =                   16
  NAXIS   =                    2
  NAXIS1  =                 1124
  NAXIS2  =                 1124
  DATE    = ’13/02/96’                    /Date tape file created
  
  PACKTYPE= ’OBSVATON’                    /Packet type
  PACKVERS=                    2          /Packet Version Number
  PACKDATE= ’96/02/13’                    /Date of packet creation
  PACKTIME= ’22:57:02’                    /Time of packet creation
  PACKNAME= ’JOB44209’                    /Packet name
  PACKPDAT= ’96/02/13’                    /Date of previous packet of this type
  PACKPTIM= ’22:51:54’                    /Time of previous packet of this type
  PACKPNAM= ’JOB44208’                    /Name of previous packet of this type
  ORIGIN  = ’ING La Palma’                /Tape writing institution
  OBSERVER= ’WJJ     ’                    /Name of the Observer
  TELESCOP= ’JKT     ’                    /Name of the Telescope
  INSTRUME= ’AGBX    ’                    /Instrument configuration
  OBSTYP  =                   40          /Observation type
  OBJECT  = ’N2366 R ’                    /Name of the Object
  RA      = ’07:18:22.50’                 /RA of the source
  DEC     = ’+80:16:26.0’                 /Declination of the source
          .
          .
          .


Figure 9: The first few FITS header records for file ngc2336_r_1.fit


(4)
A FITS file can be converted to the NDF format using KAPPA application fitsdin. Type:
  % fitsdin ngc2336_r_1.fit ngc2336_r_1 fmtcnv=yes

The option fmtcnv=yes specifies that INTEGER data arrays in the input files will be converted to REAL arrays in the output NDF files. The keywords in the FITS file will be listed to the terminal and NDF file ngc2336_r_1.sdf should be created in your current directory.

(5)
You can examine the contents of this file using the hdstrace utility. Simply type:
  % hdstrace ngc2336_r_1

(note that the ‘.sdf’ file-extension can be omitted). hdstrace is fully documented in SUN/102[5].

(6)
Now convert the remaining files. Type:
  % fitsdin ngc2336_r_2.fit ngc2336_r_2 fmtcnv=yes
  % cd ../flats
  % fitsdin files=’*.fit’ auto fmtcnv=yes
  % cd ../bias
  % fitsdin files=’*.fit’ auto fmtcnv=yes

Note the use of the asterisk (‘*’) as a wild card: all the files in the directory with names ending in ‘.fit’ are converted without having to explicitly specify their file names. The file specification ‘*.fit’ is enclosed in quotes to ensure that the asterisk is passed to fitsdin rather than being trapped and interpreted by the Unix shell. The use of Starlink applications from Unix shell scripts is discussed further in SC/4: C-shell Cookbook[4]. The auto option specifies that the output file name is to be constructed automatically from the input file name.