BaseFilteredFieldWrapper

class lsst.ts.watcher.BaseFilteredFieldWrapper(model, topic, filter_field, filter_value)

Bases: abc.ABC

Base class for filtered field wrappers.

Extract and cache the most recent value of a topic field for data that matches a specified filter.

See also FieldWrapperList to hold a collection of related filtered field wrappers.

Parameters
modelModel

Watcher model.

topiclsst.ts.salobj.ReadTopic

Topic to read.

filter_fieldstr

Name of filter field.

filter_valuestr

Required value of the filter field.

Raises
ValueError

If field wrapper validation fails.

Attributes
topic_wrapperTopicWrapper

Topic wrapper for the specified topic.

filter_valuestr

Value of filter_value constructor argument.

topic_descrstr

A brief description of this topic, including SAL name and index, topic attribute name, filter_field, and filter_value. Does not include any information about the field; subclasses are responsible for handling that in get_value_descr.

neltsint

The number of elements in value, if it is a list, else None. This is based on the topic schema; it has nothing to do with whether or not any data has been seen for the topic.

value

The most recently seen value for this field, or None if data has never been seen.

timestampfloat

The time the data was last set (TAI unix seconds); None until set.

Methods Summary

get_value_descr(index)

Get a description for a value.

update_value(data)

Set value from DDS data.

Methods Documentation

abstract get_value_descr(index)

Get a description for a value.

The description should include a high-level description, if available, plus details of which field provided the data (if not synthesized), and self.topic_descr.

Parameters
indexint or None

The index of the value; must be None for a scalar.

Raises
RuntimeError

If the field is indexed and the index is None or out of range. If the field is not indexed and the index is not None.

abstract update_value(data)

Set value from DDS data.

Do not set the timestamp field, and do not check that getattr(data, filter_field) == self.filter_value; both of these are done by the caller: FilteredTopicWrapper.__call__.