Source code for semi_cr.core.station.measurement_context
from __future__ import annotations
from types import TracebackType
from qcodes import Instrument
from semi_cr.core.station.station import NQCPStation
[docs]
class NQCPStationMeasurementContext:
""":class:`NQCPStation` makes an object like this for wrapping a measurement of some type. It connects to the
relevant instruments. In the future this would also be the place for some telemetry or automated aggregation of
data."""
station: NQCPStation
_connected_instruments: list[str]
def __init__(self, station: NQCPStation):
self.station = station
self._connected_instruments = []
def __enter__(self) -> NQCPStationMeasurementContext:
# TODO: Promote the QCoDeS instrument stubs to actual QCoDeS instruments.
raise NotImplementedError("This is a stub implementation.")
def __exit__(self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None):
# TODO: Clean up here, maybe let go of a semaphore?
raise NotImplementedError("This is a stub implementation.")
[docs]
def connect(self, instrument_name: str) -> Instrument:
"""
Just s stub for now: Connect to a live instrument by name.
This method is intended to be used within the context of a `with` statement, ensuring that the instrument is
properly managed and disconnected when no longer needed.
"""
self._connected_instruments.append(instrument_name)
raise NotImplementedError("This is a stub implementation.")