Interaction Matrix

Overview

InteractionMatrix() builds the AO system interaction matrix (or its pseudo-inverse) by applying push-pull excitations to each DM mode and recording the WFS response. Supports parallel batch measurement and optional noise.

API reference

OOPAO.calibration.InteractionMatrix.InteractionMatrix(ngs, tel, dm, wfs, M2C, stroke, atm=None, phaseOffset=0, nMeasurements=50, noise='off', invert=True, nTrunc=0, print_time=False, display=False, single_pass=True)[source]

Build the interaction matrix of an AO system.

Parameters:
  • ngs (Source) – Guide star source object.

  • tel (Telescope) – Telescope object.

  • dm (DeformableMirror) – Deformable mirror object.

  • wfs (Pyramid or ShackHartmann) – Wavefront sensor object.

  • M2C (numpy.ndarray) – Mode-to-command matrix of shape (n_actuators, n_modes).

  • stroke (float) – Amplitude of the push (and pull if single_pass=False) in M2C units (metres for Gaussian IFs).

  • atm (Atmosphere or None) – Atmosphere object. If provided, turbulence is frozen during calibration. Default None.

  • phaseOffset (numpy.ndarray or float) – Static OPD offset (e.g. NCPA) applied during calibration. Default 0.

  • nMeasurements (int) – Number of DM modes excited per batch to speed up calibration. Default 50.

  • noise (str) – 'off' (default) — noise disabled during calibration; 'on' — noise enabled.

  • invert (bool) – If True (default), return a CalibrationVault with the pseudo-inverse. If False, return the raw interaction matrix.

  • nTrunc (int) – Number of singular values to truncate in the inversion. Default 0.

  • print_time (bool) – Print elapsed time per iteration. Default False.

  • display (bool) – Show a tqdm progress bar. Default False.

  • single_pass (bool) – If True (default), only push. If False, push and pull (average).

Returns:

CalibrationVault (if invert=True) or raw interaction matrix numpy.ndarray.

Example

from OOPAO.calibration.InteractionMatrix import InteractionMatrix

calib = InteractionMatrix(
    ngs    = ngs,
    tel    = tel,
    dm     = dm,
    wfs    = wfs,
    M2C    = M2C,
    stroke = 1e-9,
    noise  = 'off',
    display = True,
)
# Apply reconstructor in closed loop
dm.coefs = -gain * M2C @ calib.M @ wfs.signal