[AstroPy] PyFITS beta testing

Erik Bray embray@stsci....
Wed Nov 16 15:59:25 CST 2011

Hi all,

I've been working off and on for a few months on a big changeset to 
PyFITS which changes some details about how Headers are worked with.

The biggest overall change to be aware of is that the CardList class is 
completely deprecated.  Headers are worked with entirely through Header 
objects, which have assumed much of the former responsibility of CardLists.

Header objects themselves work mostly the same way as before, but they 
are now more powerful objects that combine a mostly transparent 
interface to header as an ordered dict-like object with a list-like 
interface that allows manipulating a Header on the level of individual 

The pyfits.Card class is still in use, but there are not many reasons to 
use it directly.  All methods that accept a Card object will also accept 
a simple (keyword, value, comment) tuple in its place, or even (keyword, 
value) tuples.

I've also worked hard to maintain backwards compatibility for now with 
the old API.  There is still a class called CardList, for example, and 
it works similarly to the old class.  There's no reason to use it, 
however, except to support older code.  I've tested the backwards 
compatibility pretty extensively through the stsci_python regtests.  So 
far I've only found one (rare) use case that is not backwards 
compatible, but that is a one line fix (it has to do with iteration over 
slices of Headers--I'll give more details if anyone asks).

So I'm sending out a call to get a couple of people to try out the new 
interface and see how it works for them.  I'm interested in both 
backwards compatibility with old code, and in opinions on the new API. 
Nothing here is set in stone, so as much feedback as I can get would be 
greatly appreciated.

The new code can be found at:


The branch is kept up to date with pyfits's trunk, so if you already do 
any development off of that the only major changes should be to headers.


More information about the AstroPy mailing list