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.4.1.tar.gz (251.6 kB view details)

Uploaded Source

Built Distributions

bilby.cython-0.4.1-cp312-cp312-win_amd64.whl (176.3 kB view details)

Uploaded CPython 3.12 Windows x86-64

bilby.cython-0.4.1-cp311-cp311-win_amd64.whl (146.7 kB view details)

Uploaded CPython 3.11 Windows x86-64

bilby.cython-0.4.1-cp311-cp311-macosx_10_9_x86_64.whl (148.8 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

bilby.cython-0.4.1-cp310-cp310-win_amd64.whl (148.1 kB view details)

Uploaded CPython 3.10 Windows x86-64

bilby.cython-0.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (832.3 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

bilby.cython-0.4.1-cp310-cp310-macosx_10_15_x86_64.whl (146.4 kB view details)

Uploaded CPython 3.10 macOS 10.15+ x86-64

bilby.cython-0.4.1-cp39-cp39-win_amd64.whl (149.6 kB view details)

Uploaded CPython 3.9 Windows x86-64

bilby.cython-0.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (839.1 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

bilby.cython-0.4.1-cp39-cp39-macosx_10_15_x86_64.whl (148.1 kB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

bilby.cython-0.4.1-cp38-cp38-win_amd64.whl (150.2 kB view details)

Uploaded CPython 3.8 Windows x86-64

bilby.cython-0.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (840.9 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

bilby.cython-0.4.1-cp38-cp38-macosx_10_15_x86_64.whl (144.7 kB view details)

Uploaded CPython 3.8 macOS 10.15+ x86-64

File details

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

File metadata

  • Download URL: bilby.cython-0.4.1.tar.gz
  • Upload date:
  • Size: 251.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for bilby.cython-0.4.1.tar.gz
Algorithm Hash digest
SHA256 3c7c89f7ba88dfc71d53fd4cc79a2bbf94ee3314efbac6fe16b0882ea742345d
MD5 30c5570cb01f837f3e8a911d7a405186
BLAKE2b-256 d12085e7de5b777ad1a40e795a7d7c8505a56e4b8eb3b8d9fa73b515e2f402bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a5aa0ba9e9e3dc90ec783108450c8da58a4af4715ed3cb6cb213b39062872aa0
MD5 6da53308d929f7e289a97b371aba388e
BLAKE2b-256 1d571f62113ba004bdfc7d47f7b5634786758b6f39ac7bff9a1bcc51af0a7fe4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 077444ba3caec788bfcef952f594eb22bf4381c1557f7a478dfb243616ea2fba
MD5 b531b86c381c38d18937d5f8f6d94ea9
BLAKE2b-256 996ff99364f0de9f70f96cd762df9f3f5d90b994c1b660fe463fd6804266f546

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6a0b2b3b43ca3453d387a2072fda74660734cd5c2e88cc224df2225425d9bd70
MD5 e909ae8da3f90c64a4baa8514b9038d2
BLAKE2b-256 6b2a6a82c90191527443790a16c76866faa3780b527f778ea8982bcfec6abdc1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f5a9714ddec81eccab40420d85eccaa8d1fb3aae90bb8840f4c9c76b58938285
MD5 532520e369c98658d72f70d863aa048d
BLAKE2b-256 4bf8d71df26879ae7abdde21cab3d5dfa86d8dad079e91a8051ea067423cc822

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f5ac046c7f87d04caf7b7ac66c386c9544de53b24b84f9ec0467ee693710dcb2
MD5 24807a6b410932f5b13089759afe4635
BLAKE2b-256 ca998dc343f47508cb3d0ed89741e2820aca9780ba56982cd2c6cece8ea2499a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.1-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 253da26196dd5e3b29c39a16ce4a1f1aa6c580881de26297edb67940b25117be
MD5 6693e046c1fba9cced7cddbd253429cd
BLAKE2b-256 587fb03d453841977a875216b0794fa50dd0fff846d2bb2b97ec63990c9c8492

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 93a0b45fbd830a28e3c396576c463e1c4fd3925f28f12a246974e049da88fcf3
MD5 5a126faf0b20a33acbca92aa269e2323
BLAKE2b-256 ed1c13b61dadf9e05129167c3ddc4cca2bd3b09184a7d5d1f8a0ebc51d5e88b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3937b000527e6657f5810831c0d54780ef214481662a53e3c9216bb46b780526
MD5 7391b40acb003bc63615b996711e2708
BLAKE2b-256 ddede4ca7b091e256655abff3277909dbbea5ac6903910f8781de4ae3a964365

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 6c3c7b31f25bf8e6823a04209756217691a7a6afe7983f6549abed40118a19ec
MD5 ec943edd8422399be2b45c1bbcf6f7b7
BLAKE2b-256 67ff6790c2d5830779e07690aa1291b582db82696f59fccf8cf08f3ea21b5a82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 5629928a8305e359125228afe0c756f9f014c336d267524514579b90cfa8d3fd
MD5 a306408126f9c5505af6b70d3f650c00
BLAKE2b-256 cd48272221a091d3634014659f463da741fa8d206af751eaa1bb69e9c39297d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 751f226408f36ef9ea70ef877c7d71c54bf7c61c7e7959f4b419ffd46950dcd0
MD5 d7eb1cc43b159bc2c8b1d9cfd3ff95c7
BLAKE2b-256 7f2fea424eb97772883fb377b70496cf06f8bf0469b4d11db450d87b12b4ac84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.1-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 a7a677162ee0222591cb55d0668ee25cc76a5aec858a70077212fb0bbda89916
MD5 7480f7eca93a609a44197a2cf15481df
BLAKE2b-256 06914d194b1edc48c01a598d47ebf56bfe257b4582154059de613b863008f883

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