Protocol

Contents

Protocol#

class pulserver.design.Protocol[source]#

Bases: Mapping[FloatKey | IntKey | BoolKey | EnumKey | ConfigKey | UserKey | UserNameKey, Any]

The values of a plugin’s protocol, in the units of the sequence function’s arguments.

An immutable mapping from ProtocolKey to value. A time is in seconds and a float in the unit of the argument it binds, metres for a length; an integer is an int, a checkbox a bool and a choice a member of its enum. A time entry showing a preset holds what the preset requests, a number of seconds or None for the sequence function’s own shortest choice, and preset() names the preset. The prescription entries bind no argument and keep the units of the wire: mm for the offset, unitless for the rotation.

The wire carries integer microseconds for a time and the entry’s own unit for a float, to six significant digits. from_wire() and to_wire() are the only conversions between the two.

Parameters:
  • entries – The declared entries the values belong to, as SequencePlugin.protocol holds them.

  • values – The value of each key, in argument units.

  • presets – The preset each time key shows, by the key its entry declares it with.

Methods

from_wire

Return the protocol that wire values stand for.

get

items

keys

preset

Return the preset a time key shows, or None where it shows none.

replace

Return a protocol holding changes in place of the values they name.

to_wire

Return the wire values of the protocol, the inverse of from_wire().

values

Attributes

arguments

The values by the name of the sequence function argument each binds.