Skip to main content

Helper package for handling Adaptive Optics Telemetry (AOT) standard files

Project description

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).

Project details


Download files

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

Source Distribution

aotpy-3.2.1.tar.gz (3.2 MB view details)

Uploaded Source

Built Distribution

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

aotpy-3.2.1-py3-none-any.whl (3.2 MB view details)

Uploaded Python 3

File details

Details for the file aotpy-3.2.1.tar.gz.

File metadata

  • Download URL: aotpy-3.2.1.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for aotpy-3.2.1.tar.gz
Algorithm Hash digest
SHA256 634e121291605d79ad9fc357bb323887b7bd83014620a4cc675f684eff46929e
MD5 0d944f47d46f4ba327419deae52eb287
BLAKE2b-256 a95cff090faf59ad55d761b614f75c1a9c06163c31d66851445f747f48d293dd

See more details on using hashes here.

File details

Details for the file aotpy-3.2.1-py3-none-any.whl.

File metadata

  • Download URL: aotpy-3.2.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for aotpy-3.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 16a00c18abd046ca0233ec3d4204a614eb9863ebb7da3e3aaa85578a085afe6d
MD5 dd1f4b0bc63ebf25904076c4dd65c1f6
BLAKE2b-256 4c849fe2ebf15dca93d8c9066de0b1c10ba27ec83978951f50aac0865a79f8e1

See more details on using hashes here.

Supported by

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