Model API#

Models represent device interfaces that Bluesky can interact with.

Models offer a subset of Bluesky protocols to execute actions. A minimal recognizable device in RedSun must implement the ModelProtocol protocol.

class sunflare.model.ModelProtocol(*args, **kwargs)#

Minimal required protocol for a recognizable device in RedSun.

Implements the following protocols:

  • HasName

  • HasParent

  • Configurable

abstract configure(name, value)#

Configure the model.

Parameters:
  • name (str) – The name of the configuration parameter to set.

  • value (Any) – The value to set for the configuration parameter.

Return type:

None

abstract describe_configuration()#

Describe the model configuration.

Provides a description of each field of the model configuration.

Returns:

A dictionary with the description of each field of the model configuration.

Return type:

dict[str, DataKey]

abstract property model_info: ModelInfo#

The object associated model information.

Must be a subclass of ModelInfo.

abstract property name: str#

Model identifier.

Used to populate object_keys in the Event DataKey.

See the following link for more information: https://blueskyproject.io/event-model/event-descriptors.html#object-keys

abstract property parent: Any | None#

None, or a reference to a parent device.

Used by the RE to stop duplicate stages.

abstract read_configuration()#

Read the model configuration.

Provides a dictionary with the current values of the model configuration.

Returns:

A dictionary with the current values of the model configuration.

Return type:

dict[str, Reading]