Skip to main content

pyTomoAO

Tests Docs Code health Ruff PyPI version Python versions License: MIT

📖 Documentation — installation, configuration reference, tutorials and API reference.

pyTomoAO is an open-source Python library for tomographic reconstruction in Adaptive Optics (AO) systems. It reconstructs atmospheric turbulence phase maps from several laser guide star Shack–Hartmann wavefront sensors and projects them onto a deformable mirror.

Features

  • Minimum-mean-square-error tomographic reconstruction from multiple LGS wavefront sensors, driven by a layered Von Kármán turbulence model. This is the single-DM, single-optimisation-direction case used for LTAO; MOAO and MCAO are on the roadmap below.
  • Both a model-based reconstructor and one built from a measured interaction matrix.
  • Super-resolution support: per-WFS lenslet rotation and lateral offset.
  • Tools for fitting reconstructed phase maps onto deformable mirrors.
  • GPU acceleration through CuPy, selected automatically when it is available, with a NumPy/Numba CPU backend otherwise.

Installation

pip install pyTomoAO

or clone the repository:

git clone https://github.com/KeckObservatory/pyTomoAO.git
cd pyTomoAO
pip install -e .

See the installation guide for GPU support and optional extras.

Usage

Everything is driven by a single YAML configuration file:

from pyTomoAO import example_config
from pyTomoAO.reconstructor import tomographicReconstructor

# Build a tomographic reconstructor from a configuration file
rec = tomographicReconstructor(example_config("kapa"))
rec.build_reconstructor()

# Fold in the DM fitting step to go from slopes straight to commands
FR = rec.assemble_reconstructor_and_fitting(nChannels=4, slopesOrder="simu")
commands = FR @ slopes

Full walkthrough: quickstart and the KAPA LTAO tutorial.

Roadmap

  • Fundamental tomographic reconstruction algorithms.
  • GPU acceleration.
  • Deformable mirror fitting routines.
  • Detailed documentation and examples.
  • MOAO reconstructor (per-direction outputs).
  • MCAO reconstructor (multiple DM altitudes).

Development

Setup

git clone https://github.com/KeckObservatory/pyTomoAO.git
cd pyTomoAO
pip install -e ".[docs,dev]"

Code Style

Linting and formatting are handled by ruff, configured in pyproject.toml and enforced by the Code health workflow:

ruff check .            # lint
ruff format .           # format
ruff format --check .   # what CI checks

Naming rules are deliberately disabled: class names such as tomographicReconstructor are public API, and matrix names such as Gamma and Cxx mirror the equations they implement. See the code style guide.

Documentation

The documentation is built with Sphinx and published to GitHub Pages at https://keckobservatory.github.io/pyTomoAO/ by the Documentation workflow on every push to main. Pull requests build the docs with warnings treated as errors, so a broken link or docstring fails CI.

To build it locally:

pip install -e ".[docs]"
make -C docs html          # output in docs/build/html
make -C docs strict        # exactly what CI runs
make -C docs livehtml      # auto-reloading preview (needs sphinx-autobuild)

See the documentation guide for conventions and how publishing works.

Testing

The dev extra installs pytest and coverage:

pip install -e ".[dev]"
pytest

CI runs the suite against Python 3.9–3.13 and applies a coverage threshold. See the testing guide.

Changelog

See CHANGELOG.md for release history, and the Unreleased section for what is coming next.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests. Branch from dev and open the pull request against dev; see the contributing guide for conventions. Pull requests must pass the tests, the ruff lint/format checks and the documentation build, and should add an entry to the changelog.

License

This project is licensed under the MIT License. See LICENSE for details.

Contact

For questions and discussions, open an issue on GitHub or contact one of:

Metadata

Release files for pyTomoAO 2.0.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 pyTomoAO 2.0.0
File Size Uploaded
pytomoao-2.0.0.tar.gz 87.1 kB Details

Built distribution (wheel)

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

Total release size: 142.9 kB

Release files / pytomoao-2.0.0.tar.gz

Download URL pytomoao-2.0.0.tar.gz
Size 87.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5f31537e8d3eebc91ca465d5c8336e7e6eea4b3d61c345331f215c4e97696ace
BLAKE2b-256 checksum
How to use checksums
0109d6b202c4ae018ef7931fe372b4b855f4861c5a30d3548efc8b56df7a3e00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 29, 2026.

Transparency log

Release files / pytomoao-2.0.0-py3-none-any.whl

Download URL pytomoao-2.0.0-py3-none-any.whl
Size 55.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4dfa4b02b43236a8b5f8fb568c8bdea4ec9340a8277b709ca1f863dc26947047
BLAKE2b-256 checksum
How to use checksums
916e04651359b46e0d08f9748352be013ed3810e6b23796004d0b48eafb9ca23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

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