-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transparently support uint16 and uint32 in astropy.io.fits (for tables) #362
Comments
Doesn't pyfits/astropy.io.fits already do this? It definitely did years ago when I worked on it. |
I forgot to mention that I meant in tables:
Things work fine for Image HDUs, so it'd be great for table columns to operate in the same way. |
Yeah, this has been on my to-do list for a while. I don't think it's too hard a change either so I might try doing it sooner rather than later. Though where pyfits is concerned I really want to focus at this point on replacing the table interface in its entirety. |
See also the related ticket for pyfits: https://trac.assembla.com/pyfits/ticket/192 |
I am preparing a pull request that addresses this issue. |
Fix fetching of astropy-helpers on Python 2
It would be great if PyFITS could transparently support unsigned 16- and 32-bit integers in Tables. Even though the FITS standard does not directly support this, a 16-bit unsigned integer can be written as a 16-bit signed integer with BSCALE=1 and BZERO= 32768. Similarly, a 32-bit unsigned integer can be written as a 32-bit signed integer with BSCALE=1 and BZERO= 2147483648. This could work for both input and output - i.e. if a 16-bit unsigned integer is written, then BZERO and BSCALE are set appropriately, and if BSCALE=1 and BZERO=32768 and the column is a 16-bit signed integer, it is converted to a 16-bit unsigned integer upon reading.
For info, cfitsio already does this: http://heasarc.gsfc.nasa.gov/fitsio/c/c_user/node23.html
[Note: This functionality already works in PyFITS using uint=True when opening the file. However it only works for images, not tables.]
The text was updated successfully, but these errors were encountered: