BaseFilteredFieldWrapper#

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

Bases: 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:
  • model (Model) – Watcher model.

  • topic (lsst.ts.salobj.ReadTopic) – Topic to read.

  • filter_field (str) – Name of filter field.

  • filter_value (str) – Required value of the filter field.

Raises:

ValueError – If field wrapper validation fails.

topic_wrapper#

Topic wrapper for the specified topic.

Type:

TopicWrapper

filter_value#

Value of filter_value constructor argument.

Type:

str

topic_descr#

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.

Type:

str

nelts#

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.

Type:

int

value#

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

timestamp#

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

Type:

float

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:

index (int 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__.