WriteTopic¶
-
class
lsst.ts.salobj.topics.WriteTopic(*, salinfo, name, sal_prefix, min_seq_num=1, max_seq_num=2147483647, initial_seq_num=None)¶ Bases:
lsst.ts.salobj.topics.base_topic.BaseTopicBase class for topics that are output.
This includes controller events, controller telemetry, remote commands and
cmdackwriters.Parameters: - salinfo :
SalInfo SAL component information
- name :
str Topic name, without a “command_” or “logevent_” prefix.
- sal_prefix :
str SAL topic prefix: one of “command_”, “logevent_” or “”
- min_seq_num :
intorNone Minimum value for the
private_seqNumfield. If None thenprivate_seqNumis not set; this is needed for the cmdack writer, which sets the field itself.- max_seq_num :
int Maximum value for
private_seqNum, inclusive. Ignored ifmin_seq_numis None.- initial_seq_num :
int(optional) Initial sequence number; if
Noneuse min_seq_num.
Attributes: Attributes Summary
DataTypeThe class of data for this topic. dataGet or set internally cached data. has_dataHas dataever been set?metadataGet topic metadata as a TopicMetadata, if available, elseNone.Methods Summary
close()Shut down and release resources. put([data, priority])Output this topic. set(**kwargs)Set one or more fields of self.data.Attributes Documentation
-
DataType¶ The class of data for this topic.
-
data¶ Get or set internally cached data.
Parameters: - data :
DataType New data.
Raises: - TypeError
If
datais not an instance ofDataType
Notes
You must not modify the returned data, nor assume that it will be constant. If you need a copy then make it yourself.
- data :
Methods Documentation
-
close()¶ Shut down and release resources.
Intended to be called by SalInfo.close(), since that tracks all topics.
-
put(data=None, priority=0)¶ Output this topic.
Parameters: Raises: - TypeError
If
datais not None and not an instance ofDataType.
-
set(**kwargs)¶ Set one or more fields of
self.data.Parameters: - **kwargs :
dict[str,any] Dict of field name: new value for that field:
- Any key whose value is
Noneis checked for existence, but the value of the field is not changed. - If the field being set is an array then the value must either be an array of the same length or a scalar (which replaces every element of the array).
- Any key whose value is
Returns: Raises: - AttributeError
If the topic does not have the specified field.
- ValueError
If the field cannot be set to the specified value.
Notes
If one or more fields cannot be set, the data may be partially updated. This is not ideal, but is pragmatic because it is difficult to copy SAL topics (see TSS-3195).
- **kwargs :
- salinfo :