REDAC Hybrid Controller Abstraction
- class pybrid.redac.controller.Controller(standalone: bool = False)
Abstraction of the REDAC hybrid controller.
The hybrid controller is an interface to all relevant functions to configure and control the REDAC. It also collects all
Runinstances started with it.The controller object also holds references to the underlying protocol and transport objects and manages them.
- devices: dict[pybrid.redac.entities.Path, pybrid.redac.protocol.protocol.Protocol]
Dictionary of all managed devices identified by their unique entity path. TODO: Remove in favor of protocols below.
- classmethod get_run_implementation() Type[Run]
Returns the specific
Runimplementation used by the REDAC.
- async hack(cmd: str, data: Any) Any
Send the passed data as a ‘hack’ request, only used during development. It allows to pass and receive arbitrary data to and from the hybrid controller.
- async handle_run_data(msg: RunDataMessage, path: Path)
A handler for incoming
RunDataMessagemessages.
- async handle_run_state_change(msg: RunStateChangeMessage, protocol: Protocol)
A handler for incoming
RunStateChangeMessagemessages.
- protocols: dict[pybrid.redac.protocol.protocol.Protocol, set[pybrid.redac.entities.Path]]
Dictionary of protocol connections mapped to entity paths they manage
- async reset(keep_calibration: bool = True, sync: bool = True)
Reset the hybrid controller and the analog computer to its initial configuration.
- Parameters:
keep_calibration – Whether to keep the calibration.
sync – Whether to write the reset values to the hardware.
- Returns:
None
- runs: dict[uuid.UUID, pybrid.redac.run.Run]
List of all runs started by this controller.
- async set_computer(computer: REDAC)
Change the configuration of all carrier boards and sub-entities on the REDAC.
- Parameters:
computer – The
REDACobject containing the configuration to be set.- Returns:
None
- async set_config(entity: Entity)
Change the configuration of a singe entity.
- Parameters:
entity – The entity to change.
- Returns:
None
- async start_and_await_run(run: Optional[Run] = None, timeout=5) Run
A convenience function which starts a run, blocks until it is completed and returns it.
- async start_run(run: Optional[Run] = None, entities: Optional[Iterable[Path]] = None, timeout=3) DistributedRunState
Start a run (computation) on the REDAC. :param run: The
Runto be started, including its configuration. If None, a new run is created. :param entities: Optional list of entities to include in the run. :param timeout: Optional timeout. :return: ADistributedRunStatethat tracks the run’s state.