Skip to main content

DOI Documentation Status

aotpy

Helper Python package for handling Adaptive Optics Telemetry (AOT) standard files. For more information, please check the published specification for AOT. Basic package documentation available.

How to install

Support is offered for Python 3.10 or later.

From PyPI (recommended)

python -m pip install aotpy

From the repository

Clone the repository and then install with:

python -m pip install path/to/aotpy

where 'path/to/aotpy' is the path to the root of the cloned repository.

Code example

Creating an AOT FITS file

Here we exemplify of how to create an AOT FITS file from scratch. In general terms, we create an AOSystem object, fill the relevant data fields and then write that object into a FITS file which follows the AOT specification.

import numpy as np

import aotpy

# Create the system object and its main telescope
system = aotpy.AOSystem(ao_mode='GLAO')
system.main_telescope = aotpy.MainTelescope("Example telescope")

# Create the DM, which is installed on the main telescope.
dm = aotpy.DeformableMirror("Example DM", n_valid_actuators=32, telescope=system.main_telescope)
system.wavefront_correctors.append(dm)

# Create the sources being sensed.
ngs = aotpy.NaturalGuideStar("Example NGS")
lgs = aotpy.SodiumLaserGuideStar("Example LGS")
system.sources = [ngs, lgs]

# Create a 4 subaperture Shack-Hartmann WFS sensing the NGS source. It contains 10000 frames of slopes.
ngs_wfs = aotpy.ShackHartmann("WFS1", source=ngs, n_valid_subapertures=4,
                              measurements=aotpy.Image("NGS slopes", data=np.ones((10000, 2, 4))))
# Also create a detector for this WFS, containing 100 frames of pixel data (20x20).
ngs_wfs.detector = aotpy.Detector("DET1", pixel_intensities=aotpy.Image("Pixels", data=np.random.random((100, 20, 20))))

# Create a 8 subaperture Shack-Hartmann WFS sensing the LGS source. It contains 10000 frames of slopes.
lgs_wfs = aotpy.ShackHartmann("WFS2", source=lgs, n_valid_subapertures=8,
                              measurements=aotpy.Image("LGS slopes", data=np.ones((10000, 2, 8))))
system.wavefront_sensors = [ngs_wfs, lgs_wfs]

# Create the loops in the system.
# Both loops command the DM, but one handles LO modes using the NGS, while the other handles HO modes using the LGS.
lo_loop = aotpy.ControlLoop("LO loop", input_sensor=ngs_wfs, commanded_corrector=dm,
                            commands=aotpy.Image("LO commands", data=np.ones((10000, 32))),
                            control_matrix=aotpy.Image('LO control matrix', data=np.ones((32, 2, 4))))
ho_loop = aotpy.ControlLoop("HO loop", input_sensor=lgs_wfs, commanded_corrector=dm,
                            commands=aotpy.Image("HO commands", data=np.ones((10000, 32))),
                            control_matrix=aotpy.Image('HO control matrix', data=np.ones((32, 2, 8))))
system.loops = [lo_loop, ho_loop]

# Write the system to an AOT file. This file can then be read, recovering the exact same system.
system.write_to_file("example.fits")

Reading an existing AOT file

In this example we assume we already have an AOT file. We can easily read it and explore its data. For demonstration purposes, we assume matplotlib is installed, although it is not a requirement for this package.

import matplotlib.pyplot as plt

import aotpy

# If we open the file that was created in the example above, the resulting "system" object will contain the exact same
# data as the "system" object that was built in the example above.
system = aotpy.AOSystem.read_from_file("example.fits")

# We can then display a frame of pixel data. For the data above, we know the first WFS has pixel data.
pixel_data = system.wavefront_sensors[0].detector.pixel_intensities.data
# Then we display the first frame of data.
plt.imshow(pixel_data[0])
plt.show()

Acknowledgements

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No. 101004719 (OPTICON–RadioNet Pilot).

Metadata

Release files for aotpy 3.2.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 aotpy 3.2.1
File Size Uploaded
aotpy-3.2.1.tar.gz 3.2 MB Details

Built distribution (wheel)

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

Total release size: 6.3 MB

Release files / aotpy-3.2.1.tar.gz

Download URL aotpy-3.2.1.tar.gz
Size 3.2 MB
Tags Source
SHA-256 checksum
How to use checksums
634e121291605d79ad9fc357bb323887b7bd83014620a4cc675f684eff46929e
BLAKE2b-256 checksum
How to use checksums
a95cff090faf59ad55d761b614f75c1a9c06163c31d66851445f747f48d293dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / aotpy-3.2.1-py3-none-any.whl

Download URL aotpy-3.2.1-py3-none-any.whl
Size 3.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
16a00c18abd046ca0233ec3d4204a614eb9863ebb7da3e3aaa85578a085afe6d
BLAKE2b-256 checksum
How to use checksums
4c849fe2ebf15dca93d8c9066de0b1c10ba27ec83978951f50aac0865a79f8e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release history Release notifications | RSS feed

This release

3.2.1 This release

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.0

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.1.1

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