2.3 COS File Structures

All COS data products are Multi-Extension FITS (MEF) format files and begin with a primary data unit which includes only a header with no data extension. The info() function in the astropy.io.fits Python module can be used to list the complete set of extensions and their data formats for the COS data files. For more information on using astropy.io.fits, please refer to Chapter 5.

2.3.1 COS FITS Table Extension Files

Tabular COS information, such as extracted one-dimensional spectra or the TIME-TAG mode event series, are stored as FITS binary tables. The tables can be accessed directly in the AstroConda (an STScI Python distribution) environment using the astropy.table.Table module as described in Section 5.1.2 of this document, or with other standard FITS tools.

2.3.2 COS FITS Image Extension Files

COS images and two-dimensional spectroscopic data are stored in FITS image extension files, which can be directly manipulated, without conversion, in the AstroConda environment. Accessing images in the FITS image extension files in Python requires use of the astropy.io.fits module and the images can be displayed with the matplotlib package. Figure 2.1 illustrates the structure of a COS FITS image extension file, which contains:

  • A primary header that stores keyword information describing the global properties of the exposure in the file (e.g., the target name, target coordinates, exposure type, optical element, aperture, detector, calibration switches, reference files used).
  • A set of image extensions, each containing header keywords with information specific to the given exposure (e.g., exposure time, world coordinate system) and a data array.

Figure 2.1: FITS Image Extension File for COS.

1 Not all COS image extension files will contain the ERR and DQ extensions.
The following file types are stored in FITS image extension files with the particular format shown in Figure 2.1: rawaccum, flt, counts, pha and rawacq.1 Each COS readout can generate one FITS image SCI extension or three FITS image extensions (SCI, ERR, and DQ) as explained below:

  • The first extension type, SCI, stores the science values.
  • The second extension type, ERR, contains the statistical errors, which are propagated through the calibration process. It is unpopulated in raw data files.
  • The third extension type, DQ, stores the data quality values, which flag suspect pixels in the corresponding SCI data.

The error arrays and data quality values are described in more detail in Section 2.7. The value of the EXTNAME keyword in the extension header identifies the type of data the extension contains; the value of this keyword may be determined using the convenience function getval() in the astropy.io.fits module using Python. For example, to see the value of EXTNAME of extension 1 of ldel05ivq_rawtag_a.fits:
 

> from astropy.io import fits
> fits.getval('ldel05ivq_rawtag_a.fits', 'EXTNAME', ext=1)



1 Only ACQ/IMAGE files use the exact format shown in Figure 2.1. For more details on acquisition file formats see "Acquisition Files (RAWACQ)" in Section 2.4.4.