semi_cr.core.lab.station.context package

Submodules

semi_cr.core.lab.station.context.bindings module

class semi_cr.core.lab.station.context.bindings.RuntimeBindingRegistry[source]

Bases: object

bind(static_id: str, runtime_id: str, runtime_object: Any) None[source]
resolve(static_id: str) Any[source]
get_binding(static_id: str) RuntimeBinding[source]
is_bound(static_id: str) bool[source]
items() Iterator[tuple[str, RuntimeBinding]][source]
values() Iterator[RuntimeBinding][source]

semi_cr.core.lab.station.context.config module

semi_cr.core.lab.station.context.config.build_instrument_specs(config: dict[str, Any]) dict[str, InstrumentSpec][source]
semi_cr.core.lab.station.context.config.normalize_qcodes_config(config: dict[str, Any]) dict[str, Any][source]

semi_cr.core.lab.station.context.graph module

class semi_cr.core.lab.station.context.graph.StationGraphBuilder(station: Any)[source]

Bases: object

station: Any
build(static_graph: MultiDiGraph, devices: tuple[Any, ...], instruments: dict[str, Any], bindings: RuntimeBindingRegistry) MultiDiGraph[source]

semi_cr.core.lab.station.context.models module

class semi_cr.core.lab.station.context.models.RuntimeBinding(static_id: str, runtime_id: str, runtime_object: Any)[source]

Bases: object

static_id: str
runtime_id: str
runtime_object: Any
class semi_cr.core.lab.station.context.models.ContextState(*values)[source]

Bases: Enum

CREATED = 1
LOADED = 2
PARTIALLY_CONNECTED = 3
CONNECTED = 4
classmethod __contains__(value)

Return True if value is in cls.

value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls’s members.

classmethod __getitem__(name)

Return the member matching name.

classmethod __iter__()

Return members in definition order.

classmethod __len__()

Return the number of members (no aliases)

semi_cr.core.lab.station.context.runtime module

class semi_cr.core.lab.station.context.runtime.StationContext(station: LabStation, static: StaticStationContext)[source]

Bases: object

Runtime realization of a StaticStationContext.

Construction is intentionally side-effect free.

Lifecycle:

context = StationContext(station, static)

context.load() context.connect()

context.disconnect()

station: LabStation
static: StaticStationContext
property bindings: RuntimeBindingRegistry
resolve_runtime(static_id: str) Any[source]

Resolve a static object ID to its runtime realization.

Runtime resolution is available once bindings have been created, including while the context is being connected.

property instruments: dict[str, Instrument]
property devices: tuple[BaseDevice, ...]
property chips: tuple[Chip, ...]
property pcbs: tuple[PCB, ...]
property connectors: tuple[Connector, ...]
property graph: MultiDiGraph
property modules: dict[str, Any]
property has_runtime: bool
property state: ContextState
property loaded: bool
property connected: bool

True when all configured instruments are connected.

property partially_connected: bool
property connected_instrument_names: tuple[str, ...]
property has_connections: bool

True when at least one instrument owned by this context is currently connected.

load() None[source]

Load the static configuration into the QCoDeS station.

This does not connect to physical instruments.

connect(instruments: str | Iterable[str] | None = None) None[source]

Connect one, several, or all configured instruments.

Parameters:

instruments – QCoDeS instrument config name, iterable of config names, or None to connect all configured instruments.

Examples

context.connect() context.connect(“qdac_1”) context.connect([“qdac_1”, “smu”])

disconnect(instruments: str | Iterable[str] | None = None) None[source]

Disconnect one, several, or all runtime instruments instantiated by this context.

QCoDeS configuration remains loaded.

Parameters:

instruments – Config name, iterable of config names, or None to disconnect all instruments owned by this context.

Examples

context.disconnect() context.disconnect(“qdac_1”) context.disconnect([“qdac_1”, “smu”])

semi_cr.core.lab.station.context.static module

class semi_cr.core.lab.station.context.static.InfrastructureContext(wiring_config: semi_cr.core.lab.station.base.ConfigBundle, electronics_config: semi_cr.core.lab.station.base.ConfigBundle)[source]

Bases: object

wiring_config: ConfigBundle
electronics_config: ConfigBundle
config: ConfigBundle
graph: MultiDiGraph
build_graph() MultiDiGraph[source]
view_graph(what: Literal['nodes', 'edges', 'both'] = 'both', include_attrs: bool = True)[source]
class semi_cr.core.lab.station.context.static.StaticStationContext(device: ConfigContext, infrastructure: InfrastructureContext)[source]

Bases: object

Description of the complete station without talking to hardware.

device: ConfigContext
infrastructure: InfrastructureContext
config: ConfigBundle
instruments: dict[str, InstrumentSpec]
graph: MultiDiGraph

Module contents

class semi_cr.core.lab.station.context.ContextState(*values)[source]

Bases: Enum

CREATED = 1
LOADED = 2
PARTIALLY_CONNECTED = 3
CONNECTED = 4
classmethod __contains__(value)

Return True if value is in cls.

value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls’s members.

classmethod __getitem__(name)

Return the member matching name.

classmethod __iter__()

Return members in definition order.

classmethod __len__()

Return the number of members (no aliases)

class semi_cr.core.lab.station.context.InfrastructureContext(wiring_config: semi_cr.core.lab.station.base.ConfigBundle, electronics_config: semi_cr.core.lab.station.base.ConfigBundle)[source]

Bases: object

wiring_config: ConfigBundle
electronics_config: ConfigBundle
config: ConfigBundle
graph: MultiDiGraph
build_graph() MultiDiGraph[source]
view_graph(what: Literal['nodes', 'edges', 'both'] = 'both', include_attrs: bool = True)[source]
class semi_cr.core.lab.station.context.RuntimeBinding(static_id: str, runtime_id: str, runtime_object: Any)[source]

Bases: object

static_id: str
runtime_id: str
runtime_object: Any
class semi_cr.core.lab.station.context.RuntimeBindingRegistry[source]

Bases: object

bind(static_id: str, runtime_id: str, runtime_object: Any) None[source]
resolve(static_id: str) Any[source]
get_binding(static_id: str) RuntimeBinding[source]
is_bound(static_id: str) bool[source]
items() Iterator[tuple[str, RuntimeBinding]][source]
values() Iterator[RuntimeBinding][source]
class semi_cr.core.lab.station.context.StaticStationContext(device: ConfigContext, infrastructure: InfrastructureContext)[source]

Bases: object

Description of the complete station without talking to hardware.

device: ConfigContext
infrastructure: InfrastructureContext
config: ConfigBundle
instruments: dict[str, InstrumentSpec]
graph: MultiDiGraph
class semi_cr.core.lab.station.context.StationContext(station: LabStation, static: StaticStationContext)[source]

Bases: object

Runtime realization of a StaticStationContext.

Construction is intentionally side-effect free.

Lifecycle:

context = StationContext(station, static)

context.load() context.connect()

context.disconnect()

station: LabStation
static: StaticStationContext
property bindings: RuntimeBindingRegistry
resolve_runtime(static_id: str) Any[source]

Resolve a static object ID to its runtime realization.

Runtime resolution is available once bindings have been created, including while the context is being connected.

property instruments: dict[str, Instrument]
property devices: tuple[BaseDevice, ...]
property chips: tuple[Chip, ...]
property pcbs: tuple[PCB, ...]
property connectors: tuple[Connector, ...]
property graph: MultiDiGraph
property modules: dict[str, Any]
property has_runtime: bool
property state: ContextState
property loaded: bool
property connected: bool

True when all configured instruments are connected.

property partially_connected: bool
property connected_instrument_names: tuple[str, ...]
property has_connections: bool

True when at least one instrument owned by this context is currently connected.

load() None[source]

Load the static configuration into the QCoDeS station.

This does not connect to physical instruments.

connect(instruments: str | Iterable[str] | None = None) None[source]

Connect one, several, or all configured instruments.

Parameters:

instruments – QCoDeS instrument config name, iterable of config names, or None to connect all configured instruments.

Examples

context.connect() context.connect(“qdac_1”) context.connect([“qdac_1”, “smu”])

disconnect(instruments: str | Iterable[str] | None = None) None[source]

Disconnect one, several, or all runtime instruments instantiated by this context.

QCoDeS configuration remains loaded.

Parameters:

instruments – Config name, iterable of config names, or None to disconnect all instruments owned by this context.

Examples

context.disconnect() context.disconnect(“qdac_1”) context.disconnect([“qdac_1”, “smu”])