next up previous gif 200 kB PostScript reprint
Next: Migrating the Starlink Up: Software Systems Previous: Software Systems

Astronomical Data Analysis Software and Systems IV
ASP Conference Series, Vol. 77, 1995
Book Editors: R. A. Shaw, H. E. Payne, and J. J. E. Hayes
Electronic Editor: H. E. Payne

FTOOLS: A FITS Data Processing and Analysis Software Package

J. K. Blackburn
NASA Goddard Space Flight Center, Code 664.0, Greenbelt, MD 20771

Hughes STX Corporation, 4400 Forbes Blvd., Lanham, MD 20706 HEASARC



FTOOLS, a highly modular collection of over 110 utilities for processing and analyzing data in the FITS (Flexible Image Transport System) format, has been developed in support of the HEASARC (High Energy Astrophysics Science Archive Research Center) at NASA's Goddard Space Flight Center. Each utility performs a single simple task such as presentation of file contents, extraction of specific rows or columns, appending or merging tables, binning values in a column or selecting subsets of rows based on a boolean expression. Individual utilities can easily be chained together in scripts to achieve more complex operations such as the generation and displaying of spectra or light curves. The collection of utilities provides both generic processing and analysis utilities and utilities specific to high energy astrophysics data sets used for the ASCA, ROSAT, GRO, and XTE missions. A core set of FTOOLS providing support for generic FITS data processing, FITS image analysis and timing analysis can easily be split out of the full software package for users not needing the high energy astrophysics mission utilities. The FTOOLS software package is designed to be both compatible with IRAF and completely stand alone in a UNIX or VMS environment. The user interface is controlled by standard IRAF parameter files. The package is self documenting through the IRAF help facility and a stand alone help task. Software is written in ANSI C and FORTRAN to provide portability across most computer systems. The data format dependencies between hardware platforms are isolated through the FITSIO library package.



The FTOOLS software project began in late 1991 (Pence 1992) as part of a goal to standardize high energy astrophysics data sets to the FITS (Wells et al. 1981) format at NASA's HEASARC. The earliest releases of FTOOLS consisted of a collection of tools for creating, viewing, and manipulating data sets using the FITS format. Today, the FTOOLS software has grown into a collection of subpackages supporting not only generic manipulation of FITS formatted data, but also tools for data analysis of high energy astrophysics missions using the FITS standard such as ASCA, GRO, ROSAT, and now XTE.


In the design of the FTOOLS, portability was given the highest consideration. The software specifications called for ANSI FORTRAN and C as the base languages. To bind the differences in these languages between supported architectures, the C macro package CFORTRAN develop by Burkhard Burows and distributed by CERN is used. The FTOOLS design also required a common user interface in the three most popular environments used by the astronomical community today, UNIX, VMS and IRAF. Under UNIX and VMS, the FTOOLS are referred to as stand-alone or ``Host'' to distinguish this environment from IRAF. However, the user interface to the FTOOLS is identical in all environments. To achieve this cross environment support, a user interface based on the IRAF parameter file was adapted. This particular interface provides for command line assignment of any or all parameters, range checking, defaults and user prompts. By isolating the interface to the data and parameter files files to standardized subroutines common to all environments, the differences in making FTOOLS for UNIX, VMS and IRAF are resolved by linking to the appropriate libraries such as IRAF or the stand-alone XPI parameter interface. This is illustrated to the left in Figure gif.

Figure: FTOOLS Task and Package Design. Original PostScript figure (21 kB)

Open Development

The FTOOLS software package is layered into a collection of subpackages supporting a generic (or core) set of tools and a collection of subpackages for specific missions in high energy astrophysics. These subpackages are layered over the necessary libraries and environments that the FTOOLS build under. This is illustrated to the right in Figure gif. By having this layering, additional subpackages supporting new missions or even the particular needs of an individual user or project can easily be plugged into the FTOOLS package with minimal edits to underlying layers.

On-line Help

On-line help is available for each of the tasks distributed with the FTOOLS. Under IRAF, help is obtained just as with any other IRAF task. Under the stand-alone Host FTOOLS, a specialized FTOOL named fhelp is used to access the on-line help database. In both cases, simply follow the appropriate help command with the name of the FTOOLS task. The on-line help presented provides a usage, description, list of options (through the parameters) and examples.


As an example of the use of the FTOOLS, consider a FITS data set of photon events from an supernova remnant made by an X-ray imaging telescope which has within its field of view a calibration source. First the structure of the FITS dataset needs to be determined. This is accomplished with the fstruct task. Using the Host FTOOLS this would look like kent[1] % fstruct raw.evt
  No. Type EXTNAME BITPIX Dimensions(columns) PCOUNT GCOUNT
   0 PRIMARY 32 0 0 1
   1 BINTABLE EVENTS 8 30(12) 55753 0 1
   2 BINTABLE STDGTI 8 16(2) 139 0 1

From this it is determined that the photon events are located in the first extension, which is a FITS binary table extension with 55753 rows (events). Now determine the format of the table using the flcol task to list the names of the columns kent[2] % flcol raw.evt+1
         TIME 1D s
         X 1I pixel
         Y 1I pixel
         PHA 1I channel
         PI 1I channel
         RISE_TIME 1I

There are several columns in this data set. Using the X and Y columns, basic statistics can be learned about these columns with the fstatistic task or an image can be built up from the photon list using the f2dhisto. Using the PHA column and the fhisto task a quick-look spectrum can be made and viewed with fplot (see spectrum to the left in Figure gif).

Figure: Raw spectrum on left showing supernova remnant with calibration source and the spatially filtered spectrum to right. Original PostScript figures (34 kB), (32 kB)

Now through the use of these FTOOLS tasks one determines that the supernova remnant is centered at (114,129) in the pixel space of the image with a radius of 40 pixels. Using the fselect task to select out only the photons associated with the supernova and the background and then the fhisto task on the resulting supernova events, the spectrum on the right in Figure gif having no calibration peak is binned and then viewed. kent[3] % fselect raw.evt+1 snova.evt
Name of output FITS file[] snova.evt
Selection Expression[] sqrt((X-114)**2 + (Y-129)**2) < 40 kent[4] % fhisto snova.evt+1 spec.fits PHA 1

The FTOOLS distribution comes complete with a User's Guide which has a short tutorial going into more detail about using FTOOLS. Other references discussing FTOOLS are found in Blackburn & Pence (1994). The IRAF documentation are also available to learn more on the FTOOLS software package.


The FTOOLS software package is available to the public with access to the Internet. It is distributed as a compressed tar file through anonymous ftp from In the directory software/ftools/release you will find the a README file, release notes, source code, reference data for ASCA data analysis, and documentation covering the installation, usage, and development of the FTOOLS software. Further information on the FTOOLS can be found on the World Wide Web at the FTOOLS Home Page.


I am grateful to all the members of the FTOOLS group at the HEASARC for the effort they have made in bringing together under one paradigm, a significant and useful astronomical software package.


Pence, W. 1992, Legacy - The Journal of the HEASARC, 1, 14

Wells, D. C., Greisen, E. W., & Harten, R. H. 1981, A&AS, 44, 371

Blackburn, J. K., & Pence, W. 1994, Legacy - The Journal of the HEASARC, 4, 5

next up previous gif 200 kB PostScript reprint
Next: Migrating the Starlink Up: Software Systems Previous: Software Systems