Skip to main content

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

Project description

fitscube-rs

Docs docs.rs PyPI crates.io

Documentation: Python API, CLI, and algorithm background at fitscube-rs.readthedocs.io; Rust API at docs.rs/fitscube-rs.

A Rust port of the fitscube Python package. Combines single-frequency/single-time FITS images into a FITS cube — building the spectral (or time) axis from the per-image headers, detecting even vs uneven spacing, preserving per-channel beams in a CASA BEAMS table — and extracts individual planes back out.

Note: This is an experiment in LLM-assisted coding with Claude. Do not trust this software as far as you can throw it.

Installation

Python library

pip install fitscube-rs

CLI binary

Requires Rust 1.85+.

cargo install fitscube-rs

Usage

Development

Install in editable mode:

uv pip install -e .

After changing the Python-facing Rust API in src/python.rs, rebuild with the stubgen feature (the default build omits _generate_stubs) and regenerate the type stubs:

uv run maturin develop --features stubgen
uv run --no-sync python -c "from fitscube_rs._fitscube_rs import _generate_stubs; _generate_stubs()"

This overwrites fitscube_rs/_fitscube_rs.pyi from the Rust annotations and docstrings. Commit the result alongside any API changes.

Running tests

Python tests need the compiled extension and the test extra (pytest, astropy), plus the upstream fitscube package, which the parity tests validate against. uv sync builds the maturin extension into .venv, so a plain uvx pytest won't work — it runs in an isolated env with neither the module nor the deps:

uv sync --extra test       # builds the extension + installs test deps
uv pip install fitscube    # upstream package, for parity tests
uv run --no-sync pytest

Rust tests run with cargo test:

cargo test

Pre-commit hooks

Formatters and linters run via prek, a fast drop-in pre-commit reimplementation. The hooks (.pre-commit-config.yaml) are the same checks CI enforces: ruff lint + format, ty type checking, cargo fmt, and cargo clippy.

uv sync --extra dev   # installs prek + ty into the venv
uvx prek install      # install the git hook (runs on every commit)
uvx prek run --all-files   # run all hooks manually

License

fitscube-rs is released under the BSD 3-Clause License.

It is a port of the fitscube Python package by Alec Thomson (BSD 3-Clause), and validates its output against that package in the test suite. See NOTICE.md for full attributions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fitscube_rs-1.2.0.tar.gz (193.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fitscube_rs-1.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

fitscube_rs-1.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

fitscube_rs-1.2.0-cp310-abi3-macosx_11_0_arm64.whl (994.9 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file fitscube_rs-1.2.0.tar.gz.

File metadata

  • Download URL: fitscube_rs-1.2.0.tar.gz
  • Upload date:
  • Size: 193.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fitscube_rs-1.2.0.tar.gz
Algorithm Hash digest
SHA256 195ce513c1d3c430dba985a0fa915bdbdf0b26ac7a90a70c18f4677867949780
MD5 1b715ace125a41444919eb6fd5f6919c
BLAKE2b-256 416142345afd6bb6fb4fb5d08bbef7391266c453fc22faef3bef1eeaae1d136e

See more details on using hashes here.

Provenance

The following attestation bundles were made for fitscube_rs-1.2.0.tar.gz:

Publisher: cd.yml on AlecThomson/fitscube-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fitscube_rs-1.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fitscube_rs-1.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7f800816b11bce1030729b160232c7b3bc575644bfa12ef4c08525ffb70cdae1
MD5 5076d060563625f32a2e9cfb3665a2a7
BLAKE2b-256 85b0c48cb043c685c76b13fa88670971a554069ba4a6dd6b9ae537faad9e64e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for fitscube_rs-1.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: cd.yml on AlecThomson/fitscube-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fitscube_rs-1.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fitscube_rs-1.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ab9d0a6e5f73d7a22c4f47fedccb55d241187aefb5701a1fef97e5a997afeed4
MD5 96fb3cd13d315d046e04c84bc9b69332
BLAKE2b-256 07f8b59be09a7fed8110fe92dfde18db5b94133f9d6eaadf46b252f62acca88b

See more details on using hashes here.

Provenance

The following attestation bundles were made for fitscube_rs-1.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: cd.yml on AlecThomson/fitscube-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fitscube_rs-1.2.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fitscube_rs-1.2.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9316bf57af8fcd7dd8d8c3efd91f56ad8a8d240ba57056ffb48148ca73044d9e
MD5 fb3c9b863618188b0767d95f3d8100b5
BLAKE2b-256 0dc0cd87c80a8e242e58cd8bf7f03708b6c46aca4a4d1c2692ce69593bdcbba6

See more details on using hashes here.

Provenance

The following attestation bundles were made for fitscube_rs-1.2.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: cd.yml on AlecThomson/fitscube-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page