Skip to main content

Optimized functionality for Bilby

Project description

pipeline status coverage report Latest Release Conda Forge License

bilby-cython

Optimized cython implementations of specific Bilby operations.

For very fast waveform models, computing the antenna response and time delays uses a significant amount of run time, see, e.g., this issue.

This repo provides optimized cython implementations of the existing Python functions. Most of the speed up comes from leveraging the fact that these are operations of 3-element vectors.

Installation

bilby.cython is available through conda-forge and pypi and can be installed with either of the following

$ conda install -c conda-forge bilby.cython
$ python -m pip install bilby.cython

There are prebuilt versions for many architectures/OSs, however, non-standard systems will require a version of Cython to build from the source with

Usage

In order to use the functions implemented here you can import them from the bilby.cython package

from bilby_cython import geometry
geometry.get_polarization_tensor(ra=0.0, dec=0.0, time=0.0, psi=0.0, mode="plus")

Ported functions

  • time_delay_geocentric: calculating time delays between two interferometers
  • get_polarization_tensor: calculation of polarization tensors
  • three_by_three_matrix_contraction: rojecting polarization tensors against detector response tensors
  • calculate_arm: calculate an interferometer arm vector
  • zenith_azimuth_to_theta_phi: rotating the reference from from detector-based coordinates to celestial

New functions

  • time_delay_from_geocenter: calculate the time delay between an interferometer and the geocenter. This removes an array allocation that was slow for some reason.
  • get_polarization_tensor_multiple_modes: compute multiple polarization tensors in a single function call. This reduces the overheads per call.

Testing

test/test_geometry.py verifies that the new functions agree with the old versions at sufficient precision. The old code is deliberately copied from the current Bilby to enable testing after Bilby switches to use this code.

Timing

This is the output of test/timing.py when run on a 2020 M1 MacBook Pro. The new functions are 5-40x faster than the old versions. These times are comparable with the lal` equivalents with greater flexibility.

Timing time delay calculation over 10000 trials.
Cython time: 2.366e-06
Numpy time: 1.026e-05
Timing polarization tensor calculation over 1000 trials.
Cython time: 2.470e-06
Numpy time: 4.247e-05
Timing two mode polarization tensor calculation over 1000 trials.
Cython time: 1.790e-06
Numpy time: 2.907e-05
Timing six mode polarization tensor calculation over 1000 trials.
Cython time: 1.250e-06
Numpy time: 4.111e-05
Timing antenna response calculation over 1000 trials.
Cython time: 4.269e-06
Numpy time: 4.709e-05
Timing frame conversion calculation over 1000 trials.
Cython time: 2.516e-06
Numpy time: 2.243e-05

Profiling the standard Bilby fast_tutorial.py example for a very fast waveform model reduces the amount of time spent computing the antenna response from 16% to 3% and computing time delays from 3% to 1%.

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

bilby.cython-0.2.0.tar.gz (135.3 kB view details)

Uploaded Source

Built Distributions

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

bilby.cython-0.2.0-cp312-cp312-win_amd64.whl (95.9 kB view details)

Uploaded CPython 3.12Windows x86-64

bilby.cython-0.2.0-cp311-cp311-win_amd64.whl (80.9 kB view details)

Uploaded CPython 3.11Windows x86-64

bilby.cython-0.2.0-cp311-cp311-macosx_10_9_x86_64.whl (147.5 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

bilby.cython-0.2.0-cp310-cp310-win_amd64.whl (81.5 kB view details)

Uploaded CPython 3.10Windows x86-64

bilby.cython-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (448.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bilby.cython-0.2.0-cp310-cp310-macosx_10_15_x86_64.whl (78.7 kB view details)

Uploaded CPython 3.10macOS 10.15+ x86-64

bilby.cython-0.2.0-cp39-cp39-win_amd64.whl (82.2 kB view details)

Uploaded CPython 3.9Windows x86-64

bilby.cython-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (451.7 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bilby.cython-0.2.0-cp39-cp39-macosx_10_15_x86_64.whl (79.6 kB view details)

Uploaded CPython 3.9macOS 10.15+ x86-64

bilby.cython-0.2.0-cp38-cp38-win_amd64.whl (82.6 kB view details)

Uploaded CPython 3.8Windows x86-64

bilby.cython-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (453.3 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

bilby.cython-0.2.0-cp38-cp38-macosx_10_15_x86_64.whl (77.8 kB view details)

Uploaded CPython 3.8macOS 10.15+ x86-64

File details

Details for the file bilby.cython-0.2.0.tar.gz.

File metadata

  • Download URL: bilby.cython-0.2.0.tar.gz
  • Upload date:
  • Size: 135.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for bilby.cython-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a74c364d14b41cbb9e317c38458568089aef22baa095dc50b58195b7757a9a88
MD5 a6cd211cda0a7d73e79f0de877f4b6c0
BLAKE2b-256 3dc455e0e774a6354d550cce457c8fd25ee9d7beddb871678c460a6da8639d8d

See more details on using hashes here.

File details

Details for the file bilby.cython-0.2.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 789c7aef2e7c96318c1629dd59b9b6b2e385ccd42939ec357e5a2d01856c0ea4
MD5 3da9cb8b1bd9aa930c5753f08026394c
BLAKE2b-256 3099e128728bf0e6b5f6b660ab71c4035a188e137743933de1a3ad21a4b26294

See more details on using hashes here.

File details

Details for the file bilby.cython-0.2.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.2.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 cd666a48e7d1ebbfa09b594cac837a15d6e1e47b179060936f036532a2f8bbe5
MD5 731225a6d818696a0a1111db1e227169
BLAKE2b-256 9fc7376d4864e8a2cc7ce365273dd65f1bfb53782ea119261359fab451a93ca5

See more details on using hashes here.

File details

Details for the file bilby.cython-0.2.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.2.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f6e206ba2c9fa3436a28eeb72b21121ac53560325eca4fda102115a5b9982cb5
MD5 aea733f10d8ec9788e248f1406e515e9
BLAKE2b-256 4fe5054c3379e7c0f22c998aec125586b238043da3a0ccef32d0e1541a01c39e

See more details on using hashes here.

File details

Details for the file bilby.cython-0.2.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.2.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 54fa62257c402f56f09a54f6e8b0323ad3e7723991e3ffc7cf7c59e39dc4baa4
MD5 fd6d27cad858a64f5f11e2ed59488e79
BLAKE2b-256 3922e5a3d585c2f2178989383d0f39818a1e3bfa101a8565f7e9586dca5b106e

See more details on using hashes here.

File details

Details for the file bilby.cython-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 42ca2c94f1dac1ef45bbab304714c3b09dd2cc4737a68c7ae0f14407fb0187b5
MD5 e92728f32bc9a7c03c316857d08e6b1b
BLAKE2b-256 0375563866e452b541a18f3ff60f68f7a1c963b6a73e4b1a3970bed9b099cc03

See more details on using hashes here.

File details

Details for the file bilby.cython-0.2.0-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.2.0-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 6975155510be40dbfa6698be93a72f582094e65d07df45cee9a87d178d594237
MD5 599fc3a5c986cf1c4a9bfde1fd26c3ce
BLAKE2b-256 27ab9c120f963081a96db59c442e3e9bae9b63df5c4eb70e9675a93947360228

See more details on using hashes here.

File details

Details for the file bilby.cython-0.2.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: bilby.cython-0.2.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 82.2 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for bilby.cython-0.2.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 49fab229d55a0457e11b24cb57373ae8319abae682c32b40b7a1013915afbe2e
MD5 92f3d64d2eb09c94df302bdadeb5f04c
BLAKE2b-256 ffb9227e15cef82e9a4d126a2cbcdaae8e67fd89abe4c482d6078799206b9c11

See more details on using hashes here.

File details

Details for the file bilby.cython-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a196439d96c9ae62f9d73f9d32fdb7b591fc8454e12af6b14741d2596a99970b
MD5 bfd095936d455a33f4c37fc1a549c634
BLAKE2b-256 9da35557f649b96e2be06e19e0e426a137f1a69263f1a4d69aabbc68de5b1d18

See more details on using hashes here.

File details

Details for the file bilby.cython-0.2.0-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.2.0-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 f4e03016f0986de6f9ea7dc0d3972dbd60c8a80a540d03bc784f2c306266cbe4
MD5 607e6852fafbc05389730dd5e142e278
BLAKE2b-256 53093a424203eb5e3658e06f41a78f0ce16903685a46afa811c89429058d3472

See more details on using hashes here.

File details

Details for the file bilby.cython-0.2.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: bilby.cython-0.2.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 82.6 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for bilby.cython-0.2.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 cd1ee8c283706d3c0929e4dbd414cac764cd4f74e81a52286502fde94cae8108
MD5 42afa8facbd8433a807fca928990e5ff
BLAKE2b-256 e6eaafe81d97ceec53247cf602f54f3f003f25e7ab93b97aa259f6ecbffdff58

See more details on using hashes here.

File details

Details for the file bilby.cython-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5540288e2e1b5a868b97b53d62e983cb5340a912a0e70c278f3ef439703d726e
MD5 2e22bfba856888adf839481dd5fd1665
BLAKE2b-256 54acc645947ac0c2f3fc9349cb86dc870fee99827cc3dbb710a57f3252dd37af

See more details on using hashes here.

File details

Details for the file bilby.cython-0.2.0-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.2.0-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 5a14a8c96a910425890504cfceb4ede960cc424db73103922b3e342f85e92ec3
MD5 739135076c35b1f7055c1063bbe14cdf
BLAKE2b-256 772b0384187bc34ef6ac5e784656a9c82ab332f9a63fc7e13d02eae2a01ac1e2

See more details on using hashes here.

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