Skip to main content

Wide-angle polynomial beam patterns on the sphere for TART antennas

Project description

beams

Beam patterns for TART antennas.

Wide-angle (up to 180° field of view) antenna beams represented as polynomials on the sphere — a truncated spherical-harmonic series in the direction cosines of a local frame, tapered to zero at the horizon and identically zero behind the antenna. See DESIGN.md for the full rationale.

Install

pip install -e .            # core (numpy, scipy)
pip install -e '.[healpix]' # + healpy for full-sphere combine

Quick start

import numpy as np
from tart_beam import Beam, coverage_map, mosaic, fit_from_json

# fit directly from measured data: a JSON list of {el, az, gain} (degrees),
# with the beam assumed to point at the zenith
beam = fit_from_json("measured.json", degree=8, q=2)

# ...or fit from arbitrary samples (sky unit vectors + values)
beam = Beam.fit(s_hat, values, degree=8, q=2)

# evaluate anywhere; exactly zero behind the antenna
response = beam.evaluate(sky_vectors)

# point copies of it and tile the full HEALPix sphere
beams = [Beam(beam.indices, beam.coeffs, boresight=p, q=beam.q) for p in pointings]
A = coverage_map(beams, nside=64)                 # summed sensitivity
sky, weight = mosaic(beams, per_beam_maps)        # inverse-variance mosaic

beam.to_json("beam.json"); Beam.from_json("beam.json")

See examples/demo.py for an end-to-end example.

Usage

Default TART beam

The package ships a reference primary-beam pattern for TART antenna elements: uniform above 10° elevation, tapering smoothly to zero at the horizon.

from tart_beam import base_tart_beam

beam = base_tart_beam(degree=8, q=1)          # first call fits and caches
beam = base_tart_beam()                        # subsequent calls are instant

The returned :class:Beam is a full spherical-harmonic model, pointable and compatible with all the operations below.

Evaluate at elevation / azimuth points

Convert elevation/azimuth (degrees) to unit sky vectors, then call :meth:Beam.evaluate:

from tart_beam import base_tart_beam, elaz_to_vec
import numpy as np

beam = base_tart_beam()

# Single direction
el, az = 45.0, 30.0
s_hat = elaz_to_vec(el, az)           # unit vector on the sphere
gain = beam.evaluate(s_hat[np.newaxis])[0]

# Grid over the whole sky
el = np.linspace(0, 90, 19)          # 0° … 90°
az = np.linspace(0, 360, 37)         # 0° … 360°
EL, AZ = np.meshgrid(el, az, indexing="ij")
s_hat = elaz_to_vec(EL.ravel(), AZ.ravel())
gain = beam.evaluate(s_hat).reshape(EL.shape)

Get a HEALPix map from a beam

Evaluate the beam on a full-sphere HEALPix grid to produce all-sky maps suitable for mosaicking or visualisation:

from tart_beam import base_tart_beam
from tart_beam import coverage_map, healpix_directions

beam = base_tart_beam()

# Pixel-centre directions for a given resolution (requires healpy)
s_hat = healpix_directions(nside=64)   # shape (49152, 3)
hpx_map = beam.evaluate(s_hat)         # shape (49152,) — the beam on the sphere

For overlapping beams pointed in different directions, use the combine helpers to build coverage maps and mosaics directly on HEALPix:

# Tile four copies of the base beam over the sky
from tart_beam import Beam

pointings = [
    [0.0, 0.0, 1.0],                             # zenith
    [0.866, 0.0, 0.5],                           # 60° from zenith
    [-0.433, 0.75, 0.5],
    [-0.433, -0.75, 0.5],
]
beams = [Beam(beam.indices, beam.coeffs, boresight=p, q=beam.q)
         for p in pointings]

cov = coverage_map(beams, nside=64)              # summed sensitivity
sky, weight = mosaic(beams, per_beam_maps)        # inverse-variance mosaic

Input data format

fit_from_json reads a JSON list of records, elevation and azimuth in degrees:

[{"el": 90.0, "az": 0.0, "gain": 1.0},
 {"el": 45.0, "az": 30.0, "gain": 0.42}]

The beam is assumed to point at the zenith: a sample at elevation el maps to w = sin(el), so el = 90° is boresight, el = 0° is the horizon, and samples below the horizon (el < 0°) are dropped by the fit. Re-point the fitted beam afterwards with beam.set_pointing(boresight).

Layout

  • tart_beam/spherical.py — real spherical-harmonic basis
  • tart_beam/beam.pyBeam: pointing, evaluation, fitting, (de)serialisation
  • tart_beam/loaders.py — el/az/gain JSON loader and fit_from_json
  • tart_beam/combine.py — full-sphere HEALPix products (coverage, mosaic, blend)

Copyright (c) 2026 Tim Molteno (tim@elec.ac.nz)

Project details


Download files

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

Source Distribution

tart_beam-0.1.0.tar.gz (34.1 kB view details)

Uploaded Source

Built Distribution

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

tart_beam-0.1.0-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

File details

Details for the file tart_beam-0.1.0.tar.gz.

File metadata

  • Download URL: tart_beam-0.1.0.tar.gz
  • Upload date:
  • Size: 34.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tart_beam-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d2a165115b67f4b33b3051c1caa97fc3c247c1dbd36b477e63b7e29d6dcc9a07
MD5 1244083820d3fa648ebd2a17b6074a50
BLAKE2b-256 142cc820424b0b1da0541c28abed591052d82b1f738a8bb10db7ddcaeaae5f83

See more details on using hashes here.

Provenance

The following attestation bundles were made for tart_beam-0.1.0.tar.gz:

Publisher: publish.yml on tart-telescope/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 tart_beam-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tart_beam-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tart_beam-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f61aafbd2eb646460ee847ebef574af4c60aa8077f1005ba0acc05a022f984b8
MD5 1130d3febbf2f51cafdc5b8eb5d62c28
BLAKE2b-256 cd5c11a70d390b5577e00d9229b827d609396fb99a2400ebf52ca5e9d2536aab

See more details on using hashes here.

Provenance

The following attestation bundles were made for tart_beam-0.1.0-py3-none-any.whl:

Publisher: publish.yml on tart-telescope/beams

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page