pyrtc.modal_basis

Modal bases for wavefront correctors, built with aobasis.

pyrtc builds every modal basis (mode-to-command matrix, M2C) through the aobasis package instead of per-backend code. A wavefront corrector asks for a basis with a basis: section in its config:

wfc:
  num_modes: 50
  basis:
    type: kl            # kl | zernike | fourier | zonal | zonal_fast | hadamard
    pupil_diameter: 8.0 # metres spanned by the actuator grid
    r0: 0.16            # KL only
    L0: 30.0            # KL only

This module holds the pure (stream-free) pieces: config parsing and validation, actuator coordinates from a 2D layout mask, and the generation and normalization of the (num_actuators, num_modes) matrix.

Coordinate convention

aobasis takes actuator positions as an (N, 2) array of (x, y) in metres with the pupil centre at the origin. When positions are derived from a boolean layout mask, x is the column index and y the row index, centred on the middle of the mask, and the first and last rows/columns of the mask sit on the pupil edge: pitch = pupil_diameter / (max(mask.shape) - 1). This is the Fried-geometry convention used by OOPAO and by aobasis.make_circular_actuator_grid. Actuators are ordered like mask[mask] (row-major), which is the order pyrtc uses for command vectors.

Functions

actuator_positions_from_layout(layout[, ...])

Return (N, 2) actuator (x, y) positions in metres for a layout mask.

build_m2c(basis, *, num_modes[, layout, ...])

Build a (num_actuators, num_modes) float32 M2C matrix from a basis config.

default_actuator_layout(num_actuators)

Return a centred, approximately circular boolean layout for num_actuators.

generate_modes(basis, positions, n_modes, *, ...)

Call the matching aobasis generator and return its raw modes.

load_actuator_positions(filename)

Load (N, 2) actuator positions in metres from a .npy or text file.

normalize_modes(modes, how)

Scale each column of modes to unit peak, RMS, or L2 norm.

parse_basis_config(raw, *[, num_modes])

Validate and normalize a basis: config section.

Classes

BasisConfig(type[, n_modes, normalize, ...])

Normalized basis: section of a wavefront-corrector config.