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<3, astropy, scipy, numpy, matplotlib, dask-ms, wget, gdown). Use plain meerkat-beams only if you need the CLI metadata for Stimela without running the implementations locally.

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.1.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.1.0
File Size Uploaded Provenance
meerkat_beams-0.1.0.tar.gz 41.4 kB With provenance Details

Built distribution (wheel)

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

Total release size: 93.0 kB

Release files / meerkat_beams-0.1.0.tar.gz

Download URL meerkat_beams-0.1.0.tar.gz
Size 41.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b65005f05fa63164190d3e6158ea442af23e2b1d77f2ed6ce2ab33824757445e
BLAKE2b-256 checksum
How to use checksums
cd240b5fb05b2f2e81fa2ce5d14fe2c28c6feea9b338608ddca25e407bab25bb
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 6, 2026.

Transparency log

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

Download URL meerkat_beams-0.1.0-py3-none-any.whl
Size 51.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ecb65a62f93a388e5c2064f4090c650920f130f996bb0b715d6e7b2388661b1
BLAKE2b-256 checksum
How to use checksums
dffff7d159bbe176e7d58f1a789630783e938a7880a771429962faf8b8203a0a
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 6, 2026.

Transparency log

Security for meerkat-beams 0.1.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.1.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 6, 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