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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

meerkat_beams-0.0.1.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

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

meerkat_beams-0.0.1-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file meerkat_beams-0.0.1.tar.gz.

File metadata

  • Download URL: meerkat_beams-0.0.1.tar.gz
  • Upload date:
  • Size: 25.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for meerkat_beams-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9131ddea31f1fc1a9fa2eaba7ca1ca5a1f9fe28cc83eb9dedcd39b88e987a2d7
MD5 489fc99d1ccb3576bcb8e0478ff50686
BLAKE2b-256 e4622d50e8c0c5eb051effdcbb68de1d2f908a84117b170a7944ebe17849d5ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for meerkat_beams-0.0.1.tar.gz:

Publisher: publish.yml on landmanbester/meerkat-beams

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file meerkat_beams-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: meerkat_beams-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 35.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for meerkat_beams-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 81c902cc2ba3245f911378b73a7879b1ee7a6971fefb6b2031432f7973c39a1f
MD5 3216df36f006a24f53071e0bff7470ab
BLAKE2b-256 530002a2c789f5de43d584c0259e46f8305f66a3f9b57aee0a885820338efeda

See more details on using hashes here.

Provenance

The following attestation bundles were made for meerkat_beams-0.0.1-py3-none-any.whl:

Publisher: publish.yml on landmanbester/meerkat-beams

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 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