[AstroPy] Re: functional interface for PyFITS?
jpb at pha.jhu.edu
Tue Mar 22 08:41:12 CST 2005
> > img=getdata('foo.fits') for the 2nd extension, as a valid alternative
> Be careful here. How do you distinguish that from a file whose name
> is literally foo.fits? And if you do 'foo.fits', how do you
> distinguish that from the second element of a string array (bar, in
> this case): getdata(bar)? The first is contrived but possible in
> the grand universe of file-naming schemes. The second I use *all the
> time* to address a list of filenames in sequence. Stick with
> getdata('foo.fits', ext=2). It's just a few extra characters longer
> than the shorthand, and is much clearer.
I want to agree whole-heartedly with this comment!
We use pyfits a lot and find it amazingly useful,
and the syntax fairly clear and consistent. Allowing
something like 'foo.fits' in a function call to
refer to the 2nd extenstion in the file would open
a Pandora's box of inconsistency and confusion, or
at least set a very bad precedent.
More information about the AstroPy