Skip to main content

LeR

DOI PyPI version DOCS

ler logo

ler is a statistics-based Python package for simulating compact-binary gravitational-wave (GW) populations and calculating detectable event rates. It supports both unlensed and strongly lensed events, with workflows for source populations, lens populations, image properties, detector selection effects, and rate estimation.

ler is intended for gravitational-wave population studies, lensing studies, and forecasting for current and future detector networks.

Installation

ler supports Python 3.10+; Python 3.11 is recommended in the documentation.

Recommended installation with uv:

uv add ler

You can also install with pip:

pip install ler

For development, clone the repository and install in editable mode:

git clone https://github.com/hemantaph/ler.git
cd ler
pip install -e ".[dev]"

Quick start

from ler import LeR

ler = LeR(npool=4) # npool sets the number of parallel processes for sampling and integration. It should be set according to your system's capabilities.

# Generate simulated populations and save parameters in json files
unlensed_param = ler.unlensed_cbc_statistics(size=100000)
lensed_param = ler.lensed_cbc_statistics(size=100000)

# Calculate detectable rates, saving detected parameters in json files
unlensed_rate, unlensed_param_detected = ler.unlensed_rate()
lensed_rate, lensed_param_detected = ler.lensed_rate()

# Compare lensed and unlensed rates
ratio = ler.rate_ratio()

What ler does

  • samples compact-binary source populations, including BBH, BNS, and NSBH systems
  • calculates detectable unlensed gravitational-wave event rates
  • samples strongly lensed source and lens populations
  • computes lensing image properties such as magnifications and time delays
  • calculates detectable strongly lensed event rates using image-level detection criteria
  • supports configurable source, lens, and detection models
  • uses gwsnr for efficient signal-to-noise ratio and detection-probability calculations
  • uses lenstronomy and in-house EPL+Shear routines for lensing calculations
  • uses Monte Carlo integration, multiprocessing, and numba-compiled routines for large simulations

Method overview

Unlensed rates are estimated by drawing source parameters from astrophysical priors, evaluating the probability of detection, and averaging over the population:

$$ \frac{\Delta N^{\mathrm{obs}}{\mathrm{U}}}{\Delta t} = \mathcal{N}{\mathrm{U}} \bigg\langle P(\mathrm{obs} \mid \vec{\theta}) \bigg\rangle_{\vec{\theta} \sim P(\vec{\theta})} $$

Strongly lensed rates extend the same idea by sampling source redshift, lens redshift, lens parameters, and source position under the strong-lensing condition:

$$ \frac{\Delta N^{\mathrm{obs}}{\mathrm{L}}}{\Delta t} = \mathcal{N}{\mathrm{L}} \bigg\langle P(\mathrm{obs}\mid \vec{\theta}{\mathrm{U}}, \vec{\theta}{\mathrm{L}}, \vec{\beta}, \mathrm{SL}) \bigg\rangle_{\substack{ \vec{\theta}{\mathrm{U}},\vec{\theta}{\mathrm{L}} \sim P(\vec{\theta}{\mathrm{U}},\vec{\theta}{\mathrm{L}} \mid z_L, z_s, \mathrm{SL}) \ \vec{\beta} \sim P(\vec{\beta} \mid z_s, \vec{\theta}_{\mathrm{L}}, \mathrm{SL}) }} $$

The lensed workflow uses the optical depth, the multi-image caustic cross-section, lens-equation solutions, and a requirement that at least two lensed images satisfy the chosen detection criterion.

Documentation

The documentation is available at:

https://ler.hemantaph.com/

Useful sections include:

Community guidelines

Guidelines for contributing, reporting issues, and seeking support are available in CONTRIBUTING.md.

Issues can be reported at:

https://github.com/hemantaph/ler/issues

Citation

If ler supports your research, please cite the project as described in the documentation and repository metadata.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ler-1.0.2.tar.gz (12.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ler-1.0.2-py3-none-any.whl (12.2 MB view details)

Uploaded Python 3

File details

Details for the file ler-1.0.2.tar.gz.

File metadata

  • Download URL: ler-1.0.2.tar.gz
  • Upload date:
  • Size: 12.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for ler-1.0.2.tar.gz
Algorithm Hash digest
SHA256 aa7be9c0d719d1306f70d530ef1db2404ffa0c954d44b6990c325e002e7ca505
MD5 6301a18635f983c880644dd952d6656f
BLAKE2b-256 1ad81ad2d5681e91e3de6fbcb505f714d4ff8c650b5cba4a5d99f1a7da5a873a

See more details on using hashes here.

File details

Details for the file ler-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: ler-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for ler-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c3728505c70eb5d168c3bccedc5e93bf531669471a72001394b0f393aa7fad51
MD5 9fcd27ebc06543befb866a0bd4d62cfc
BLAKE2b-256 cf9bf863cc2b17d5ab6f7e8d20d780b643d20910e1c357c04981ca9f312fa9bf

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 files

1.0.1

2 files

1.0.0

2 files

0.6.0

2 files

0.5.9

2 files

0.5.8

2 files

0.5.7

2 files

0.5.6

2 files

0.5.5

2 files

0.5.4

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.9

2 files

0.4.8

2 files

0.4.7

2 files

0.4.6

2 files

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.9

2 files

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.1

2 files

0.3.0

2 files

0.2.9

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

1 file

0.2.4

1 file

0.2.3

2 files

0.2.0

1 file

0.1.9

1 file

0.1.8

1 file

0.1.7

1 file

0.1.6

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page