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.1.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.1-py3-none-any.whl (12.2 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ler-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 24a3aa4fe66ef20b7e8e7a2c9512602448248ed735a39767b789167f2c8583a5
MD5 f6518c644e19a967230a21e01c5571d0
BLAKE2b-256 499f06fa39564b3d521c7f15793c693538b9593f19146a8173c5273a35d5fd6c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ler-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8fc9ef82a44fa336127d89146e372c1438309e1864ad12f4b983ce38b1fbe8d1
MD5 d763c305b085f96e751cb56b5a7cefe1
BLAKE2b-256 9c7cdf33516110d109bf1b042595a038578f9fc8f03e03a6c36ad1eaf4c71ea3

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.2

2 files

This release

1.0.1 This release

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