BaseController

class lsst.ts.ofc.BaseController(ofc_data: OFCData, log: logging.Logger | None = None)

Bases: object

Base Controller.

This class is the base class for all the controllers. This class is mainly used to determine the offset (uk) of degree of freedom (DOF) at time k+1 based on the wavefront error (yk) at time k.

Parameters

ofc_dataOFCData

OFC Data.

loglogging.Logger or None

Optional logging class to be used for logging operations. If None, creates a new logger.

Attributes

dof_statenp.array

State of telescope in the basis of degrees of freedom.

dof_state0np.array

Initial state of telescope in the basis of degrees of freedom.

integralnp.array

Integral of the error.

kpfloat

Proportional gain.

kifloat

Integral gain.

kdfloat

Derivative gain.

loglogging.Logger

Logger class used for logging operations.

ofc_dataOFCData

OFC data.

previous_errornp.array

Previous error.

pssn_datadict

PSSN data.

setpointnp.array

Setpoint for the PID controller.

Attributes Summary

ETA

FWHM_ATM

aggregated_state

Returns the aggregated state.

derivative_filter_coeff

Derivative filter coefficient.

kd

Derivative gain.

ki

Integral gain.

kp

Proportional gain.

Methods Summary

aggregate_state(dof, dof_idx)

Aggregate the calculated degree of freedom (DOF) in the state.

calculate_pid_step(state)

Calculate the control signal using PID controller.

control_step(filter_name, dof_state[, ...])

Estimate uk in the basis of degree of freedom (DOF).

effective_fwhm_g4(pssn, sensor_names)

Calculate the effective FWHM by Gaussian quadrature.

fwhm_to_pssn(fwhm)

Convert the FWHM data to PSSN.

reset_dof_state()

Initialize the state to the state 0 in the basis of degree of freedom (DOF).

reset_history()

Reset the history of the controller.

set_fwhm_data(fwhm, sensor_names)

Set the list of FWHMSensorData of each CCD of camera. Parameters ---------- fwhm : np.ndarray[float] Array of arrays (e.g. 2-d array) which contains the FWHM data. Each element contains an array of fwhm (in arcsec) measurements for a particular sensor. sensor_names : list [string] List of sensor names. Raises ------ RuntimeError If size of fwhm and sensor_names are different.

Attributes Documentation

ETA = 1.086
FWHM_ATM = 0.6
aggregated_state

Returns the aggregated state.

Returns

np.ndarray[float]

Aggregated state.

derivative_filter_coeff

Derivative filter coefficient.

Returns

float

Derivative filter coefficient.

kd

Derivative gain.

Returns

float

Derivative gain.

ki

Integral gain.

Returns

float

Integral gain.

kp

Proportional gain.

Methods Documentation

aggregate_state(dof: numpy.ndarray[float] | list, dof_idx: numpy.ndarray[int] | list[int]) None

Aggregate the calculated degree of freedom (DOF) in the state.

Parameters

dofnumpy.ndarray or list

Calculated DOF.

dof_idxnumpy.ndarray or list[int]

Index array of degree of freedom.

calculate_pid_step(state: ndarray[float]) ndarray[float]

Calculate the control signal using PID controller.

Parameters

statenp.ndarray[float]

State of the system.

Returns

uknumpy.ndarray

Calculated uk in the basis of DOF.

control_step(filter_name: str, dof_state: ndarray[float], sensor_names: list[str] | None = None) ndarray[float]

Estimate uk in the basis of degree of freedom (DOF).

Parameters

filter_namestring

Name of the filter.

dof_statenumpy.ndarray

Optical state in the basis of DOF.

sensor_nameslist [string]

List of sensor names.

Raises

NotImplementedError

Child class should implemented this.

effective_fwhm_g4(pssn: ndarray[float], sensor_names: list[str]) float

Calculate the effective FWHM by Gaussian quadrature.

FWHM: Full width at half maximum. FWHM = eta * FWHM_{atm} * sqrt(1/PSSN -1). Effective GQFWHM = sum_{i} (w_{i}* FWHM_{i}).

Parameters

pssnnumpy.ndarray or list

Normalized point source sensitivity (PSSN).

sensor_nameslist [string]

List of sensor names.

Returns

float

Effective FWHM in arcsec by Gaussian quadrature.

Raises

ValueError

Input values are unphysical.

ValueError

Image quality weights sum is zero. Please check your weights.

fwhm_to_pssn(fwhm: ndarray[float]) ndarray[float]

Convert the FWHM data to PSSN.

Take the array of FWHM values (nominally 1 per CCD) and convert it to PSSN (nominally 1 per CCD).

Parameters

fwhmnumpy.ndarray[x]

An array of FWHM values with sensor information.

Returns

pssnnumpy.ndarray[y]

An array of PSSN values.

reset_dof_state() None

Initialize the state to the state 0 in the basis of degree of freedom (DOF).

reset_history() None

Reset the history of the controller.

set_fwhm_data(fwhm: ndarray[float], sensor_names: list[str]) None

Set the list of FWHMSensorData of each CCD of camera. Parameters ———- fwhm : np.ndarray[float]

Array of arrays (e.g. 2-d array) which contains the FWHM data. Each element contains an array of fwhm (in arcsec) measurements for a particular sensor.

sensor_nameslist [string]

List of sensor names.

Raises

RuntimeError

If size of fwhm and sensor_names are different.