[Numpy-discussion] PyFITS 0.6.2 available

Perry Greenfield perry at stsci.edu
Wed Feb 27 12:50:02 EST 2002

We are announcing the availability of PyFITS, a Python module to 
provide a means of reading and writing FITS format files. The FITS
(Flexible Image Transport System) format is standardized data format
widely used for astronomical data (http://fits.gsfc.nasa.gov/).

This module is based on the PyFITS module initially developed by
Paul Barrett while he was at NASA/Goddard but has since been 
modified and adapted for use by the Space Telescope Science Institute.
It has been developed primarily by Paul Barrett, Jin-Chung Hsu,
and Todd Miller, with assistance from Warren Hack, Phil Hodge,
and Michele De La Pena. It is being released under an Open Source

A web page for PyFITS is available: http://stsdas.stsci.edu/pyfits
There is a preliminary draft for a PyFITS manual available from that
page. It is still in the early stages and is incomplete (particularly
with regard to the details of how to manipulate table objects).
However, there should be enough information to indicate how to
perform basic operations with FITS files.

PyFITS requires that numarray v0.2 be installed
(http://stsdas.stsci.edu/numarray). Numarray is a relatively new 
replacement for the Numeric module (and largely backward-
compatible at the Python level). It also currently lacks all
of the 3rd-party libraries that Numeric has (this will begin
to change within a couple of months). However, it is not
compatible at the C-API level nor are numarray and Numeric arrays
interchangeable. It is possible to have both modules loaded
simultaneously and to convert between numarray and Numeric arrays
using the tostring/fromstring mechanism each provides (at the
expense of extra memory usage, of course)

The PyFITS module is simply a single Python file (pyfits.py).
Installation consists of placing that file in a directory in
the Python search path.

Besides the use of numarray, there are significant differences with
the interface provided by the original PyFITS. We do not expect many
future backward-incompatible changes to the interface of PyFITS.
(Though more methods and functions will almost certainly be added.)

This is an early version and undoubtably bugs will be discovered
when used with a greater variety of FITS files. Currently PyFITS 
take a fairly strict interpretation of FITS files. There are likely
to be problems with FITS data that do not strictly conform to the
standard. We intend to accommodate such variances, particularly if
they involve widely used or available data (so please let us know
when such problems occur).

Things not yet supported but are part of future development:

1) Verification and/or correction of FITS objects being written 
to disk so that they are legal FITS. This is being added now and
should be available in about a month. Currently, one may construct
FITS headers that are inconsistent with the data and write such
FITS objects to disk. Future versions will provide options to
either a) correct discrepancies and warn, b) correct discrepancies
silently, c) throw a Python exception, or d) write illegal FITS
(for test purposes!).

2) Support for ascii tables or random groups format. Support
for ASCII tables will be done soon (~1 month). When random
group support is added is uncertain.

3) Support for memory mapping FITS data (to reduce memory demands).
We expect to provide this capability in about 3 months.

4) Support for columns in binary tables having scaled values
(e.g. BSCALE or BZERO) or boolean values. Currently booleans
are stored as Int8 arrays and users must explicitly convert them
into a boolean array. Likewise, scaled columns must be copied
with scaling and offset by testing for those attributes
explicitly. Future versions will produce such copies automatically.

5) Support for tables with TNULL values. This awaits an enhancement
to numarray to support mask arrays (planned). (At least a couple
months off)

Please contact help at stsci.edu for with questions about it usage,
bug reports, or requests for enhancements.

Perry Greenfield
Science Software Group

More information about the NumPy-Discussion mailing list