Skip to main content

singlens

singlens logo

Differentiable single-lens microlensing in JAX: static and annual-parallax light curves, finite sources, limb darkening, and gradient-based inference.

python -m pip install singlens

Requires Python 3.12+ and JAX 0.11.2+. Install singlens[examples] for plotting and inference dependencies. Enable float64 before evaluation.

See the documentation for installation, tutorials, and the API.

import jax
jax.config.update("jax_enable_x64", True)
import jax.numpy as jnp
from singlens import magnification, AnnualParallax

times = jnp.linspace(7980., 8020., 501)
event = dict(t0=8000., u0=0.005, t_e=20., rho=0.01, a1=0.5)
geometry = AnnualParallax(ra_deg=266., dec_deg=-29., t_ref=8000.)
A = magnification(times, **event, parallax=geometry,
                          pi_e_n=0.2, pi_e_e=-0.1)

magnification takes event parameters and returns an array with the shape of times. Omit rho for a point source; supply rho for a uniform disk, or rho and physical a1 for linear limb darkening. Times above are HJD − 2450000 in days. AnnualParallax holds fixed sky geometry; parallax amplitudes remain fitted inputs.

curve = jax.jit(lambda rho: magnification(times, t0=8000., u0=0.005,
                                        t_e=20., rho=rho, parallax=geometry,
                                        pi_e_n=.2, pi_e_e=-.1))
A = curve(0.01)
dA_drho = jax.jacfwd(curve)(0.01)

Use Model, Parameters, and fit_flux for named event parameters, source-position input, and source/blend flux fitting. See the API and examples. Benchmarks compare magnification accuracy, CPU runtime, and inference efficiency with VBMicrolensing and MulensModel.

For source installation and development, see CONTRIBUTING.

Attribution

Adapted from microJAX and the FFT method of Sugiyama (2022). See attribution, NOTICE, and LICENSES for citations and the MIT, Apache-2.0, and BSD-3-Clause license notices.

Metadata

Release files for singlens 0.1.0

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

Source distribution (sdist)

Source distribution for singlens 0.1.0
File Size Uploaded Provenance
singlens-0.1.0.tar.gz 22.0 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for singlens 0.1.0
File Interpreter ABI Platform
singlens-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.8 MB

Release files / singlens-0.1.0.tar.gz

Download URL singlens-0.1.0.tar.gz
Size 22.0 MB
Tags Source
SHA-256 checksum
How to use checksums
aed2442b61065fea1ce1c2f73c9635a0addcade71db576afae8adab2dd9edc5d
BLAKE2b-256 checksum
How to use checksums
20403efc9bb44759f110a72ee48f159355200fc89bfa75c20165bf7a82763c77
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 Oct 15, 2026.

Transparency log

Release files / singlens-0.1.0-py3-none-any.whl

Download URL singlens-0.1.0-py3-none-any.whl
Size 1.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
01ce51ba383033618d0d44a8de6e7a4b9ed46f897fb798a6ef9fb21be567c875
BLAKE2b-256 checksum
How to use checksums
821c891bb677ea332b507ae584fafac2d53e8afd4716e6ade26d4b07e894066b
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 Oct 15, 2026.

Transparency log

Security for singlens 0.1.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for singlens-0.1.0.tar.gz

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 Oct 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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