Fast FITS queries in Python
bridgman at wyeth.gsfc.nasa.gov
Thu Feb 24 08:40:03 CST 2000
There is also Paul Barrett's PyFITS routine which for some lame reason I
don't seem to have a link to on the AstroPy home page. :^) Paul, if
you're around, could you send an updated link?
I've successfully FITSified OSSE timing data files (with IDL on a VAX)
and then extracted both header & binary table data using PyFITS. I
actually had this working on a Macintosh. Perhaps I should post/repost
some of this.
Actually, perhaps I should update the AstroPy page. While I'm at it,
suggestions for other additions?
Nicolas Devillard wrote:
> Yet another module to help making keyword queries in FITS headers, either
> in C or Python.
> 'qfits' is an ANSI C module that offers very fast keyword queries in
> FITS headers, through the use of the mmap() system call on Unix. 'qfits'
> is written in portable ANSI C and should compile on any Unix system that
> offers the mmap() call, i.e. any modern Unix :-).
> 'qfits' has been extracted from the eclipse library to build a stand-alone
> module, to make it accessible from Python. A wrapper module called
> 'qfits_wrap.c' has been generated using SWIG, making qfits.so a callable
> shared object from the Python interpreter. If you have SWIG, you can
> straightaway build a callable module for Perl or Tcl (see
> A wrapper class called 'Qfits.py' is then offered on top of the shared
> object, to make the queries more Python-like. Here is an example of an
> interactive session using Qfits:
> >>> from Qfits import *
> >>> q = Qfits('vltframe.fits')
> >>> q.get('naxis')
> >>> q.get('MJD-OBS')
> >>> q.get('DET.DIT')
> >>> q.get('HIERARCH ESO DPR CATG')
> "'SCIENCE '"
> >>> q.get('dpr.catg', pretty=1)
> >>> q.get('simple', 'naxis', 'naxis1', 'naxis2', 'bscale', 'bzero')
> ('T', '2', '1024', '1024', None, None)
> 'qfits' is a good solution if you only want to retrieve known keywords
> from a FITS header in a Python script, and you want to do it fast, without
> need for a complete FITS library with bells and whistles (the distribution
> tar file for 'qfits' is 12 kbytes).
> 'qfits' can be downloaded from the (bottom of the) following page:
Dr. William T."Tom" Bridgman Scientific Visualization Studio
Raytheon ITSS NASA/Goddard Space Flight Center
Email: bridgman at wyeth.gsfc.nasa.gov Code 935
Phone: 301-286-1346 Greenbelt, MD 20771
FAX: TBD http://svs.gsfc.nasa.gov/
More information about the AstroPy