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.

Unlike FilteredTopicWrapper (which stores data for all different values of a filter field), BaseFilteredFieldWrapper` is specific to a particular value of the filter field. The point is to extract a particular value from a particular subsystem.

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.

descrstr

A brief description of this topic filter wrapper.

value

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

Methods Summary

update_value(data)

Set value from data.

validate(data)

Check the configuration given default topic data.

Methods Documentation

abstract update_value(data)

Set value from data.

The subclass should assume that getattr(data, filter_field) == self.filter_value; it is up to the caller to make sure that is so.

abstract validate(data)

Check the configuration given default topic data.

Raises
ValueError

If validation fails.

Note: the contained topic wrapper checks for the existence of
the filter field, so this method does not have to bother.