Skip to main content

Primary beam code for the Murchison Widefield Array (MWA) radio telescope.

Project description

mwa_hyperbeam

hyperbeam logo
docs Tests

Primary beam code for the Murchison Widefield Array (MWA) radio telescope.

This code exists to provide a single correct, convenient implementation of Marcin Sokolowski's Full Embedded Element (FEE) primary beam model of the MWA, a.k.a. "the 2016 beam". This code should be used over all others. If there are soundness issues, please raise them here so everyone can benefit.

Usage

hyperbeam requires the MWA FEE HDF5 file. This can be obtained with:

wget http://ws.mwatelescope.org/static/mwa_full_embedded_element_pattern.h5

When making a new beam object, hyperbeam needs to know where this HDF5 file is. The easiest thing to do is set the environment variable MWA_BEAM_FILE:

export MWA_BEAM_FILE=/path/to/mwa_full_embedded_element_pattern.h5

(On Pawsey systems, this should be export MWA_BEAM_FILE=/pawsey/mwa/mwa_full_embedded_element_pattern.h5)

hyperbeam can be used by any programming language providing FFI via C. In other words, most languages. See Rust, C and Python examples of usage in the examples directory. A simple Python example is:

import mwa_hyperbeam
beam = mwa_hyperbeam.FEEBeam()
print(beam.calc_jones(0, 0.7, 167e6, [0]*16, [1]*16, True))

[ 1.73003520e-05-1.53580286e-05j -2.23184781e-01-4.51051073e-02j
 -1.51506097e-01-4.35034884e-02j -9.76099405e-06-1.21699926e-05j]

Installation

Python PyPI

If you're using Python version >=3.6:

pip install mwa_hyperbeam

Pre-compiled

Have a look at the GitHub releases page. There is a Python wheel for all versions of Python 3.6+, as well as shared and static objects for C-style linking. To get an idea of how to link hyperbeam, see the beam_calcs.c file in the examples directory.

Because these hyperbeam objects have the HDF5 library compiled in, the HDF5 license is also distributed.

From source

Prerequisites

  • Cargo and a Rust compiler. rustup is recommended:

    https://www.rust-lang.org/tools/install

    The Rust compiler must be at least version 1.47.0:

    $ rustc -V
    rustc 1.47.0 (18bf6b4f0 2020-10-07)
    
  • hdf5

    • Optional; use the hdf5-static feature.
    • Ubuntu: libhdf5-dev
    • Arch: hdf5

Clone the repo, and run:

cargo build --release

For usage with other languages, an include file will be in the include directory, along with C-compatible shared and static objects in the target/release directory.

To make hyperbeam without a dependence on a system HDF5 library, give the build command a feature flag:

cargo build --release --features=hdf5-static

This will automatically compile the HDF5 source code and "bake" it into the hyperbeam products, meaning that HDF5 is not needed as a system dependency. CMake version 3.10 or higher is needed to build the HDF5 source.

Python

To install hyperbeam to your currently-in-use virtualenv or conda environment, you'll need the Python package maturin (can get it with pip), then run:

maturin develop --release -b pyo3 --cargo-extra-args="--features python" --strip

If you don't have or don't want to install HDF5 as a system dependency, include the hdf5-static feature:

maturin develop --release -b pyo3 --cargo-extra-args="--features python,hdf5-static" --strip

Comparing with other FEE beam codes

Below is a table comparing other implementations of the FEE beam code. All benchmarks were done with unique azimuth and zenith angle directionss, and all on the same system. The CPU is a Ryzen 9 3900X, which has 12 cores and SMT (24 threads). All benchmarks were done in serial, unless indicated by "parallel". Python times were taken by running time.time() before and after the calculations. Memory usage is measured by running time -v on the command (not the time associated with your shell; this is usually at /usr/bin/time).

Code Number of directions Duration Max. memory usage
mwa_pb 500 98.8 ms 134.6 MiB
100000 13.4 s 5.29 GiB
1000000 139.8 s 51.6 GiB
mwa-reduce (C++) 500 115.2 ms 48.9 MiB
10000 2.417 s 6.02 GiB
mwa_hyperbeam 500 30.8 ms 9.82 MiB
100000 2.30 s 17.3 MiB
1000000 22.5 s 85.6 MiB
mwa_hyperbeam (parallel) 1000000 1.73 s 86.1 MiB
mwa_hyperbeam (via python) 500 28.5 ms 35.0 MiB
100000 4.25 s 51.5 MiB
1000000 44.0 s 203.8 MiB
mwa_hyperbeam (via python, parallel) 1000000 3.40 s 203.2 MiB

Not sure what's up with the C++ code. Maybe I'm calling CalcJonesArray wrong, but it uses a huge amount of memory. In any case, hyperbeam seems to be roughly 10x faster.

Troubleshooting

Run your code with hyperbeam again, but this time with the debug build. This should be as simple as running:

cargo build

and then using the results in ./target/debug.

If that doesn't help reveal the problem, report the version of the software used, your usage and the program output in a new GitHub issue.

hyperbeam?

AERODACTYL used HYPER BEAM!

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

mwa_hyperbeam-0.3.3-cp39-cp39-manylinux2010_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

mwa_hyperbeam-0.3.3-cp39-cp39-macosx_10_7_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9 macOS 10.7+ x86-64

mwa_hyperbeam-0.3.3-cp38-cp38-manylinux2010_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

mwa_hyperbeam-0.3.3-cp38-cp38-macosx_10_7_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8 macOS 10.7+ x86-64

mwa_hyperbeam-0.3.3-cp37-cp37m-manylinux2010_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

mwa_hyperbeam-0.3.3-cp37-cp37m-macosx_10_7_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7m macOS 10.7+ x86-64

mwa_hyperbeam-0.3.3-cp36-cp36m-manylinux2010_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

mwa_hyperbeam-0.3.3-cp36-cp36m-macosx_10_7_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

File details

Details for the file mwa_hyperbeam-0.3.3-cp39-cp39-manylinux2010_x86_64.whl.

File metadata

  • Download URL: mwa_hyperbeam-0.3.3-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for mwa_hyperbeam-0.3.3-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 69465202d5c8a54626cd4059f7dc75b94cede86473a4acd421a38a1fc2f63783
MD5 7b76038eb60cdcad442b8fa9c1b71d6a
BLAKE2b-256 01c099f05aae386686afcbfb38b961cbed674f0b739309627d1a420e93c0c082

See more details on using hashes here.

File details

Details for the file mwa_hyperbeam-0.3.3-cp39-cp39-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: mwa_hyperbeam-0.3.3-cp39-cp39-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.9, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for mwa_hyperbeam-0.3.3-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 ff3afcbb6e628ef422724ea6b825b8dc997004c07025825a1c00d23d46b9ef7d
MD5 507a5f0d96fddfe998b0455c151c3f20
BLAKE2b-256 632092c5d24dfd7a5f9dabd0c1efab117847cf7758eb70b8efe01911dc484746

See more details on using hashes here.

File details

Details for the file mwa_hyperbeam-0.3.3-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: mwa_hyperbeam-0.3.3-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for mwa_hyperbeam-0.3.3-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e3fd5717e43f271eef967ee4535b2a61ffd79c9c0e4d8fdf04ad2ef3dbb3a44c
MD5 d9f363d568f350e7cdab38a6dec38c20
BLAKE2b-256 f1d5fe66e560875db35664a9a84f502aaf6d9b6f7d4db9909e7a0888f399f61c

See more details on using hashes here.

File details

Details for the file mwa_hyperbeam-0.3.3-cp38-cp38-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: mwa_hyperbeam-0.3.3-cp38-cp38-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.8, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for mwa_hyperbeam-0.3.3-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 b9049d267fbcdf284ada95bb36f6a7dbedd5b7fad78f573bd96f80d772cfcaed
MD5 1ecdcfbd97fd73cc6e8b78d98bc3d4c5
BLAKE2b-256 59091c96f1f2adcf616c658c46f208be795eb4554c9c8d3893c3634709c30caa

See more details on using hashes here.

File details

Details for the file mwa_hyperbeam-0.3.3-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: mwa_hyperbeam-0.3.3-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for mwa_hyperbeam-0.3.3-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6ed89556e3480d0c4f48fcf4d7e4fd943ea4bc92da4b06aa095f9c7bd751367d
MD5 df06c5d0b97143d640b25039e56eb80a
BLAKE2b-256 18d50219bcc712611671ec34a0fb56b2279c70b193d81e317d432bc48d2814d7

See more details on using hashes here.

File details

Details for the file mwa_hyperbeam-0.3.3-cp37-cp37m-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: mwa_hyperbeam-0.3.3-cp37-cp37m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.7m, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for mwa_hyperbeam-0.3.3-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 d45c5f513ff80c1389914ec52d1f4ff001d6ac06a1fd901e7a169cb102f9ca81
MD5 a199a07d20bef75bd570fc9062be8cea
BLAKE2b-256 1d49a9624a140d87a537d069ab3f033da8820235292f8b26df9d77128d96b1e6

See more details on using hashes here.

File details

Details for the file mwa_hyperbeam-0.3.3-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: mwa_hyperbeam-0.3.3-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for mwa_hyperbeam-0.3.3-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 3155d4f9e782d7da1fe9604f135f7bc0900cb7122c1c0e78c9668d1373efa4a4
MD5 2e27469161afaa2bf20540e6b88caaf0
BLAKE2b-256 dc4f8d1be7c2ab679008d54bf43bf86f89b91c561d0be0e03b5175c8fb3e6a82

See more details on using hashes here.

File details

Details for the file mwa_hyperbeam-0.3.3-cp36-cp36m-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: mwa_hyperbeam-0.3.3-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.6m, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for mwa_hyperbeam-0.3.3-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 ae8c4d8fc99a4430f6a8664d5a3f2a88e629022dd8d299789e50e7ce4d00ab77
MD5 02c06464793775eb9383663131c355b9
BLAKE2b-256 d5460e37d1c0ca9cc083502d0f7b3052f985574f77b3bcf3003526fd7e165029

See more details on using hashes here.

Supported by

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