Source code for semi_cr.core.station.instruments.base

from __future__ import annotations

from abc import ABC, abstractmethod
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from collections.abc import Iterable

    from semi_cr.core.station.graph import GraphEdge, GraphNode


[docs] class LabInstrument(ABC): """Base class for instruments represented by an NQCP station.""" name: str
[docs] def connect(self) -> None: """Connect this instrument when entering a measurement context."""
[docs] def disconnect(self) -> None: """Disconnect this instrument when leaving a measurement context."""
[docs] def is_connected(self) -> bool | None: """Return whether this instrument is connected or not. If the instrument is not connectable it returns None.""" return None
[docs] @abstractmethod def graph_nodes(self) -> Iterable[GraphNode]: """Return nodes contributed to the station graph."""
[docs] @abstractmethod def graph_edges(self) -> Iterable[GraphEdge]: """Return edges contributed to the station graph."""