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:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytomoao-2.0.0.tar.gz (87.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytomoao-2.0.0-py3-none-any.whl (55.8 kB view details)

Uploaded Python 3

File details

Details for the file pytomoao-2.0.0.tar.gz.

File metadata

  • Download URL: pytomoao-2.0.0.tar.gz
  • Upload date:
  • Size: 87.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pytomoao-2.0.0.tar.gz
Algorithm Hash digest
SHA256 5f31537e8d3eebc91ca465d5c8336e7e6eea4b3d61c345331f215c4e97696ace
MD5 33f3bb66b8dcb16f2d6661c931f6c94c
BLAKE2b-256 0109d6b202c4ae018ef7931fe372b4b855f4861c5a30d3548efc8b56df7a3e00

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytomoao-2.0.0.tar.gz:

Publisher: publish.yml on KeckObservatory/pyTomoAO

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytomoao-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: pytomoao-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 55.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pytomoao-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4dfa4b02b43236a8b5f8fb568c8bdea4ec9340a8277b709ca1f863dc26947047
MD5 90ae7f02041d9e790ec6a456cb32b215
BLAKE2b-256 916e04651359b46e0d08f9748352be013ed3810e6b23796004d0b48eafb9ca23

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytomoao-2.0.0-py3-none-any.whl:

Publisher: publish.yml on KeckObservatory/pyTomoAO

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page