[AstroPy] Possible PyFITS behavior change with scaled data
Erik Bray
embray at stsci.edu
Wed May 9 11:35:33 EDT 2012
Hi all,
Speaking of conversion of scaled image data to floats, I have a question
to put out there regarding the upcoming 3.0.8 release of PyFITS.
PyFITS 3.0.8 will fix a long-standing bug that's been around long enough
that I'm worried that some people might have workarounds for it in place
that will break now that the bug is fixed.
This specifically pertains to support for scaled images in image "sections".
For some background, PyFITS has a feature called "sections" that allows
accessing small portions of an image without reading the entire image
into memory at once. For example:
>>> hdul = pyfits.open('jb1f98q1q_raw.fits')
>>> hdul.info()
Filename: jb1f98q1q_raw.fits
No. Name Type Cards Dimensions Format
0 PRIMARY PrimaryHDU 205 () int16
1 SCI ImageHDU 95 (4144, 2068) int16
...
>>> hdul['SCI',1].header['BZERO']
32768.0
>>> hdul['SCI',1].section[:100,:100]
array([[ 2278., 2252., 2248., ..., 2252., 2252., 2253.],
[ 2277., 2252., 2250., ..., 2255., 2253., 2258.],
[ 2277., 2257., 2250., ..., 2260., 2255., 2257.],
..., dtype=float32)
This reads the file in portions so that just the first 100x100 block of
pixels is read from disk.
This feature used to have very spotty/broken support for scaled image
data, but now that's been fixed.
Is that fact that this is now fixed likely to break anybody's code?
Just curious.
Erik
More information about the AstroPy
mailing list