[AstroPy] PyFITS 0.6.2 available

Perry Greenfield perry at stsci.edu
Tue Mar 5 15:11:54 CST 2002

> I would be interested in knowing whether there is any big gain to be had
> from memory-mapping FITS datasets on little-endian machines. Surely in
> order to access any of the data it has to be copied from the FITS standard
> big-endian numeric format to a new array in little-endian format, thereby
> negating any advantage from memory-mapping. Or is there something I am
> missing?
> David
Actually, there is a gain to memory mapping FITS files in
PyFITS. We developed numarray so that it could transparently
handle byte-swapped data. The data must be copied to a
non-byteswapped representation, but not for the whole array
at one time (it's done in fairly small blocks). So yes, you
do pay the price in copying the data in memory, but it doesn't
cost you much memory. For example, if I got a 4Kx4K memory-image
referred to by the variable "im" that happened to be byteswapped
on disk, the following would not result in a large temporary
4Kx4K array being created to handle the byteswapping:

im += 2     # add 2 to image "in-place"

Perry Greenfield

AstroPy mailing list  -  astropy at stsci.edu

More information about the AstroPy mailing list