Skip to main content

meerkat-beams

MeerKAT primary-beam model handling: download MdV beam files from the SARAO archive (https://doi.org/10.48479/wdb0-h061), convert them to a beam dataset (BDS), and render time/frequency-resolved primary beams to xradio-compatible zarr stores.

Installation

pip install meerkat-beams[full]

The [full] extra pulls in the scientific stack (xarray, zarr, astropy, scipy, numpy, matplotlib, dask, wget, gdown, plus hip-cargo[s3] for s3:// paths). Use plain meerkat-beams only if you need the CLI metadata for Stimela without running the implementations locally. Every store the package writes is zarr format 2, whether zarr-python 2 or 3 is installed, so its output stays readable by either.

Python support

Python Support
3.11 – 3.13 Full: [full] scientific stack, tested in CI
3.10 Lightweight only: base install (CLI + hip-cargo container dispatch via --backend docker/podman/...). The [full] stack is neither tested nor supported on 3.10.

On 3.10 the base install lets you run every mbeams command by dispatching the actual computation to the container image — nothing scientific runs natively. CI pins this with a dedicated lightweight-install job; the test matrix itself starts at 3.11 (do not add 3.10 to it).

Quick start — auto-downloading cache

The simplest path is to construct a BeamWizard with just the MeerKAT band code; the mean-beam zarr is downloaded from Google Drive on first use and cached locally:

from meerkat_beams.utils import BeamWizard

bw = BeamWizard(band="L", image_name="my_image.fits")
beam_gain = bw.get_time_variable_beamgain(source_coord, times=obs_times)

Supported bands: U, L, S0, S4. (S1, S2, S3 have no published Google Drive ID — pass bds_name= directly for those.)

Cache layout

$MBEAMS_CACHE_DIR/  (or $XDG_CACHE_HOME/meerkat-beams, or ~/.cache/meerkat-beams)
├── inputs/MeerKAT_<BAND>.zarr/    # downloaded mean-beam zarr
└── bds/MeerKAT_<BAND>.bds.zarr/   # locally built compressed BDS

Subsequent constructions of BeamWizard(band=...) reuse the cached BDS. To warm a band ahead of time, just instantiate the wizard once.

Concurrency: the first-time download is not locked. Warm each band from a single process before fanning out.

CLI

The mbeams command wraps each stage of the pipeline. The CLI is generated by hip-cargo and supports both native execution and container dispatch (--backend apptainer|singularity|docker|podman).

# Download an MdV beam from SARAO (band code, filename, or full URL)
mbeams download-mdv-beams --source L

# Convert MdV .npz (or mean-beam zarr) to a BDS
mbeams mdv-beams-to-bds --mdv-beams input.npz --bds output.bds.zarr --compress

# Render a BDS to an xradio-compatible zarr along an image's WCS / time axis
mbeams bds-to-xradio --bds-path beam.bds.zarr --image-path image.zarr --output beam_xradio.zarr

# Shortcut: dump one Jones element / component of an MdV .npz directly to an xradio zarr
mbeams mdv-to-xradio --npz-path input.npz --output beam_xradio.zarr --jones HH --part real

Each command accepts --help. The container-dispatch path is opt-in (--backend defaults to auto → native).

Development

uv sync --group dev --group test
uv run ruff check . && uv run ruff format --check .
uv run pytest -m unit                           # hermetic unit tests
MBEAMS_OFFLINE=1 uv run pytest -m unit          # strict-hermetic (skip L-band warm-up)
uv run pytest                                   # full suite (integration tests may skip)
bash scripts/genfuncs.sh                        # regenerate cli/*.py from cabs/*.yml

See CLAUDE.md for the full architecture, conventions, and test layout.

Metadata

Release files for meerkat-beams 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 meerkat-beams 0.2.0
File Size Uploaded Provenance
meerkat_beams-0.2.0.tar.gz 45.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for meerkat-beams 0.2.0
File Interpreter ABI Platform
meerkat_beams-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 99.7 kB

Release files / meerkat_beams-0.2.0.tar.gz

Download URL meerkat_beams-0.2.0.tar.gz
Size 45.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f07af415abb60121e51a7ae083b51bfe5d7d5d7fe280a260ce38b8fdfe57285e
BLAKE2b-256 checksum
How to use checksums
05c7ddc44b6569fc78edb4f9d5b699153bdbe261dafd0c529506112e28c5f122
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 Oct 18, 2026.

Transparency log

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

Download URL meerkat_beams-0.2.0-py3-none-any.whl
Size 54.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
886bec9ddb8121436fbb5bda59ec7cca21a79188939f4494b7860b95cc3001fa
BLAKE2b-256 checksum
How to use checksums
98b447c3327cd1a421ab332a70ca0907c5f8dee501b0038475c4abd0ad231885
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 Oct 18, 2026.

Transparency log

Security for meerkat-beams 0.2.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for meerkat_beams-0.2.0.tar.gz

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 Oct 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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