Skip to main content

snapshot_imager

CI codecov PyPI

snapshot_imager is a Python package for radio interferometric snapshot imaging using Non-Uniform Fast Fourier Transforms (NUFFT). It is designed to efficiently produce dirty image cubes from visibility data, with support for multiple NUFFT strategies (Type 1, Type 3, and multi-frequency synthesis) and optional GPU acceleration via CuPy and cuFINUFFT.

Installation

Install the latest release from PyPI:

pip install snapshot-imager

For GPU support (CUDA 12), install the gpu extra, which pulls in cupy-cuda12x and cufinufft:

pip install "snapshot-imager[gpu]"

For other CUDA versions, install the matching CuPy wheel (e.g. cupy-cuda11x or cupy-cuda13x) and cufinufft yourself.

macOS note: on Apple-silicon Macs, use Python 3.13 or newer. The healpy wheels for Python 3.10–3.12 (installed via hera_cal) bundle their own OpenMP runtime, which conflicts with FINUFFT's and crashes on the first imaging call.

To install from source:

git clone https://github.com/HERA-Team/snapshot_imager.git
cd snapshot_imager
pip install .

Basic Usage

The typical workflow is to unpack HERA DataContainer objects into an ImagingData container, then pass that to one of the imaging functions.

import numpy as np
from snapshot_imager import unpack_data_containers, snapshot_imager_type1

# data, flags, and nsamples are hera_cal DataContainer objects
imaging_data = unpack_data_containers(
    data=data,
    flags=flags,
    nsamples=nsamples,
    pol="ee",
    antpos=antpos,
    freqs=freqs,
)

# Produce a (ntimes, nfreqs, npix, npix) image cube
result = snapshot_imager_type1(
    imaging_data,
    npix=256,
    fov=10.0,       # Field of view in degrees
    use_cupy=False, # Set to True to use GPU acceleration
)

print(result.images.shape)  # (ntimes, nfreqs, npix, npix)

The returned ImageResult contains the image cube along with the corresponding l_coords and m_coords (direction cosines) for plotting or downstream analysis.

GPU Acceleration

snapshot_imager supports GPU-accelerated imaging via CuPy and cuFINUFFT. Simply pass use_cupy=True to any imaging function:

result = snapshot_imager_type1(imaging_data, npix=256, fov=10.0, use_cupy=True)

If CuPy or cuFINUFFT are not available, the package will automatically fall back to the CPU implementation with a warning.

Development

Set up a development environment with the test and lint tools, and install the git hooks:

pip install -e ".[dev]"
pre-commit install

Run the test suite (GPU tests are skipped automatically when no GPU is available):

pytest --cov

Lint with ruff (this also runs on every commit via pre-commit, and in CI):

pre-commit run --all-files

Releasing

Versions are derived from git tags by setuptools-scm, so there is no version string to bump in the code. To publish a release to PyPI:

  1. Make sure CI is passing on main.

  2. Tag the release commit and push the tag:

    git tag -a v0.2.0 -m "v0.2.0"
    git push origin v0.2.0
    
  3. The Publish to PyPI workflow builds the sdist and wheel and uploads them using PyPI trusted publishing. Optionally, create a GitHub release from the tag to record release notes.

License

MIT

Metadata

Release files for snapshot-imager 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snapshot-imager 0.2.0
File Size Uploaded
snapshot_imager-0.2.0.tar.gz 26.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for snapshot-imager 0.2.0
File Interpreter ABI Platform
snapshot_imager-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 41.3 kB

Release files / snapshot_imager-0.2.0.tar.gz

Download URL snapshot_imager-0.2.0.tar.gz
Size 26.2 kB
Tags Source
SHA-256 checksum
How to use checksums
017a0b0cca23f27825111976faa01dff37f431584fc1329b3d927c3fd7c2c4ca
BLAKE2b-256 checksum
How to use checksums
8f9b2a70774e562bd3dfade23fa5eb1fe5489a996b8756605b0c97bebc4a09c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / snapshot_imager-0.2.0-py3-none-any.whl

Download URL snapshot_imager-0.2.0-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
965ce3d5f2503defd51d0e4c8f6c64917768e9e9efa5c9dac85c01e3a1912e19
BLAKE2b-256 checksum
How to use checksums
0f5e734d30b67edc5a929a4f424bf18f13707cafae11f39cc0ae58e09b3c89c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.0

2 release files

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page