atfits-rs
Shared low-level cfitsio helpers for the
at*-rs family of FITS tools (fitscube-rs,
convolve-rs, …).
These are the project-agnostic mechanics that are easy to get subtly wrong against cfitsio, factored out so each tool shares one tested implementation:
PixelType/CubeElem— pixel precision (f32/f64, fromBITPIX) and monomorphic section read/write.keys— update-in-place keyword editing viaffuky*(cfitsio'sffpky*appends duplicate cards) plus convenience readers.header—HeaderGeom(shape/BITPIX) and WCSfind_target_axis.image— image-HDU creation/resize and header-only copying, includingcreate_cube_open: the single-open-handle pattern that writes the data unit once instead of a doubled zero-fill pass on close.output_path— output-path construction.
Domain logic (beams, combine/extract, convolution, spectral specs) stays in the individual crates.
Install
[]
= "0.1"
Features
-
fitsio-src— compile cfitsio from source (needs only a C compiler). Off by default; consumers that build wheels enable it. Without it, the system cfitsio is linked.= { = "0.1", = ["fitsio-src"] }
Example
Create a cube from a 2D template, stream planes via CubeElem section I/O, then
read them back:
use ;
use FitsFile;
let dims = vec!; // FITS axis order: NAXIS1, NAXIS2, NAXIS3
let plane_elems = size * size;
// Single open handle — writes the data unit once, no doubled zero-fill on close.
let mut out = create_cube_open?;
update_key_f64?; // ffuky* — updates in place
for c in 0..nchan
// Read back.
let mut f = open?;
let all = f32read_full?;
# Ok::
Docs
Full API reference: https://docs.rs/atfits-rs. Build locally with:
License
BSD-3-Clause.