[AstroPy] Capturing pyfits warnings

Anne Archibald aarchiba at physics.mcgill.ca
Tue Sep 14 17:14:45 EDT 2010


On 14 September 2010 15:43, Jim Vickroy <Jim.Vickroy at noaa.gov> wrote:

> I'm curious to learn why pyfits uses the *warnings* module in this
> fashion.  I naively would expect to see exceptions in the situation
> encountered by Tom.

I get the same warning, about partial blocks at the end of a data
file, all the time. If an exception were raised, I would not be able
to process those files. What seems to happen is that these data files
are produced by a pulsar backend streaming to disk; when an observing
run is stopped, the writing to disk seems to stop partway through the
block. But all the data up to that point is perfectly valid. In fact,
even if the backend crashed and appended gibberish to the file I'd
still want to work with all the valid data. So raising an exception is
too forceful a way to signal a problem with the file.

Anne



More information about the AstroPy mailing list