Source code for semi_cr.core.station.drivers
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING
from semi_cr.core.station.units import VoltageLike
if TYPE_CHECKING:
import qcodes
[docs]
class DCDriver(ABC):
[docs]
@abstractmethod
def set_voltage(self, voltage: VoltageLike) -> None:
"""Set the voltage of the DC driver."""
raise NotImplementedError()
[docs]
def get_voltage(self) -> VoltageLike:
"""Get the current set voltage of the DC driver. This is a readback of a DAC, not a measurement."""
raise NotImplementedError()
[docs]
def get_voltage_parameter(self, name: str = "voltage") -> "qcodes.Parameter":
"""Convenience method to allow QCoDeS control of the voltage on this terminal.
:param name: QCoDeS parameter name; must be a valid identifier.
"""
# Let's only import qcodes if we need it.
import qcodes # noqa: PLC0415
return qcodes.Parameter(
name=name,
unit="V",
set_cmd=self.set_voltage,
get_cmd=self.get_voltage,
)