KL Modal Basis

Overview

compute_KL_basis() computes the Karhunen-Loève (KL) modal basis for a DM by diagonalising the atmosphere covariance projected onto the DM influence functions. The resulting basis is ordered from lowest to highest spatial frequency (first modes are piston, tip, tilt, then higher-order modes).

This is the recommended modal basis for closed-loop AO control in OOPAO.

API reference

OOPAO.calibration.compute_KL_modal_basis.compute_KL_basis(tel, atm, dm, lim=1e-3, remove_piston=True, n_batch=1)

Compute the KL modal basis for a DM/atmosphere combination.

Parameters:
  • tel (Telescope) – Telescope object.

  • atm (Atmosphere) – Atmosphere object (defines the turbulence statistics for the covariance).

  • dm (DeformableMirror) – Deformable mirror object.

  • lim (float) – Inversion threshold for the covariance matrix. Default 1e-3.

  • remove_piston (bool) – If True, remove the piston mode from the basis. Default True.

  • n_batch (int) – Number of batches for memory-efficient covariance computation. Default 1.

Returns:

Mode-to-command (M2C) matrix of shape (n_actuators, n_modes).

Return type:

numpy.ndarray

Example

from OOPAO.calibration.compute_KL_modal_basis import compute_KL_basis

M2C = compute_KL_basis(tel, atm, dm)
dm.coefs = M2C   # visualise all modes as OPD maps
OOPAO.calibration.get_modal_basis.get_modal_basis_from_ao_obj(ao_obj, nameFolderBasis=None, nameBasis=None)[source]

Load a previously saved KL modal basis from disk and populate the AO object.

Parameters:
  • ao_obj (object) – AO system object.

  • nameFolderBasis (str or None) – Folder containing the saved basis FITS file. Default None.

  • nameBasis (str or None) – Basis filename without extension. Default None (auto-generated).

Returns:

Object with M2C, basis, and optionally projector.

Return type:

object