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

Uploaded Source

Built Distributions

bilby.cython-0.4.2-cp312-cp312-win_amd64.whl (497.5 kB view details)

Uploaded CPython 3.12 Windows x86-64

bilby.cython-0.4.2-cp311-cp311-win_amd64.whl (391.2 kB view details)

Uploaded CPython 3.11 Windows x86-64

bilby.cython-0.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

bilby.cython-0.4.2-cp311-cp311-macosx_10_15_x86_64.whl (390.7 kB view details)

Uploaded CPython 3.11 macOS 10.15+ x86-64

bilby.cython-0.4.2-cp310-cp310-win_amd64.whl (392.6 kB view details)

Uploaded CPython 3.10 Windows x86-64

bilby.cython-0.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

bilby.cython-0.4.2-cp310-cp310-macosx_10_15_x86_64.whl (391.1 kB view details)

Uploaded CPython 3.10 macOS 10.15+ x86-64

bilby.cython-0.4.2-cp39-cp39-win_amd64.whl (394.4 kB view details)

Uploaded CPython 3.9 Windows x86-64

bilby.cython-0.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

bilby.cython-0.4.2-cp39-cp39-macosx_10_15_x86_64.whl (393.1 kB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

bilby.cython-0.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

bilby.cython-0.4.2-cp38-cp38-macosx_10_15_x86_64.whl (388.9 kB view details)

Uploaded CPython 3.8 macOS 10.15+ x86-64

File details

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

File metadata

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

File hashes

Hashes for bilby.cython-0.4.2.tar.gz
Algorithm Hash digest
SHA256 530b891c7e17c9ea84879a2e7fa1d0c1f47946c9493cc840be9cd5cfd0267cb4
MD5 a6709266d68018f12a0d1fe11d5731af
BLAKE2b-256 8bb055dd76d9ab875b63c7361fd6bfb851d38c6ee09055a5064bc3a1d2ca6ad6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b824e1751c8b944134406109d59f439dd59343e4dd8d21c8e9a2ebba81748a4f
MD5 6ba6ee46f30fefade54b0efd072fdbad
BLAKE2b-256 efa80c894468f44b9350115459d4ae392bd7cf0d431220c6f0a16cb79216e8b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d8d00c9a4e47abe05ed83e75b29017d35e0ee8df564838161e44d78af5ad2122
MD5 846d9785494a29f66bafbcea756a91a9
BLAKE2b-256 241ff3a0d155132d0a6c03c9c2bdc5c2d021815ee8a44075e40aca8ce028205a

See more details on using hashes here.

File details

Details for the file bilby.cython-0.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 78555e9d1a7cb6072912bbf71922d8d316f66a8ad5c3b754c490157b62f60d3b
MD5 957c93894f3cc2ca594bc206369fc692
BLAKE2b-256 c06d572e0e0fd9b1044925ad8753c43b01550a79b96e6945c1116857a501c08c

See more details on using hashes here.

File details

Details for the file bilby.cython-0.4.2-cp311-cp311-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.4.2-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 61d839dc6ce4716cd2a8207d33fb7dd89cba7520d02555a23b74b046e1536fab
MD5 75ef807369109084b0a8ac26030cd05f
BLAKE2b-256 b08d7ad164228b8e8e075d3bb6ac81a160489bf63d5b01771990b67789c90954

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c4a3c8d34349c9bb011137eb5e48904d4b9571d24330659007606b9e1efe37a3
MD5 f549732af4b43442ed65d6ab264a6c70
BLAKE2b-256 68e5fa20e712bda4279badf455492bcf0b06a97000e2ed0ca7d5cfe7ce2f08a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 430a07b574d832e24fe521c7b2cc68f57d29082c109e7d4dfc0c341f67cbbdd5
MD5 242fbd33593fac9da83241e568e46da9
BLAKE2b-256 5dcc2a8923a9225fc2601c00037390699d4f64bbd85bb83f0957f6afab28efa3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.2-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 11c5030a91c9b204920a41411ef1d3c3b6488ac8fcb2a028b328f421855a11b8
MD5 34b17604fd1a9cdb4507aadb57aad84b
BLAKE2b-256 3de90404d563f727c20282a68e277ffd25fd09257962db27351b4f957f744260

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 dd872f9c6752f18e667753258b62ef4de6d1d5c37338a26850c6f95c5ffb2f85
MD5 282829e06ad67a8ecf63f0e6a9e30897
BLAKE2b-256 b4f50243a7b6ba1e607c8bac1f2b61745cdac2373869d825bcba9f2012928847

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a141610fc53ef650196c5d44b6e6257ca8a72e892f74c7a1f26e15d4c5beb0ae
MD5 3d67e1ea626806038dd86911b30b5e68
BLAKE2b-256 b17548b254a9b381384bbbc9277ec22eaf725173b309a6f7bd889d3e4fc25995

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.2-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 f512a7f23771d67b136c35271ef2f1027292368b051e91357f85f39425b4b9ba
MD5 a95d3e2fc9cc5c62587072dd87bf343e
BLAKE2b-256 4b5fb1336de320a1bd0ec4a58c14a5c1d2c2a6f0348e94d08a8467ba286bb775

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dc3be34dd988db8484f77aba19af1c88b393d88f49fcfb3c034bfc32f834b6d0
MD5 be0757ec0bb68a3b9c41b9e84ec1fa3d
BLAKE2b-256 40e5c8d516c9c04166fab25155db99e4f4964eecad21d42e95a26ab9d7bfa314

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.4.2-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 df11fd6bf289083f2c8530c783ccdebbc5d59ff4925f4c2de7c6a82989fd598e
MD5 31345547e869f11c89cac83fba0731bc
BLAKE2b-256 3218b5abbd77efdf08fdc1a3471fc3ada975a06c43bded97445df998b80775f4

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