fitscube-rs 1.2.2

Combine single-frequency/single-time FITS images into a FITS cube (Rust port of fitscube)
Documentation
# CLI usage

The `fitscubers` binary is the command-line interface, a port of the
[`fitscube`](https://github.com/AlecThomson/fitscube) Python package. It
combines single-frequency/single-time FITS images into a FITS cube and extracts
individual planes back out. Install it with:

```sh
cargo install fitscube-rs
```

```{note}
The help text on this page is generated by running the binary at docs build
time, so it always matches the documented version.
```

```{command-output} cargo run -q --bin fitscubers -- --help
:cwd: ..
```

## Common workflows

Combine a set of single-channel images into a cube:

```sh
fitscubers combine chan_*.fits cube.fits
```

Overwrite an existing output and trim the all-blank border of every plane to a
common bounding box:

```sh
fitscubers combine --overwrite --bounding-box chan_*.fits cube.fits
```

Build a cube along the time axis instead of frequency:

```sh
fitscubers combine --time-domain epoch_*.fits cube.fits
```

Extract one channel back out of a cube:

```sh
fitscubers extract cube.fits --channel-index 0 --output-path chan0.fits
```

## `fitscubers combine`

```{command-output} cargo run -q --bin fitscubers -- combine --help
:cwd: ..
```

The spectral (or time) axis is built from the per-image headers. Frequencies
are read from, in priority order:

1. An explicit `--spec-file` or inline `--specs` list (overrides the headers).
2. The spectral WCS keywords of each input image (`CRVAL`/`CTYPE`/`CUNIT` of the
   relevant axis).

Even spacing is detected automatically and recorded as a linear axis; uneven
spacing is preserved as a per-plane table. Per-channel beams, when present, are
written to a CASA `BEAMS` binary-table extension (`CASAMBM=T`).

## `fitscubers extract`

```{command-output} cargo run -q --bin fitscubers -- extract --help
:cwd: ..
```

`extract` is the inverse of `combine`: pick a plane by `--channel-index` (for
frequency cubes) or `--time-index` (for time cubes) and write it as a 2D image,
optionally reading from a non-primary HDU with `--hdu-index`.