Skip to content

Controller

queue_listerner instance-attribute

queue_listerner = setup_logging()

logger instance-attribute

logger = getLogger()

external_logger_flag instance-attribute

external_logger_flag = False

tag instance-attribute

tag = 'controller'

device instance-attribute

device = device('cuda' if is_available() else 'cpu')

samplingTime instance-attribute

samplingTime = samplingTime

reconstructionMethod instance-attribute

reconstructionMethod = reconstructionMethod

rcond instance-attribute

rcond = get('rcond', 0.025)

beta instance-attribute

beta = get('beta', 0.0001)

control_mask instance-attribute

control_mask = get('control_mask', None)

controllerType instance-attribute

controllerType = controllerType

gain instance-attribute

gain = get(
    "gain", [0.0 for _ in (range(len(reconstructor)))]
)

decay instance-attribute

decay = get(
    "decay", [0.0 for _ in (range(len(reconstructor)))]
)

ki instance-attribute

ki = get('ki', [0.0 for _ in (range(len(reconstructor)))])

__init__

__init__(
    telescope,
    interactionMatrix,
    controllerType,
    reconstructionMethod,
    logger=None,
    **kwargs,
)

Initialize the Controller module.

Parameters:

Name Type Description Default
telescope Telescope instance

Telescope instance, provides the sampling time of the simulation.

required
interactionMatrix InteractionMatrixHandler instance

Contains the interaction matrices and modal basis for the simulation configuration.

required
controllerType String

The type of controller that will be used, supported types are: {leaky, forwardPI, backwardPI}.

required
reconstructionMethod String

Type of reconstructor used, supported types are: {inversion, tikhonov}.

required
**kwargs

rcond : list of length equal to nDMs or float Percentage of the maximum singular value below witch the SV are discarded. beta : list of length equal to nDMs or float Regularisation coefficient beta for the Tikhonov Regularisation: alfa = beta * (Smax**2) gain : list of length equal to nDMs or float Proportional gain of the Leaky and PI controllers decay : list of length equal to nDMs or float Decay rate for the Leaky integrator ki : list of length equal to nDMs or float Integral gain for the PI controllers

{}

initializeReconstructor

initializeReconstructor(
    reconstructionMethod, interactionMatrix
)

Initialize the reconstructor matrix from the measured interaction matrices.

Parameters:

Name Type Description Default
reconstructionMethod str

Type of reconstructor ('inversion' or 'tikhonov').

required
interactionMatrix InteractionMatrixHandler

Object containing the measured interaction matrices and modal basis.

required

Returns:

Name Type Description
reconstructor list

List of reconstructor matrices per DM.

modal_basis list

List of modal basis per DM.

mask ndarray

Boolean mask indicating interactions between DMs and light paths.

discarded_modes list

List of number of discarded modes per DM.

initializeController

initializeController(controllerType, reconstructor)

Initialize the control state (history buffers) based on the controller type.

Parameters:

Name Type Description Default
controllerType str

Type of controller ('leaky', 'forwardPI', 'backwardPI').

required
reconstructor list

List of reconstructor matrices per DM.

required

Returns:

Type Description
bool

True if initialization succeeds.

computeControlAction

computeControlAction(lightPaths)

Compute the control action for each DM given the wavefront error from the light paths.

Parameters:

Name Type Description Default
lightPaths list

List of LightPath objects that contain the wavefront error measurements.

required

Returns:

Name Type Description
dm_cmd list

List of command arrays to be sent to each Deformable Mirror.

setup_logging

setup_logging(logging_level=logging.WARNING)

__del__

__del__()