| | 1 | psLib defines a collection of APIs for working with FITS files on disk. These currently wrap the CFITSIO library. This page has notes on the implementation. |
| | 2 | |
| | 3 | === GZIP Tile Compression and Ohana/libgfits === |
| | 4 | |
| | 5 | Files compressed with CFITSIO Tile compression using the gzip compression method have to be handled in a somewhat surprising way by libgfits. In the tile compression method, a series of compressed data sequences are written as entries in a variable length FITS table column. These are identified by the table header as having 4 bytes per data element. Normally, I would expect to have to do the following steps: |
| | 6 | # read a segment of data from the table |
| | 7 | # byteswap (if needed) based on the size of the data element (in this case 4 bytes) |
| | 8 | # pass the swapped data vector to the uncompression function (in this case zlib's uncompress function) |
| | 9 | # insert the resulting data values into the image in the appropriate location. |
| | 10 | |
| | 11 | For images compressed with cfitsio gzip (at least for 16 input data), I apparently have to: |
| | 12 | # read the data segment from the table |
| | 13 | # strip off the gzip header segment (gfits_gz_striphead) |
| | 14 | # pass the remaining bytes directly to a modified version of the uncompress function (gfits_uncompress) -- this version is copied from uncompress, but passes the value -15 to inflateInit to tell it that the data has had the header stripped already. |
| | 15 | # byteswap the resulting vector based on the bytes/pixel of the output data. |
| | 16 | |
| | 17 | Does this mean I am doing something wrong (ie, I could skip some of this work if I just...?), or does it mean CFITSIO is doing something strange (like byteswapping in the wrong place or messing up the header?). I've update libgfits to handle this issue in r23724. |
| | 18 | |
| | 19 | |