pizzetti
Fast limb-darkened transit light curves, with an elementary series and a proven error bound.
pizzetti has the interface of batman, so existing code
runs unchanged after one line:
import pizzetti as batman
Install
pip install pizzetti # pip install "pizzetti[fit]" adds emcee and scipy for MarginalTransitModel
Julia: ] add https://github.com/hippke/pizzetti:julia (package Pizzetti, see julia/).
A light curve in ten lines
import numpy as np, pizzetti
p = pizzetti.TransitParams()
p.t0, p.per, p.rp, p.a, p.inc = 0.0, 3.0, 0.1, 15.0, 88.0
p.ecc, p.w = 0.0, 90.0
p.u, p.limb_dark = [0.4, 0.25], "quadratic"
t = np.linspace(-0.1, 0.1, 10_000)
flux = pizzetti.TransitModel(p, t).light_curve(p)
Why it is fast and exact
- Inside the stellar disk (between second and third contact) the flux is
sqrt(1 - z²)times a polynomial in1/(1 - z²)whose coefficients depend only on the radius ratio: one square root, one division and a dozen multiply–adds per point, with a proven bound on the truncation error (default 10⁻⁹ of the stellar flux). This covers 96–98 % of the transit of an Earth-sized planet. - At the limb, quadratic family: the exact Mandel & Agol solution, vectorised.
- At the limb, other laws (square-root, nonlinear, power-2, any sum of powers of μ): the limb integral is a complete integral that a fixed-node trapezoid rule evaluates to 10⁻¹⁵ without set-up; long light curves use Chebyshev interpolants built from it in ~40 µs (radius ratios below 0.3; beyond: contact expansions or quadrature).
- Certified mode:
limb="proven"extends the proven bound to the limb;return_certified=Truereports which samples carry it. MarginalTransitModelintegrates the limb darkening and the baseline out analytically, so a fit samples only the geometry;fit()returns posterior draws in about a second.- Gaussian-process noise:
gp=pizzetti.GP()fits correlated noise together with the transit, so a light curve need not be detrended first; O(N) per evaluation, with the limb darkening still integrated out.
Single thread, 10⁵ points, 35 % in transit, every call recomputing the orbit as in a fit
(benchmarks/benchmark.py, Intel Xeon, numba 0.68, batman 2.5.3):
| law | rp = 0.0092 | rp = 0.1 |
|---|---|---|
| quadratic | 0.31 ms (13× faster than batman) | 0.42 ms (10×) |
| nonlinear | 0.49 ms (9×) | 0.91 ms (44×) |
| power-2 | 0.47 ms (7×) | 0.76 ms (34×) |
batman's numerical laws run at its default 1 ppm tolerance; pizzetti stays below 10⁻⁹. In complete emcee fits the likelihood is 3.4–4.4× faster than batman's, and 2–3.5× for grazing transits (examples/inference).
What is included
- batman drop-in:
TransitParams,TransitModel(light_curve,get_t_secondary,get_t_periastron,get_t_conjunction,get_true_anomaly,calc_err), circular and eccentric orbits, supersampling, secondary eclipses, inverse transits. - Laws: uniform, linear, quadratic, square-root, nonlinear (4-parameter), power-2; in
MarginalTransitModelalso logarithmic and power-2 with free α. (Exponential and custom laws are not sums of powers of μ and are not supported.) - Low level:
occult(z, rp, u, law, limb=...),series_cut,occult_terms(basis light curves, linear in the limb-darkening coefficients). - Julia (
Pizzetti.jl): the same algorithms, plus exact gradients with ForwardDiff, BigFloat light curves, rigorous interval enclosures, photodynamics with NbodyGradient, and a Limbdark.jl-compatibletransit_poly.
Learn more
| Tutorials | twenty-one Python notebooks and seven Julia notebooks, from a first light curve to certified, differentiable models, importance sampling, two guided tours from a raw light curve to a planet's posterior, the Grand Tour with wotan (detrending with wotan, the search with TLS) and the Grand Tour with simultaneous GP (no detrending: TLS 2.0 + GP and a fit with a Gaussian process), and a Gaussian process fitted together with the transit on a young, strongly variable star, without detrending |
| Documentation | method, accuracy, performance and API |
| Paper reproduction | one command per table and figure of the paper |
| Proofs | self-contained proofs of the theorems, and validation notebooks |
| Changelog |
The name
The interior series is the two-dimensional form of the mean-value expansion of Paolo Pizzetti (1860–1918), Italian geodesist and mathematician (Rend. Lincei 18, 1909).
Contributing
All my repositories embrace collaboration between humans and AI. Contributions are welcome, whether they are written by you, by an AI assistant, or by both together, and they will be handled promptly. Please open an issue or a pull request.
Citing
Please cite the accompanying paper (Hippke et al., in prep.) and Mandel & Agol (2002); see
CITATION.cff. License: GPL-3.0-or-later.
Metadata
Release files for pizzetti 0.6.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pizzetti-0.6.4.tar.gz | 218.2 kB | Without provenance | Details for pizzetti-0.6.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pizzetti-0.6.4-py3-none-any.whl | Python 3 | none | any | Details for pizzetti-0.6.4-py3-none-any.whl |
Total release size: 399.2 kB
Release files / pizzetti-0.6.4.tar.gz
| Download URL | pizzetti-0.6.4.tar.gz |
|---|---|
| Size | 218.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d400c5d33f4dc20d4ef5fa7ead5b5f318bd1ea52c03a477981d6c3c48bd4a9fa
|
|
BLAKE2b-256 checksum How to use checksums |
31b5efd5dce8be9e1ed38fe5fef1ba300b4c1a226551e78b822485c64f199b3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Release files / pizzetti-0.6.4-py3-none-any.whl
| Download URL | pizzetti-0.6.4-py3-none-any.whl |
|---|---|
| Size | 181.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a940ead55e35c59bc35d161476a8323548e0a83dc80ed6151b6b7d747e7f73a
|
|
BLAKE2b-256 checksum How to use checksums |
3e136e802f20d83f7ee5fcf06cab560052cbb5afc0b5a8b0ec87ed3386ecd6f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Security for pizzetti 0.6.4
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.