Optimized functionality for Bilby
Project description
[![pipeline status](https://git.ligo.org/colm.talbot/bilby-cython/badges/main/pipeline.svg)](https://git.ligo.org/colm.talbot/bilby-cython/-/commits/main) [![coverage report](https://git.ligo.org/colm.talbot/bilby-cython/badges/main/coverage.svg)](https://git.ligo.org/colm.talbot/bilby-cython/-/commits/main) [![Latest Release](https://git.ligo.org/colm.talbot/bilby-cython/-/badges/release.svg)](https://git.ligo.org/colm.talbot/bilby-cython/-/releases)
# 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](https://git.ligo.org/lscsoft/bilby/-/issues/576).
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.
## Usage
In order to use the functions implemented here you can import them from the bilby.cython package `python 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for bilby.cython-0.1.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27fec5fb80a48f3416fcc4c308447a6f88ff53187e54f98023d665502878428c |
|
MD5 | 7d7b24f8d2d4966ca20229c4b630152b |
|
BLAKE2b-256 | 7d01960e2431866029eb3f85ca75af41207961d2fb0a161ea5ade7850f944349 |
Hashes for bilby.cython-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fbe73c4bfd8c99c0715e534bc0ce3803f4a41d3f0cc9254fa8d5ce57ef1dcdd |
|
MD5 | f84c64a1828cb6fc161e940ee9036740 |
|
BLAKE2b-256 | 22453d135384dbbfaf58ed620336b63e93fb236802af9e8c684e04776fe2c511 |
Hashes for bilby.cython-0.1.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc2daff123781f7be78b684fdd211fb9288011e911ed720957dda2b97a6952c8 |
|
MD5 | 9e15713366b20d940f425b3651d933e8 |
|
BLAKE2b-256 | c82fde49edf12602e23d76ea43a3145a4b801edc3d75ea67ee33294b71f2a92f |
Hashes for bilby.cython-0.1.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd382cc0260d2f2a4244bc755f7009b6e88023f6f3f811986c3c6aeb88b1de51 |
|
MD5 | 6309682f201a5fc45c5a48499e22aa2f |
|
BLAKE2b-256 | a113e9609b1c99486eafba15714f02f9a66c4acd48ed0298ac425e791a473b4a |
Hashes for bilby.cython-0.1.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf5855355285d7d151d0306cb25e837fac9764fd2cdbdd8cee2ff754f2959847 |
|
MD5 | e9d86292fece45278a17c08256bf6c5a |
|
BLAKE2b-256 | 745030092bda93956ca02eb1b8633448e0de54db40abd452314809abcc7a3c72 |