Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

License: GPL v3 DOI arXiv PyPI

genulens

genulens ("generate microlensing") simulates microlensing events with the Galactic model of Koshimoto, Baba & Bennett (2021), ApJ, 917, 78. The model is optimized for bulge sightlines and is most appropriate around |l| < 10 deg and |b| < 7 deg.

The v2 alpha release keeps the historical command-line simulator and adds a refactored C++ core, direct Python bindings, source-forward isochrone workflows, genstars-style extinction-map support, custom Python likelihoods, and optical-depth/event-rate summary APIs.

For the full guide, start from docs/. GitHub displays docs/README.md automatically when opening that directory.

Install From PyPI

The Python package is available on PyPI:

pip install genulens

Binary wheels are currently published for Linux x86_64 and macOS arm64. These wheels include the compiled extension, the genulens command-line executable, bundled input tables, and the GSL shared libraries needed by the extension.

Other platforms, including macOS x86_64 and Windows, may fall back to a source build. Source builds require a system GSL installation.

Build From Source

Source builds include:

pip install --no-binary genulens genulens
pip install git+https://github.com/nkoshimoto/genulens.git

To build from a checkout, genulens requires a C++ compiler, CMake, and GSL.

Check that GSL is visible:

gsl-config --libs

Clone and build:

git clone https://github.com/nkoshimoto/genulens.git
cd genulens
make

If GSL is installed in a non-standard prefix:

GSL_ROOT=/path/to/gsl make

The same GSL shared libraries must be visible at runtime. On Linux with a non-standard GSL prefix, set for example:

export LD_LIBRARY_PATH=/path/to/gsl/lib:$LD_LIBRARY_PATH

Build the Python extension:

make python
PYTHONPATH=build python -c "import genulens; print(genulens.__file__)"

The Python extension can also be built from the checkout with:

pip install .

For a non-standard GSL prefix, pass GSL_ROOT to pip:

GSL_ROOT=/path/to/gsl pip install .

For source installs from a non-standard GSL prefix, the built extension records the linked GSL path in its install RPATH. If your platform strips or ignores that RPATH, set LD_LIBRARY_PATH or the platform equivalent at runtime.

Editable installs are supported in environments with scikit-build-core and pybind11:

pip install -e .

Other build targets:

make pre_gapmoe
make test
make clean

CLI and Python

The installed command-line simulator remains available as:

genulens

From a source-tree build, use ./genulens or build/genulens.

The Python API calls the same C++ simulation core directly. It does not run ./genulens as a subprocess and does not parse CLI stdout.

import pandas as pd
import genulens

cfg = genulens.Config(l=1.0, b=-3.9, n_simu=20_000, seed=42)
result = genulens.simulate(cfg)
df = pd.DataFrame(result.to_numpy(), columns=result.columns)

See docs/quickstart.md and docs/python_api.md for details.

The pre_gapmoe histogram helpers are also available from Python when installed from a wheel or source build:

import genulens

rho = genulens.pre_gapmoe.rho_profile(l=1.0, b=-3.9, SOURCE=1)
rho_array = rho.to_numpy()

See docs/pre_gapmoe.md for the helper API and CLI options.

Documentation

Notebook examples:

The original command-line usage guide remains available as Usage.pdf.

Citation

Please cite Koshimoto, Baba & Bennett (2021) and Koshimoto & Ranc (2021), Zenodo.4784948 if you use this code in your research.

A separate star simulator, genstars, is also available.

The copyright of the included supplementary code option.cpp belongs to Ian A. Bond and Takahiro Sumi.

Release History

  • v2.0.0 alpha 4: deterministic source-CMD IMF quadrature and corrected isochrone mass support across discontinuous evolutionary phases.
  • v2.0.0 alpha 3: Python API for bundled pre_gapmoe helper tables.
  • v2.0.0 alpha: PyPI package, refactored C++ core, direct Python API, source-forward isochrone support, extinction-map support, custom Python likelihoods, and rate-summary APIs.
  • v1.2, June-July 2022: importance sampling, NSD component, updated Galactic Center position, revised usage documentation, and related genstars release.
  • v1.1, June 2021: switched to the GSL random number generator.
  • v1.0, May 2021: initial public release.

Release files for genulens 2.0.0a4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for genulens 2.0.0a4
File Size Uploaded
genulens-2.0.0a4.tar.gz 75.9 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for genulens 2.0.0a4
File
genulens-2.0.0a4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
genulens-2.0.0a4-cp313-cp313-macosx_14_0_arm64.whl CPython 3.13 CPython 3.13 macOS 14.0+ ARM64 Details
genulens-2.0.0a4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
genulens-2.0.0a4-cp312-cp312-macosx_14_0_arm64.whl CPython 3.12 CPython 3.12 macOS 14.0+ ARM64 Details
genulens-2.0.0a4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
genulens-2.0.0a4-cp311-cp311-macosx_14_0_arm64.whl CPython 3.11 CPython 3.11 macOS 14.0+ ARM64 Details
genulens-2.0.0a4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
genulens-2.0.0a4-cp310-cp310-macosx_14_0_arm64.whl CPython 3.10 CPython 3.10 macOS 14.0+ ARM64 Details
genulens-2.0.0a4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
genulens-2.0.0a4-cp39-cp39-macosx_14_0_arm64.whl CPython 3.9 CPython 3.9 macOS 14.0+ ARM64 Details

Total release size: 863.9 MB

Release files / genulens-2.0.0a4.tar.gz

Download URL genulens-2.0.0a4.tar.gz
Size 75.9 MB
Tags Source
SHA-256 checksum
How to use checksums
c712de4efa95a2864a0af3d9cba6ee50d0a9e4537343448c82a785110fd39314
BLAKE2b-256 checksum
How to use checksums
bb6c58d035a4aa7122bbc9b05dc93c134cedd16f577f596228cd37486139ffd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Release files / genulens-2.0.0a4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL genulens-2.0.0a4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 81.4 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
6cf50b352abae4833162b63bd391098f90bc3057c7f1f0cea89b0c2d34935c0e
BLAKE2b-256 checksum
How to use checksums
2cdb93464d341018906686fec52865efcef40d9561d5d3cf2f3fab3c9e4dda79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Release files / genulens-2.0.0a4-cp313-cp313-macosx_14_0_arm64.whl

Download URL genulens-2.0.0a4-cp313-cp313-macosx_14_0_arm64.whl
Size 76.2 MB
Tags CPython 3.13 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
287d273317b74fff1587df1a0a61801abfc1a64a7be5c08f8295d801fc8b7d9c
BLAKE2b-256 checksum
How to use checksums
f8107ee5062dc714e124e731dbe00838aa1d1805fb0a56cba021fa5b6bab51c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Release files / genulens-2.0.0a4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL genulens-2.0.0a4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 81.4 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
fb79c6cafdebdbccc087b469f253b6fa750e969406a83774ec26998533fea25a
BLAKE2b-256 checksum
How to use checksums
3e2c230b524e9219197684b5eca9e8d32dac5c8bfbcb11dfb1c9761958ace28d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Release files / genulens-2.0.0a4-cp312-cp312-macosx_14_0_arm64.whl

Download URL genulens-2.0.0a4-cp312-cp312-macosx_14_0_arm64.whl
Size 76.2 MB
Tags CPython 3.12 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
782761645f37dd83a736f645d957c0cdc7a5e7be690744b8e4d175f7dd93634f
BLAKE2b-256 checksum
How to use checksums
8308088e6e91487b095912068a234f3f8fe96210345292014350543b63a3f9d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Release files / genulens-2.0.0a4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL genulens-2.0.0a4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 81.4 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
350453077475462e33b5a5b521654c6a6514206aa35e035b89b556b3587f3f66
BLAKE2b-256 checksum
How to use checksums
ac424fc9601f761fb41d92b246d8aad2234f3dabb3c448439a32195388d4d05f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Release files / genulens-2.0.0a4-cp311-cp311-macosx_14_0_arm64.whl

Download URL genulens-2.0.0a4-cp311-cp311-macosx_14_0_arm64.whl
Size 76.2 MB
Tags CPython 3.11 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
50ecb1c04eb5a958f20ae38aebed876cb2649bb2be72b35e6da5f94eee5bc3ee
BLAKE2b-256 checksum
How to use checksums
7abfc56ef554ce4bcbc9572b182d26bfe7636ebc5d5d68b510f109b2c5aba754
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Release files / genulens-2.0.0a4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL genulens-2.0.0a4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 81.4 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ed63841bc5a2a4ffc1cabcaff6ec1231a278adc6d9017949eca0d810a18c8c54
BLAKE2b-256 checksum
How to use checksums
7a6f3fdd333e6d87185cbd830db62f7386f19775311da338f974a0049635588d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Release files / genulens-2.0.0a4-cp310-cp310-macosx_14_0_arm64.whl

Download URL genulens-2.0.0a4-cp310-cp310-macosx_14_0_arm64.whl
Size 76.2 MB
Tags CPython 3.10 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
1f3a3b0210b6f2afdbdb223ec719b04b0f650456a2363a4b94b56d39c9131227
BLAKE2b-256 checksum
How to use checksums
7b9ce43ab8edd023c46cc480084129903f140c3ef4246d8a9d8e336da6935271
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Release files / genulens-2.0.0a4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL genulens-2.0.0a4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 81.4 MB
Tags CPython 3.9 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
3754af0472c27f487312f4b4d0217bafbe4f77f91026c563021a8d05c7bb6c16
BLAKE2b-256 checksum
How to use checksums
94b33a0fed71fa47e068d4526b131257f72da8dd8b16862cae8c013c81372620
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Release files / genulens-2.0.0a4-cp39-cp39-macosx_14_0_arm64.whl

Download URL genulens-2.0.0a4-cp39-cp39-macosx_14_0_arm64.whl
Size 76.2 MB
Tags CPython 3.9 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
d1a1c529e02d636caff009f51ae69c71848bec88b2e186c59a993802fbf1c4b9
BLAKE2b-256 checksum
How to use checksums
cb4bdb5441ab7cbac7a66bbf34917558907d8460cc4a6d35a9817f5e2ba98334
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log
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