Metadata-Version: 2.4
Name: singlens
Version: 0.1.0
Summary: Differentiable single-lens microlensing in JAX
Author-email: Shota Miyazaki <miyazaki@ir.isas.jaxa.jp>
License-Expression: MIT AND Apache-2.0 AND BSD-3-Clause
Project-URL: Documentation, https://singlens.readthedocs.io/en/latest/
Project-URL: Repository, https://github.com/ShotaMiyazaki94/singlens
Project-URL: Issues, https://github.com/ShotaMiyazaki94/singlens/issues
Keywords: microlensing,astronomy,jax,autodiff,single-lens
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Astronomy
Classifier: Operating System :: OS Independent
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: LICENSES/JAX-Apache-2.0.txt
License-File: LICENSES/SciPy-BSD-3-Clause.txt
License-File: LICENSES/fft-extended-source-MIT.txt
License-File: LICENSES/microjax-MIT.txt
License-File: LICENSES/test_microjax-MIT.txt
License-File: NOTICE
Requires-Dist: jax>=0.11.2
Requires-Dist: numpy>=2.0
Provides-Extra: test
Requires-Dist: pytest>=8; extra == "test"
Requires-Dist: scipy>=1.14; extra == "test"
Provides-Extra: dev
Requires-Dist: singlens[test]; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=6; extra == "dev"
Requires-Dist: ruff>=0.11; extra == "dev"
Provides-Extra: validation
Requires-Dist: VBMicrolensing>=5; extra == "validation"
Requires-Dist: MulensModel>=3; extra == "validation"
Requires-Dist: emcee<4,>=3.1; extra == "validation"
Provides-Extra: examples
Requires-Dist: matplotlib>=3.9; extra == "examples"
Requires-Dist: scipy>=1.14; extra == "examples"
Requires-Dist: numpyro>=0.22; extra == "examples"
Requires-Dist: tinygp<0.4,>=0.3.1; extra == "examples"
Requires-Dist: corner<3,>=2.2; extra == "examples"
Provides-Extra: docs
Requires-Dist: singlens[examples]; extra == "docs"
Requires-Dist: sphinx<10,>=8; extra == "docs"
Requires-Dist: sphinx-book-theme<2,>=1.1; extra == "docs"
Requires-Dist: myst-nb<2,>=1.2; extra == "docs"
Requires-Dist: ipykernel>=6; extra == "docs"
Requires-Dist: ipywidgets>=8; extra == "docs"
Requires-Dist: nbformat>=5.10; extra == "docs"
Dynamic: license-file

# singlens

<img src="https://raw.githubusercontent.com/ShotaMiyazaki94/singlens/main/logo_transparent.png" alt="singlens logo" width="280">

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

```bash
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](https://singlens.readthedocs.io/en/latest/) for
installation, tutorials, and the API.

```python
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.

```python
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](https://singlens.readthedocs.io/en/latest/api.html) and
[examples](https://github.com/ShotaMiyazaki94/singlens/tree/main/example).
[Benchmarks](https://singlens.readthedocs.io/en/latest/benchmarks.html) compare
magnification accuracy, CPU runtime,
and inference efficiency with VBMicrolensing and MulensModel.

For source installation and development, see
[CONTRIBUTING](https://github.com/ShotaMiyazaki94/singlens/blob/main/CONTRIBUTING.md).

## Attribution

Adapted from [microJAX](https://github.com/ShotaMiyazaki94/microjax) and the
FFT method of [Sugiyama (2022)](https://arxiv.org/abs/2203.06637).
See [attribution](https://singlens.readthedocs.io/en/latest/attribution.html),
[NOTICE](https://github.com/ShotaMiyazaki94/singlens/blob/main/NOTICE), and
[LICENSES](https://github.com/ShotaMiyazaki94/singlens/tree/main/LICENSES) for
citations and the MIT, Apache-2.0, and BSD-3-Clause license notices.
