-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
featr: add vector type support (#330)
Add vector type support (ex: '100E') and fix bit handling * In the FITS spec, columns can be of vector type, where each row has multiple of the same data type. Bitmasks (`32X`) and strings (`20A`) are the most common examples, but others exist in the wild. My example is from [Planck Legacy Archives](https://pla.esac.esa.int/pla/index.html#home) → Maps → CMB Maps → Uncheck "Only legacy products" → SEVEM → Click to download the single row (full mission); this FITS file contains one row, which is `TFORM1` of `201326592E`, which happens to be a HEALPix map with `NSIDE` of 4096. * In more fully supporting repeats for vectors, revamped the bit handling. * Filled out the data type support and added round-trip read-write tests for all vector types. Weirdly, I couldn't get the u32 case to work and suspect a CFITSIO bug. I left the u32 test commented out for now with a more detailed explanation. Would love someone to reproduce and investigate. Then again, all unsigned integral types beyond u8 are unofficial CFITSIO extensions beyond the FITS spec, so maybe it's OK to leave out. * Removed conditionals for 32-bit and 64-bit `reads_col_impl` and `writes_col_impl`; `int` is 32 bits and `long long` is consistently 64 bits on all machines and platforms since ~2000. Only `long` is weird and special. Contribution checklist: * `cargo test` passes on my M1 Mac and on an x86_64 Linux machine using the provided Docker environment. I'm afraid I don't have any 32-bit or Windows environments available for testing. * `rustfmt` changes nothing. * Added to changelog. * I have not updated `full_example.rs`, as `test_vector_datatypes.rs` shows how to use vector types, but I am happy to do so upon request. --------- Co-authored-by: Simon Walker <[email protected]>
- Loading branch information
Showing
8 changed files
with
217 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.