MTForceError#

class lsst.ts.watcher.rules.MTForceError(config, log=None)#

Bases: PollingRule

Monitor the actuator force error of main telescope M2 is out of the normal range.

Parameters:

Methods Summary

compute_alarm_severity()

Compute and set alarm severity and reason.

get_schema()

Return a jsonschema as a dict, to validate configuration.

setup(model)

Perform post-constructor setup.

Methods Documentation

compute_alarm_severity()#

Compute and set alarm severity and reason.

Return type:

tuple[AlarmSeverity, str] | None

Returns:

  • None, if no change or unknown, or a tuple of two values

  • severity (lsst.ts.xml.enums.Watcher.AlarmSeverity) – The new alarm severity.

  • reason (str) – Detailed reason for the severity, e.g. a string describing what value is out of range, and what the range is. If severity is NONE then this value is ignored (but still required) and the old reason is retained until the alarm is reset to nominal state.

Notes

You may return NoneNoReason if the alarm state is NONE.

classmethod get_schema()#

Return a jsonschema as a dict, to validate configuration.

Return type:

dict[str, Any]

Notes

Please provide default values for all fields for which defaults make sense. This makes watcher configuration files easier to write.

If your rule has no configuration then return None.

We recommend that you write the schema as yaml, for compactness, then use yaml.safe_load to convert it to a dict. For example:

schema_yaml = """
    $schema: http://json-schema.org/draft-07/schema#
    description: Configuration for MyRule
    type: object
    properties:
    ...
    required: [...]
    additionalProperties: false
"""
return yaml.safe_load(schema_yaml)
setup(model)#

Perform post-constructor setup.

Called after the remotes are constructed and populated with topics, but before the remotes have started.

Parameters:

model (Model) – The watcher model.

Return type:

None

Notes

Possible uses:

  • Rules in which topics and/or fields are specified in configuration should check that the topics and/or fields exist. They may also set variables pointing to the appropriate topics.

  • Rules that start a background process may start the process here rather than in the constructor; this is especially helpful if the process needs access to topics or fields.

Few rules require setup, so the default implemention is a no-op.