Optimized functionality for Bilby
Project description
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 interferometersget_polarization_tensor
: calculation of polarization tensorsthree_by_three_matrix_contraction
: rojecting polarization tensors against detector response tensorscalculate_arm
: calculate an interferometer arm vectorzenith_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 Distribution
Built Distributions
File details
Details for the file bilby_cython-0.5.3.tar.gz
.
File metadata
- Download URL: bilby_cython-0.5.3.tar.gz
- Upload date:
- Size: 238.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44400b2abc6fa592b13d69f33460cb156d6edb48a783f5539ee0a21e1d0a3508 |
|
MD5 | 4e6421d21f92dfaec84aa5365ce45628 |
|
BLAKE2b-256 | 4c936877dd78b375f3e83c8209aecc18f18d1cd88269a8a5c2d3c7dd9ad4fc53 |
File details
Details for the file bilby.cython-0.5.3-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: bilby.cython-0.5.3-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 357.8 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2758256339d7c3703014b265d3a77e0299d5c6264f962bc311c989ac453cbd60 |
|
MD5 | 7a09b8535aed5c756f3a6c40f69d6959 |
|
BLAKE2b-256 | 11de02429d598ec5ed4c70113a2c3e8b76a5b113885f85eacdcdaf19cbb6d23d |
File details
Details for the file bilby.cython-0.5.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: bilby.cython-0.5.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44e5e381c2861e26a4e1fd5c591ea0c3c9a0e2f0d8c78f28f8704abf2945cd8d |
|
MD5 | 23ecd7c1c2ffbc8bea4b2914e47599fc |
|
BLAKE2b-256 | 1326f0b46d56d278665b484ec421dc571fb28bdd81635137d00e0edc2c8fddc9 |
File details
Details for the file bilby.cython-0.5.3-cp312-cp312-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: bilby.cython-0.5.3-cp312-cp312-macosx_12_0_x86_64.whl
- Upload date:
- Size: 351.9 kB
- Tags: CPython 3.12, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 264ccd8ca1adabc794931ed6deb5082ad0ed4b52694be8158cb421a80a752bca |
|
MD5 | b3cd46c7e1d313bca6dc0b81a54f94ba |
|
BLAKE2b-256 | 8bc5ad5ca082b2610defc488679690df8137300c6bb396b24f783e3d74873fa4 |
File details
Details for the file bilby.cython-0.5.3-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: bilby.cython-0.5.3-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 359.6 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9d0c1c490619981234568dae7f11fab1544783a748492d39d0d690a70d12f6a |
|
MD5 | e82179203d991c0473f18a261e3a1de4 |
|
BLAKE2b-256 | 38f3ef24cb7c8a7335f869829e5c0909515544924dcd5df6d4f58b377e1daeb2 |
File details
Details for the file bilby.cython-0.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: bilby.cython-0.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 983.9 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4642cb38f2cea8129261e25fe4237e2c06982753ef3ce2611072e541b7ecf6fb |
|
MD5 | 714cf5614bc2cee6efb0e071d8630439 |
|
BLAKE2b-256 | e46a78511b5e08ed89f492297746e3f488159d90e2b89680777a3a37565916eb |
File details
Details for the file bilby.cython-0.5.3-cp311-cp311-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: bilby.cython-0.5.3-cp311-cp311-macosx_12_0_x86_64.whl
- Upload date:
- Size: 352.1 kB
- Tags: CPython 3.11, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 813f2b53a55b0fbbc2a86ef9c025e3020eb086473663c110161e3b120728176d |
|
MD5 | 410f7782875ac99fcadc46e6b36ceef5 |
|
BLAKE2b-256 | dec13799f4bd0e5a13375b621f21d12fd21e596d744b363e683f815afe593f1f |
File details
Details for the file bilby.cython-0.5.3-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: bilby.cython-0.5.3-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 359.7 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad135a68e800b60c03cca967347289b3e7481d2c1376f8188510e5191fd812f0 |
|
MD5 | 3b027b97b90ac69149b6e6f27018b9d4 |
|
BLAKE2b-256 | 13e98c63ca64b19a0536616ee1aa77c46492c8da81a3589963b85fd929962dfa |
File details
Details for the file bilby.cython-0.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: bilby.cython-0.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 940.1 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f72f2865d4a01cb241c400efe4764e85194fe43f362061778f291498f0538df |
|
MD5 | 0b40753d20aa94974a82786ceb2fa1ba |
|
BLAKE2b-256 | 0066aaf5ebb0467f0a3cd760aaefd5789a474785675717f7a9c18918d65556ec |
File details
Details for the file bilby.cython-0.5.3-cp310-cp310-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: bilby.cython-0.5.3-cp310-cp310-macosx_12_0_x86_64.whl
- Upload date:
- Size: 351.9 kB
- Tags: CPython 3.10, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27a34164fbaf140f89e0e0e395c6ea3ae5e57209c07c7c717c4385fecb9dd398 |
|
MD5 | 35e182e2a5138d544d77368a75dfc6d6 |
|
BLAKE2b-256 | 8ee724a4d73fcee5e828b5819466ee8d5c7310119c3b08122a033ba6fe99d80e |
File details
Details for the file bilby.cython-0.5.3-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: bilby.cython-0.5.3-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 360.2 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 387b8ec60009fa37999383c516e08bd39899c4f64f63415201b2b3918f38086c |
|
MD5 | b2518ba6afc5e003eb646dd1418132d0 |
|
BLAKE2b-256 | d879ed3a5880bb840a37b2ba0212a637c3d1b5e93e1d85d9a3abb9824440e681 |
File details
Details for the file bilby.cython-0.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: bilby.cython-0.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 942.2 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54f48f2fc55c01a278c2ffcfcc0c9169792976d87425dbc891580751e5f00932 |
|
MD5 | d449c5d3a17d3e821dcde68212840cab |
|
BLAKE2b-256 | 4f23663c80a2b36627ac502838a24d0391bd0fd89ec45d1c8e13a6ae977762d9 |
File details
Details for the file bilby.cython-0.5.3-cp39-cp39-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: bilby.cython-0.5.3-cp39-cp39-macosx_12_0_x86_64.whl
- Upload date:
- Size: 352.6 kB
- Tags: CPython 3.9, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe54b36fdbad53ce9bb0214c96f2f146ec5d963f2eb00aadb1e2df21215772c8 |
|
MD5 | 6b558265110ae88a7be502d3c47cc644 |
|
BLAKE2b-256 | b26b04b2603b7dcb568b58b405a22a4968f34d3160ba1c88999ce6d7a978d4d4 |