Skip to main content

Logo

pizzetti

Python Julia Examples Docs License: GPL v3

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 in 1/(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=True reports which samples carry it.
  • MarginalTransitModel integrates 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 MarginalTransitModel also 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-compatible transit_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.1

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

Source distribution (sdist)

Source distribution for pizzetti 0.6.1
File Size Uploaded Provenance Actions
pizzetti-0.6.1.tar.gz 210.5 kB Without provenance Details for pizzetti-0.6.1.tar.gz

Built distribution (wheel)

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

Total release size: 386.2 kB

Release files / pizzetti-0.6.1.tar.gz

Download URL pizzetti-0.6.1.tar.gz
Size 210.5 kB
Tags Source
SHA-256 checksum
How to use checksums
be951cf70853677dbb3339d82fef5eea17a67cdf7c9bbee4e43195d530ef79bf
BLAKE2b-256 checksum
How to use checksums
0432cadfba6c637693dd578db6a86c1115ef091eef0248c599d531d49ad79594
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.1-py3-none-any.whl

Download URL pizzetti-0.6.1-py3-none-any.whl
Size 175.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ab519697932724614ba07fdfb70406db248e0845845e3a3f8d0549ae443d4d4
BLAKE2b-256 checksum
How to use checksums
033afa0e0dc97997dc968ff17155846d35f97a7a7dba64bf95942dcf9930bea4
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.1

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.

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