FITS to ASCII

Generally, astronomical data archives are open to public. Also, astronomy has been the leading force of developing software and hardware to handle massive data, which nowadays receive spotlights from statistics. Although the astronomical data look easy to be accessed for some statistical challenges, compared to data sets of other disciplines, statistical applications on astronomical data are unlikely to be found. What is the cause of this long engagement period?

The data format…so called FITS.

Yet, ASCII format catalogues are available (for example, VizieR, http://vizier.u-strasbg.fr/viz-bin/VizieR) . Catalogues or data from VizieR are trimmed to enhance astrophysical interests. Many data sets contain only a few dozens of stars.

Therefore, for an interesting statistical research, one has to dig in raw data sets, which in astronomy are usually stored in FITS format. It seems like that not many statisticians are aware of this particular type of data format. Let’s defer
a discussion on FITS (need a help from astronomers). I only like to comment that there are ways for statisticians to access FITS format data.

1/ Bother astronomers. They will help you.

2/ R or SAS does not have FITS reader but there are free tools available. Here, I attach an email from 2006 Astrostatics Summer School at PSU, who kindly answer to my question on how to read files in FITS format.

—————————————from Patrick
The FTOOLS package I mentioned today is available at NASA-Goddard via
http://heasarc.gsfc.nasa.gov/ftools/ftools_menu.html
The tool is fdump. It’s manual page is available via fhelp fdump

A more modern and perhaps better package of FITS tools is contained in the data analysis package named CIAO, built for the Chandra mission (the NASA satellite Eric and I work with). It’s available via
http://asc.harvard.edu/ciao/download/
(You do NOT need the separate “calibration database” (CALDB) the you’ll see mentioned.) The tool you want in this package is called dmlist, with a syntax like this to dump the data to an ASCII file:
dmlist mydata.fits opt=data,clean outfile=mydata.txt

To see the column names for a table use:
dmlist mydata.fits cols

To see the keywords in the header of the FITS file use
dmlist mydata.fits header

FITS files can sometimes contain multiple data tables. To see the structure of your FITS file use this:
dmlist mydata.fits blocks

Anytime you specify a FITS filename you can optionally specify a block number, e.g.:
dmlist “mydata.fits[4]” opt=data,clean outfile=mydata_part4.txt

You can even specify specific columns to dump, e.g.
dmlist “mydata.fits[4][cols x,y]” opt=data,clean outfile=mydata_part4.txt

The manual page for dmlist is at http://asc.harvard.edu/ciao/ahelp/
dmlist.html or via
ahelp dmlist

If you ever need to look at images in FITS format the gold standard application is called “ds9″, included in the CIAO package.

—————————————————————

The 1st strategy looks easy and urges collaborations between astronomers and statisticians. On the other hand, astronomically knowledgeable statisticians may work on their own to verify their theories purely for statistical interests and eventually satisfy astrophysics. Overall, don’t be panic with this strange data format.

**Note that this email directs CIAO package on which CHANDRA X-ray data are processed.

3 Comments
  1. vlk:

    FTOOLS and CIAO are not all that different when it comes to dealing with FITS. They just output the results differently. Both are built upon the CFITSIO library from HEASARC.

    Anyone that plans to read in FITS files for use in C or Fortran are better off using the CFITSIO function calls directly in their programs.

    IDL users can use the IDL-Astro library. The easiest of the routines to use are readfits() and mrdfits(). The IDL-Astro library also contains numerous functions to manipulate every element of a FITS file (images, table columns, headers, etc), see the IDL-Astro contents.

    01-29-2007, 3:12 am
  2. Hyunsook:

    Not many are aware of IDL. Particularly statisticians. I have been looking for open sources that extract ascii information from fits files. Can GDL (GNU Data Languages) be a solution?

    01-29-2007, 11:47 pm
  3. vlk:

    vlk said…

    GDL is a free alternative to IDL, and apparently is fully syntax compatible. It can be downloaded from http://gnudatalanguage.sourceforge.net/.

    I successfully installed it about a year ago on my powerbook running X.3, but had to remove it later because it messed with ImageMagick libraries.

    01-31-2007, 10:06 am
Leave a comment