MTAOS Developer Guide

This CSC is a ts_salobj based control system integrating the middleware layer and the high-level state machine. The Active Optics System (AOS) algorithms depends on the Wavefront Estimation Pipeline (WEP) and the Optical Feedback Control (OFC) modules: ts_wep and ts_ofc.

Dependencies

Architecture

The classes in module are listed below.

Figure 1 Class diagram of MTAOS

  • MtaosCsc is a CSC class. It inherits from the ts_salobj’s ConfigurableCsc. ts_salobj provides interfaces for the SAL communication.

  • CollOfListOfWfErr: Collection of list of wave-front sensor data.

  • Config: Configuration class. Holds configuration values and provides functions to retrieve the configurable values.

  • Model: Model class containing the ts_wep and ts_ofc interface classes. Together with WEP and OFC it runs the wavefront analysis and corrects the hexapod position and mirror bending mode.

Only the MtaosCsc instance has knowledge of the high-level control logic and middleware layer provided by ConfigurableCsc. The business logic is implemented in the Model. This allows for testing Model without SAL integration.

APIs

This section is autogenerated from docstrings.

lsst.ts.MTAOS Package

Functions

addRotFileHandler(log, filePath, debugLevel)

Add a rotating file handler to a logger.

getCamType(camera)

Get the enum of camera type.

getConfigDir()

Get the directory of configuration files.

getCscName()

Get the CSC name.

getIsrDirPath([isrDirPathVar])

Get the instrument signature removal (ISR) directory path.

getLogDir()

Get the directory of log files.

getModulePath()

Get the path of module.

timeit(func)

Decorator to compute execution time.

Classes

Config(config)

MTAOS([config_dir, log_to_file, log_level, …])

MTHexapodIndex(value)

An enumeration.

Model(instrument, data_path, ofc_data[, …])

OFCWarning(value)

An enumeration.

WEPWarning(value)

An enumeration.

WavefrontCollection(maxLeng)

Build and Test

Using docker is highly recommended. The Docker files can follow various MTAOS Dockerfiles from ts_Dockerfiles.

There are three docker images related to MTAOS: aos_sal, aos_aoclc, and mtaos_sim. The aos_sal image contains the SAL and eups packages used in AOS. The aos_aoclc image contains WEP and OFC packages. The mtaos_sim image contains the ts_MTAOS simulator.

To build and test the CSC using Docker, enter:

docker run -it -v ${repos_location}:/home/saluser/develop lsstts/aos_aoclc:${tag}
make_idl_files.py MTAOS Hexapod MTM1M3 MTM2
cd develop/ts_MTAOS
setup -k -r .
scons

The environment shall be setup either from /home/saluser/.setup.sh or /home/saluser/.setup_dev.sh.

Usage

To start the MTAOS CSC, enter the following command:

python bin/run_mtaos.py

You can setup the path of Instrument Signature Removal (ISR) for the butler to use before running the CSC: export ISRDIRPATH=${path_to_isr_directory}. The butler is the middleware used in scientific pipeline or lsst_distrib package.

You can use the argument of -s to run the simulation mode or -h to get all available argument details. For example, you can use the argument of –logToFile to log messages to a log file. Python logging package is used, with default log level set to DEBUG. The log level can be adjusted with –debugLevel argument.

Stopping the CSC is done by SIG-INTing the process, usually by ctrl + c.

Utilities

This section provide some documentation of the utility methods available in MTAOS.

timeit

MTAOS provides the timeit decorator that allows one compute and store execution times of methods and coroutines. To add the decorator the method must either support kwargs argument or contain an additional parameter named log_time, which must receive a dictionary. The dictionary passed to log_time will receive a new item, with the name of the method in upper case as the key, and a list as value. The decorator will append the execution time to the list every time the method is called.

You can use the timeit decorator as follows:

from lsst.ts.MTAOS import timeit

# timing a regular method.
@timeit
def my_method(arg1, arg2, **kwargs):
  ...


# timing a coroutine
@timeit
async def my_coroutine(arg1, agr2, **kwargs):
  ...

log_time = dict()

ret_val_1 = my_method(arg1=arg1, arg2=arg2, log_time=log_time)

ret_val_2 = await my_coroutine(arg1=arg1, arg2=arg2, log_time=log_time)

The dictionary log_time, will now contain two entries; MY_METHOD and MY_COROUTINE, each containing a list with the execution time of each call.

Contributing

To contribute, please start a new pull request on GitHub. Feature requests shall be filled in JIRA with the ts_MTAOS or MTAOS label. In all cases, reaching out to the contacts for this CSC is recommended.