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
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 --path .
Python usage
from astropy.io import fits
import numpy as np
from convolve_rs import Beam, common_beam, smooth
hdu = fits.open("image.fits")
data = hdu[0].data.squeeze().astype(np.float32)
dx_deg = hdu[0].header["CDELT1"] # may be negative
dy_deg = hdu[0].header["CDELT2"]
current = Beam.from_fits_header(hdu[0].header)
target = Beam(0.002, 0.002, 0.0) # or common_beam([...]) across channels
# `bunit` selects the flux scaling: Jy/beam images are rescaled to stay in
# Jy/beam; Kelvin (brightness temperature) images are left unscaled. An
# unrecognised unit emits a UserWarning and is treated as Jy/beam.
smoothed = smooth(data, current, target, dx_deg, dy_deg, bunit=hdu[0].header.get("BUNIT"))
hdu[0].data[0, 0] = smoothed
fits.writeto("smoothed.fits", hdu[0].data, hdu[0].header, overwrite=True)
CLI usage
convolvers --help
convolvers 2d --help
convolvers 3d --help
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.
License
convolve-rs is released under the BSD 3-Clause License.
It draws on prior work in the radio-astronomy community: the UV-plane convolution and cube handling are ported from RACS-tools (BSD), and the common-beam computation follows radio_beam (BSD). The Gaussian beam algebra is an independent implementation of standard formulae (Wild 1970) — MIRIAD is used only as a validation reference in the test suite. See NOTICE.md for full attributions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file convolve_rs-1.0.0.tar.gz.
File metadata
- Download URL: convolve_rs-1.0.0.tar.gz
- Upload date:
- Size: 102.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e610039f5f1d33c7a4e5f47d7b7f18e8f07d5af4dc06170cf7953f7c8a83bc5
|
|
| MD5 |
a139e24b663960b7612fc100323e9aa9
|
|
| BLAKE2b-256 |
ea643783650253f2ff1daab2d6d0d0427e6a243783d58175e4bc2ea8ee11ff5f
|
Provenance
The following attestation bundles were made for convolve_rs-1.0.0.tar.gz:
Publisher:
cd.yml on AlecThomson/convolve-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
convolve_rs-1.0.0.tar.gz -
Subject digest:
4e610039f5f1d33c7a4e5f47d7b7f18e8f07d5af4dc06170cf7953f7c8a83bc5 - Sigstore transparency entry: 1775983469
- Sigstore integration time:
-
Permalink:
AlecThomson/convolve-rs@772bbcf1da73c9a3d727a41404828b53289ff28d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/AlecThomson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@772bbcf1da73c9a3d727a41404828b53289ff28d -
Trigger Event:
release
-
Statement type:
File details
Details for the file convolve_rs-1.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: convolve_rs-1.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 681.5 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
459c74119f72c06f0d317b241d71e7e664710b677fbf83804acf5ae257d08df8
|
|
| MD5 |
ff7e58331655975aa23bdd309215b4a3
|
|
| BLAKE2b-256 |
b44c9e2e992342a92c11d432a82d08445589a09903532b460552eb6f2690b926
|
Provenance
The following attestation bundles were made for convolve_rs-1.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
cd.yml on AlecThomson/convolve-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
convolve_rs-1.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
459c74119f72c06f0d317b241d71e7e664710b677fbf83804acf5ae257d08df8 - Sigstore transparency entry: 1775983612
- Sigstore integration time:
-
Permalink:
AlecThomson/convolve-rs@772bbcf1da73c9a3d727a41404828b53289ff28d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/AlecThomson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@772bbcf1da73c9a3d727a41404828b53289ff28d -
Trigger Event:
release
-
Statement type:
File details
Details for the file convolve_rs-1.0.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: convolve_rs-1.0.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 581.4 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b004be9bf337070c8172916e43d3e52d9c02f02f23f4f3632972d1eb332bf551
|
|
| MD5 |
6dd7a28128b99a708130af380d8aa7a5
|
|
| BLAKE2b-256 |
a896c66ea6171075370eda0a791dad44464b58d796ab905fef17f185cce60533
|
Provenance
The following attestation bundles were made for convolve_rs-1.0.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
cd.yml on AlecThomson/convolve-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
convolve_rs-1.0.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
b004be9bf337070c8172916e43d3e52d9c02f02f23f4f3632972d1eb332bf551 - Sigstore transparency entry: 1775983533
- Sigstore integration time:
-
Permalink:
AlecThomson/convolve-rs@772bbcf1da73c9a3d727a41404828b53289ff28d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/AlecThomson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@772bbcf1da73c9a3d727a41404828b53289ff28d -
Trigger Event:
release
-
Statement type:
File details
Details for the file convolve_rs-1.0.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: convolve_rs-1.0.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 521.2 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75307f97d1d037ea7359966c76a1a73983efd1ca7b2776d354b501f000385caa
|
|
| MD5 |
fc06ab897e0bddd998e4c3e9c31f7e63
|
|
| BLAKE2b-256 |
6bf3dea07080921f83cb8d78daeeb2b2b86b0182d118b5c5cb0eda16e95f270f
|
Provenance
The following attestation bundles were made for convolve_rs-1.0.0-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
cd.yml on AlecThomson/convolve-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
convolve_rs-1.0.0-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
75307f97d1d037ea7359966c76a1a73983efd1ca7b2776d354b501f000385caa - Sigstore transparency entry: 1775983690
- Sigstore integration time:
-
Permalink:
AlecThomson/convolve-rs@772bbcf1da73c9a3d727a41404828b53289ff28d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/AlecThomson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@772bbcf1da73c9a3d727a41404828b53289ff28d -
Trigger Event:
release
-
Statement type: