Skip to main content

Rust port of beamcon from RACS-tools: smooth FITS images and cubes to a common beam via UV-plane (FFT) convolution

Project description

convolve-rs

Docs docs.rs PyPI crates.io

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

A Rust port of beamcon from RACS-tools. Smooths FITS images and spectral cubes to a common beam using UV-plane (FFT) convolution to avoid numerical issues with undersampled kernels.

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 convolve-rs

CLI binary

Requires Rust 1.85+.

cargo install convolve-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 convolve_rs._convolve_rs import _generate_stubs; _generate_stubs()"

This overwrites convolve_rs/_convolve_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, radio-beam, astropy). 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 run --no-sync pytest

Rust tests run with cargo test. One integration test compares output against MIRIAD; point MIRIAD_BIN at a MIRIAD bin directory to enable it (it is skipped when unset):

cargo test
MIRIAD_BIN=/path/to/miriad/bin cargo test   # include the MIRIAD comparison

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

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

It builds on prior work in the radio-astronomy community: the UV-plane convolution and cube handling are ported from RACS-tools, and the common-beam computation follows radio_beam (both BSD). The Gaussian beam algebra implements the standard formulae of Wild (1970), and MIRIAD (GPL) serves as a validation reference 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

convolve_rs-1.2.0.tar.gz (532.3 kB view details)

Uploaded Source

Built Distributions

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

convolve_rs-1.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

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

convolve_rs-1.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (806.1 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

convolve_rs-1.2.0-cp310-abi3-macosx_11_0_arm64.whl (732.6 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for convolve_rs-1.2.0.tar.gz
Algorithm Hash digest
SHA256 a1ad1b204b49666183163bc6a3954342be7577f989bb521ba5e1c9f6affac348
MD5 f0ad16da87c2e0112bbc34ff0f35f10e
BLAKE2b-256 5f9a4096730668699de22a58a28af32e9804481f5cce1554cf40019e2cb1f495

See more details on using hashes here.

Provenance

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

Publisher: cd.yml on AlecThomson/convolve-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 convolve_rs-1.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for convolve_rs-1.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3131fedd7299a7544691c1ec22a639aaeb1bfe1b090c1befe5436d97f561b7c8
MD5 0ef54f6657ea3e22829e0a8de1c21406
BLAKE2b-256 3db4e9376d2b9392d60a5b9cefce43dd5f8d20fdc6409279b0d27731d7dcf4c9

See more details on using hashes here.

Provenance

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

Publisher: cd.yml on AlecThomson/convolve-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 convolve_rs-1.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for convolve_rs-1.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 26e3641ba20c3c9a60f2bc01b56450670137d54fe3d121f6a20b95c4ed06d724
MD5 cd80733d4a113615472aeb85d1908167
BLAKE2b-256 361805a4da122d784c15bf925e9ad95c82deeae05aa7a069867b5a2348947769

See more details on using hashes here.

Provenance

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

Publisher: cd.yml on AlecThomson/convolve-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 convolve_rs-1.2.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for convolve_rs-1.2.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9367234f33014b6134d8b59a7ab444600d840d20e505f8326a41720d7b5e5d46
MD5 e5efc629ed94ddd5e86cefed6e69d91a
BLAKE2b-256 ee00b7fb2fcc9591304f2385cdccae5a6dcc78b0fdfc525c08fc33b36218b3f5

See more details on using hashes here.

Provenance

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

Publisher: cd.yml on AlecThomson/convolve-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