Skip to main content

Logo

An optimized transit-fitting algorithm to search for periodic transits of small planets

Image Image Image Image Image Image

Motivation

We present a new method to detect planetary transits from time-series photometry, the Transit Least Squares (TLS) algorithm. While the commonly used Box Least Squares (BLS, Kovács et al. 2002) algorithm searches for rectangular signals in stellar light curves, TLS searches for transit-like features with stellar limb-darkening and including the effects of planetary ingress and egress. Moreover, TLS analyses the entire, unbinned data of the phase-folded light curve. These improvements yield a ~10 % higher detection efficiency (and similar false alarm rates) compared to BLS. The higher detection efficiency of our freely available Python implementation comes at the cost of higher computational load, which we partly compensate by applying an optimized period sampling and transit duration sampling, constrained to the physically plausible range. A typical Kepler K2 light curve, worth of 90 d of observations at a cadence of 30 min, can be searched with TLS in about half a second on a standard laptop computer (after a one-time JIT compilation of a few seconds) — as fast as BLS.

image

What's new in TLS 2.0

  • 30–60x faster than TLS 1.33 on warm benchmarks, with unchanged detection rates: a rewritten numba kernel stack evaluates the same statistic using algebraic correlations, prefix sums and validated approximations. The default backend is validated against the exact statistic on hundreds of injection-recovery cases; the backend="fused" backend is exact up to rounding and bit-identical to the original algorithm.
  • 18 bug fixes, 10 of which change results (among them: a weighted final T0 fit, a correct out-of-transit noise estimate for the SNR, honest reporting when no transit is fit, and honouring user-supplied stellar limits and template parameters). The duration-limit mass pairing reported by Talens et al. (2026) is fixed.
  • Own limb-darkened transit model — batman is no longer a runtime dependency (it remains an optional dependency for the test suite).
  • Opt-in analytic SDE background detrending: power(SDE_detrend="hybrid") (see the documentation).
  • Pluggable search backends (power(backend=...)), modern packaging (pyproject.toml), and a golden test set that freezes all result fields.

See the changelog for the full list of changes.

Installation

TLS can be installed conveniently using: pip install transitleastsquares

If you have multiple versions of Python and pip on your machine, try: pip3 install transitleastsquares

The latest version can be pulled from github:

git clone https://github.com/hippke/tls.git
cd tls
pip install .

For an editable (development) install, use pip install -e . instead of the last line.

Dependencies: Python 3.9+ (tested up to 3.14), NumPy (>= 1.22), numba, tqdm, optional: astroquery (for LD and stellar density priors from Kepler K1, K2, and TESS), batman-package (only needed to run the test suite).

If you have trouble installing, please open an issue.

Getting started

Here is a terminal recording of a real TLS 2.0 search: 231,000 trial periods on 8 CPU cores in about 6 seconds (3 years of simulated photometry of a solar-type star with an Earth-like planet). For more examples, have a look at the tutorials and the documentation.

image

Attribution

Please cite Hippke & Heller (2019, A&A 623, A39) if you find this code useful in your research. The BibTeX entry for the paper is:

@ARTICLE{2019A&A...623A..39H,
       author = {{Hippke}, Michael and {Heller}, Ren{\'e}},
        title = "{Optimized transit detection algorithm to search for periodic transits of small planets}",
      journal = {\aap},
         year = "2019",
        month = "Mar",
       volume = {623},
          eid = {A39},
        pages = {A39},
          doi = {10.1051/0004-6361/201834672},
archivePrefix = {arXiv},
       eprint = {1901.02015},
 primaryClass = {astro-ph.EP},
       adsurl = {https://ui.adsabs.harvard.edu/\#abs/2019A&A...623A..39H},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

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.

Copyright 2019-2026 Michael Hippke & René Heller.

Metadata

Release files for transitleastsquares 2.0.2

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

Source distribution (sdist)

Source distribution for transitleastsquares 2.0.2
File Size Uploaded Provenance Actions
transitleastsquares-2.0.2.tar.gz 125.8 kB Without provenance Details for transitleastsquares-2.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 225.0 kB

Release files / transitleastsquares-2.0.2.tar.gz

Download URL transitleastsquares-2.0.2.tar.gz
Size 125.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c696e2e2205afb5b9368cec58be8c929dbf87beb4ef10bdb11e98f0d8a3f1935
BLAKE2b-256 checksum
How to use checksums
12ac1cc33e41e8cd0a824f1365e831d2d059d04c651e259d593aff30e23ea786
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Release files / transitleastsquares-2.0.2-py3-none-any.whl

Download URL transitleastsquares-2.0.2-py3-none-any.whl
Size 99.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc58bb878ce2db9ea5426db4f862993ca411a009617a15d5737be88ceb0ebd7f
BLAKE2b-256 checksum
How to use checksums
cfe0afd3f42a52e5058793a6e05abb37d059c0b7dcb1e141bab56b173ee616e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Security for transitleastsquares 2.0.2

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.

Release history Release notifications | RSS feed

This release

2.0.2 This release

2 release files No 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