Working with FITS Files

JWST data is assembled into FITS files. Several software packages are available to manipulate and visualize JWST Data

On this page

The DMS pipeline automatically will process and calibrate all the data received from JWST and assembles them into a form suitable for most scientific analyses. JWST data will be made available to observers as files in multi-extension FITS format. JWST data can be manipulated with several different software packages. In this section, we introduce a few of the software options.

Multi-extension FITS format

Flexible Image Transport System (FITS) is a standard format for exchanging astronomical data, independent of the hardware platform and software environment.

FITS format files consist of a series of Header Data Units (HDUs), each containing two components: an ASCII text header and binary data. The header contains a series of keywords that describe the data in a particular HDU; the data component may immediately follow the header.

For JWST FITS data, the first HDU, or primary header, contains no data. The primary header may be followed by one or more HDUs called extensions. Extensions may take the form of images, binary tables, ASDF files, or ASCII text tables. The data type for each extension is recorded in the XTENSION header keyword. The figure below shows a schematic representation of such FITS file structure.

Each FITS extension header contains the required keyword XTENSION, which specifies the extension type and has one of the following values: IMAGE, BINTABLE, and TABLE, corresponding to an image, binary table, and ASCII or ASDF table, respectively.

Table 1. Extension information
HDU keyword  Description Values
XTENSIONData type for extension
  • BINTABLE (binary table)
  • TABLE (ASCII table)

EXTNAMEExtension names that describe the type of data component for default outputs of the calibration pipeline
  • SCI (science image)
  • ERR (error image)
  • DQ (data quality array)
  • PIXELDQ ("2-D pixel-dependent data quality flags)
  • GROUPDQ (4-D group-dependent data quality flags)
  • REFOUT (MIRI reference output)
  • ASDF (product metadata, includingWorkdCoordinateSystemtransforms
  • GROUP (Group metadata from telescope telemetry)
  • DQ_DEF (table with list of bit assignments for flag conditions used in the DQ array)
  • AREA (pixel area map)
  • EXTRACT1D (binary table with 1-D extracted spectra; part of the _x1d and _x1d products

Additional extension names for the optional output product from the ramp_fit step
  • SLOPE (4-D arrays with slopes)
  • SIGSLOPE (4-D arrays with uncertainty in the y-intercept)
  • YINT (4-D arrays with y-intercept)
  • SIGYINT(4-D arrays with uncertainty in the y-intercept)
  • WEIGHTS (4-D arrays of  fitting weights for each ramp interval of each pixel)
  • EXTRACT1D (binary table with 1-D extracted spectra; part of the _x1d and _x1d products

Working with multi-extension FITS images and tables


Python is used for astronomical data reduction applications. It is a freely available, general-purpose, dynamically-typed interactive language that provides modules for scientific programming and is used for astronomical data reduction application. These modules include:

  • astropy package provides access to FITS files.
  • numpy an IDL-style array manipulation facilities
  • matplotlib plotting and image display package

Python is a very powerful language that is well suited to writing programs to solve many needs besides scientific analysis. Tutorials are available which illustrate the use of Python for interactive data analysis in astronomy (in much the same style as is now popular with IDL). The initial focus of these tutorials is the use of interactive tasks for the novice user. The more advanced tutorials focus on teaching the details of Python programming. The tutorials can be downloaded from: All the JWST Calibration pipelines are written in Python. More information on the use of Python to analyze JWST data can be obtained from JWST Post-Pipeline Data Analysis


IDL is an array-based, interactive programming language that provides many numerical analysis and visualization tools and is very popular in the astronomical community with many astronomers using it for their analysis of data. It can be obtained from ITT Visual Information Solutions for a  fee. Libraries for reading astronomical FITS data are part of the freely available on the ASTRON library which has links to other IDL astronomy libraries.

Fortran and C

For those who wish to write their own Fortran or C applications use the FITSIO library for reading FITS files with Fortran and the  CFITSIO library for C.


PyRAF is the python-based "Image Reduction and Analysis Facility" (IRAF) system that includes a selection of programs for general image processing and graphics, plus a number of programs for the reduction and analysis of optical and IR astronomy data.

The Space Telescope Science Data Analysis System (STSDAS), which is also layered on top of PyRAF, is part of the software tools offered at STScI and used mainly for HST data analysis. 

The TABLES package sits alongside STSDAS and provides tools and libraries for working with tabular data. STSDAS requires TABLES, but one may use TABLES without STSDAS. Together, these two packages comprise STSDAS/TABLES.

For more information and support for IRAF, please refer to the NOAO pages at

 Other packages to work with FITS files are discussed in the JWST Post-Pipeline Data Analysis tools page.



Latest updates