FITS file reader written in pure Rust
This parser was initiated for reading FITS images mapped onto HEALPix cells in the sky (See the HiPS IVOA standard) in order to use it in the Aladin Lite web sky atlas.
Currently, fitsrs supports reading multiple HDU and is mainly dedicated to image extension reading. For interpreting WCS keywords, see wcs-rs. A very new support of binary table extension has been added. This has been done mainly for supporting the tiled compressed image convention that describes the storing of tile images in variable length arrays of a binary table. The ASCII table extension parsing has not been implemented but it is possible to get an iterator over the data bytes as well as its mandatory cards from the header.
Contributing
[!WARNING] Running the test involves test files you can download here. This tar is 2.2GB.
Once the tar file has been downloaded, put it into the root on your cloned repo and extract it:
Once the files have been extracted you can run the tests locally:
Features
- Support single typed data block (i.e. image type data)
- Single HDU parsing, header and data units
- Support FITS files that may not fit in memory (iterator, possibility to seek directly to a specific pixel index/row)
- Async reading (requires to read the whole data. Seeking is not possible)
- Keeping COMMENTS, HISTORY and cards in the same order.
- CONTINUE Long String Keyword convention
- Keep all the cards in the original order
- Basic support of Bintable
- Tiled image convention for storing compressed images in FITS binary tables
- Compression supported, GZIP, GZIP2 and RICE on u8, i16, i32 and f32.
- H_compress and PLI0 compressions
- Dithering techniques for floating point images. Not well tested (test samples are welcome)
-
NULL_PIXEL_MASKcolumn andZMASKCMPkeyword is not supported
- FITS writer/serializer
- ESO HIERARCH keyword convention
- ASCII table extension parsing
- Support of multiple HDU. Image and binary tables extension support. Provide an idiomatic Rust iterator over the list of HDU.
- WCS parsing, see wcs-rs
- Simple Imaging Polynomial (SIP) supported but not well tested
- TNX, TPV, ZPX (non-standard conventions)
[!NOTE] Features not done are not planned to be done. If you want fitsrs to support a specific convention, please open an issue or send us a mail to inform us of your use case(s) and we can manage to support them. The FITS standard and its conventions are massive and it is a huge work to support all of it.
License
fitsrs has the double license MIT/Apache-2.0.
It uses code adapted from the famous CFITSIO library. Especially the RICE decompression source code has been ported from the original cfitsio code to Rust.
Example
use File;
use Cursor;
use ;
use ;
use ;
let f = open.unwrap;
let reader = new;
let mut hdu_list = from_reader;
while let Some = hdu_list.next
For async input readers:
async