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.5.2.tar.gz (329.7 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.5.2-cp314-cp314-win_amd64.whl (509.8 kB view details)

Uploaded CPython 3.14Windows x86-64

bilby_cython-0.5.2-cp313-cp313-win_amd64.whl (504.3 kB view details)

Uploaded CPython 3.13Windows x86-64

bilby_cython-0.5.2-cp312-cp312-win_amd64.whl (504.3 kB view details)

Uploaded CPython 3.12Windows x86-64

bilby_cython-0.5.2-cp311-cp311-win_amd64.whl (506.9 kB view details)

Uploaded CPython 3.11Windows x86-64

bilby.cython-0.5.2-cp312-cp312-win_amd64.whl (502.1 kB view details)

Uploaded CPython 3.12Windows x86-64

bilby.cython-0.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bilby.cython-0.5.2-cp312-cp312-macosx_12_0_x86_64.whl (495.2 kB view details)

Uploaded CPython 3.12macOS 12.0+ x86-64

bilby.cython-0.5.2-cp311-cp311-win_amd64.whl (503.7 kB view details)

Uploaded CPython 3.11Windows x86-64

bilby.cython-0.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

bilby.cython-0.5.2-cp311-cp311-macosx_12_0_x86_64.whl (493.9 kB view details)

Uploaded CPython 3.11macOS 12.0+ x86-64

bilby.cython-0.5.2-cp310-cp310-win_amd64.whl (503.6 kB view details)

Uploaded CPython 3.10Windows x86-64

bilby.cython-0.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bilby.cython-0.5.2-cp310-cp310-macosx_12_0_x86_64.whl (493.9 kB view details)

Uploaded CPython 3.10macOS 12.0+ x86-64

bilby.cython-0.5.2-cp39-cp39-win_amd64.whl (504.8 kB view details)

Uploaded CPython 3.9Windows x86-64

bilby.cython-0.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bilby.cython-0.5.2-cp39-cp39-macosx_12_0_x86_64.whl (495.1 kB view details)

Uploaded CPython 3.9macOS 12.0+ x86-64

File details

Details for the file bilby_cython-0.5.2.tar.gz.

File metadata

  • Download URL: bilby_cython-0.5.2.tar.gz
  • Upload date:
  • Size: 329.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for bilby_cython-0.5.2.tar.gz
Algorithm Hash digest
SHA256 6ed083ad093420f91cb76bdd5cf85fc3950597b16d451d38987571ed8f9112a7
MD5 33b371266afb2a46187f6a5ec41f58d7
BLAKE2b-256 1f1f18feb037aa40f905de8ad971c6226cd5e8174b3e5e18ef6ecdc4c91c20b0

See more details on using hashes here.

File details

Details for the file bilby_cython-0.5.2-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for bilby_cython-0.5.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 79eda6db879268f3106fe30f5be3c6a9e50f362319b85422c4ec769c23b6f9f7
MD5 1b5d1dac2e20503c8fe5a35d270c5ae9
BLAKE2b-256 88632fcea3625a9c04c499f43c566a9f6b0d021607bb9c6c0cbeeab38a7acf2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for bilby_cython-0.5.2-cp314-cp314-win_amd64.whl:

Publisher: build-wheels.yml on ColmTalbot/windows-wheel-builder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bilby_cython-0.5.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for bilby_cython-0.5.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c6446ac247681f846e322f35b4786fe78bdfd72145528bdef4410bec134f988c
MD5 217719aad2563a8a09e5818ce0da37bd
BLAKE2b-256 8b678bc2f1a104f53b5ef632d083e3c040d4d0a969586204aa2e11d9ab62d01d

See more details on using hashes here.

Provenance

The following attestation bundles were made for bilby_cython-0.5.2-cp313-cp313-win_amd64.whl:

Publisher: build-wheels.yml on ColmTalbot/windows-wheel-builder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bilby_cython-0.5.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for bilby_cython-0.5.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b279a652b83d96d39c1cd11305afa2e145465f63b29bf61aa2d62d36483025b1
MD5 47cbd93e722737c2b342a44973f579ae
BLAKE2b-256 5fabb64da26de5e926c3070cf633ba8c3657039b2a19437b78e517c6b38c61dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for bilby_cython-0.5.2-cp312-cp312-win_amd64.whl:

Publisher: build-wheels.yml on ColmTalbot/windows-wheel-builder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bilby_cython-0.5.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for bilby_cython-0.5.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5527a562faf3a3766f73747799214e9bfb952bdb9f899d95230280b4e6ca17af
MD5 154cd9e56d32e88f22211a66a9a75237
BLAKE2b-256 9451304f4b2f71be064eddd9c7dee79332e55c18d2ad104e25f023d968806e09

See more details on using hashes here.

Provenance

The following attestation bundles were made for bilby_cython-0.5.2-cp311-cp311-win_amd64.whl:

Publisher: build-wheels.yml on ColmTalbot/windows-wheel-builder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.5.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6665c24b75c1d7308e68c8091fe86ca1bb1c933df159cc01915e465a80f9b508
MD5 fb31d53ca987892c4604e6da6711300c
BLAKE2b-256 ceac55ac2bbff65a874eab8586dea77accbe0af77185ff445afe3841f9aae558

See more details on using hashes here.

File details

Details for the file bilby.cython-0.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a947a582f1f996a51a38ed0fae6dbd73dbc4c3034859e3cc09159ae5c07b8907
MD5 c08b3a39103ccd18f3704bc77f8fdf83
BLAKE2b-256 c68672743efe677d370e4a01133b17fd8a551e23f6e05f4411dc2e01806a09a2

See more details on using hashes here.

File details

Details for the file bilby.cython-0.5.2-cp312-cp312-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.5.2-cp312-cp312-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 75b395de8863b3ee3ae78cbeefd3f068c4e1d3b117d5031fcd4e38fc68b7bd5d
MD5 b48c081249f910efe5a49cf3c7af1cef
BLAKE2b-256 b86330efcb5eeb78a9b7087a42876c09e335db241dbd932a5e7b6f2450731270

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.5.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8a717417126667e073dbd727d11a1e038b224676ddc36e93f916bcd9a765107e
MD5 f4a8a73b5b4a126f8bf6243da779b9fb
BLAKE2b-256 8ec811768d91b40eaf8de77520d07475cc138ade16e11119f60daf03fa075001

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ae131475feb54a73601e0170115981415fcde47380ec72906e5ce2b65869bd5b
MD5 37fa1f2170032bf493705f1fa7349882
BLAKE2b-256 7b97e8b2336d8ae091acdf0935f8542fab2785967d7db0b110e6f059965d6dae

See more details on using hashes here.

File details

Details for the file bilby.cython-0.5.2-cp311-cp311-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.5.2-cp311-cp311-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 d4539ec447ef0d9d964fe68ae2bde0b04447e9b17226614723cba7a26fc0ba20
MD5 091b668c48a6816ab0593c5f89ed8b2e
BLAKE2b-256 b7488bd4084b3e525406335d7d69d40d73a67c7571f24dc853a6b4f26e3fc6ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.5.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f76550f6c08debae987ff9888d52d868c42e19822caac1daa6f019e2a217efd5
MD5 c5b5986906180c3031f009f43afda460
BLAKE2b-256 cfcd4d57743f35b14a05c4c29b9834342642328468de02ba3a657f477b6bd729

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8a6e9a7cd5384eaa65052b988a249c5d800e14323a89fdc09f1e054ce299f0b5
MD5 b018b74355352bb6c4c091bd119fde9e
BLAKE2b-256 8d4973ff13f4c5c5e48661b12735e0d0face012a774d7c8d61138f96be833452

See more details on using hashes here.

File details

Details for the file bilby.cython-0.5.2-cp310-cp310-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.5.2-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 79dbd06a14909c32f60eb4cbfbcd15ad894060686116fafebcc39bf77b0bf549
MD5 66300c8cd6503d8529cead52dd9b93f8
BLAKE2b-256 daf585a86b1b54e5db04ff05dbfee496a92d1333fd53afd6449050b2e29e0ed6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bilby.cython-0.5.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 504.8 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

Hashes for bilby.cython-0.5.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4586fd994530c449d5d3d4b20fa7ce51764fd4c6086ed06805cb1aea6859aede
MD5 576b9a6cef60db91cfc00dbf1b83f72c
BLAKE2b-256 6c251fee79bd7768694d2e9789acf99bda702052b4141b96e7995dac5b56f252

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bilby.cython-0.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 077e3f9465f350b4fca83e56282103983f831c07e2652fe327efbb4c615f1a74
MD5 7770a659b9a9237055e034a0c6d25b7b
BLAKE2b-256 31bed02334f9d0bcd315114f7e8cdc2093d173cc5be9cbf17571b066b7042095

See more details on using hashes here.

File details

Details for the file bilby.cython-0.5.2-cp39-cp39-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for bilby.cython-0.5.2-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 08ad6a980a0a50652218e3de021c4c254640904ed2eb2500da489e0adf20729e
MD5 0156d4fb2762ef033ce87a2d8790d822
BLAKE2b-256 e193c79f1ec8cdfed53e78607af22b98244b9cce2f86640e5a20256abf94d9f0

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