diff --git a/docs/changes/newsfragments/6160.improved_driver b/docs/changes/newsfragments/6160.improved_driver new file mode 100644 index 00000000000..f01dc267fef --- /dev/null +++ b/docs/changes/newsfragments/6160.improved_driver @@ -0,0 +1,6 @@ +The Minicircuits, Oxford, QDev, QuantumDesign, Rigol and Rohde & Schwarz drivers shipping with QCoDeS +have been updated to ensure all Parameters are set as static +attributes that are documented and can be type checked. The docs for the same drivers have been +updated to not document inherited members. This makes the documentation significantly more readable +as it focuses on specific members for a given instrument. The documentation now also links superclasses. +Please consult these for inherited members. diff --git a/docs/drivers_api/Minicircuits.rst b/docs/drivers_api/Minicircuits.rst index 0044e010aec..09c0aca05ad 100644 --- a/docs/drivers_api/Minicircuits.rst +++ b/docs/drivers_api/Minicircuits.rst @@ -5,3 +5,4 @@ MiniCircuits Drivers .. automodule:: qcodes.instrument_drivers.Minicircuits :autosummary: + :no-inherited-members: diff --git a/docs/drivers_api/Oxford.rst b/docs/drivers_api/Oxford.rst index 641e2d423b1..23bc0e0d78e 100644 --- a/docs/drivers_api/Oxford.rst +++ b/docs/drivers_api/Oxford.rst @@ -5,3 +5,4 @@ Oxford Instruments Drivers .. automodule:: qcodes.instrument_drivers.oxford :autosummary: + :no-inherited-members: diff --git a/docs/drivers_api/QDev.rst b/docs/drivers_api/QDev.rst index bd7e0f6f78d..50435e08640 100644 --- a/docs/drivers_api/QDev.rst +++ b/docs/drivers_api/QDev.rst @@ -5,3 +5,4 @@ QDev Drivers .. automodule:: qcodes.instrument_drivers.QDev :autosummary: + :no-inherited-members: diff --git a/docs/drivers_api/QuantumDesign.rst b/docs/drivers_api/QuantumDesign.rst index e5d1fb36318..a7f178dd9f8 100644 --- a/docs/drivers_api/QuantumDesign.rst +++ b/docs/drivers_api/QuantumDesign.rst @@ -5,3 +5,4 @@ Quantum Design Drivers .. automodule:: qcodes.instrument_drivers.QuantumDesign :autosummary: + :no-inherited-members: diff --git a/docs/drivers_api/Rigol.rst b/docs/drivers_api/Rigol.rst index 0806f45a54b..c3fb72fd5f1 100644 --- a/docs/drivers_api/Rigol.rst +++ b/docs/drivers_api/Rigol.rst @@ -5,3 +5,4 @@ Rigol Drivers .. automodule:: qcodes.instrument_drivers.rigol :autosummary: + :no-inherited-members: diff --git a/docs/drivers_api/RohdeSchwarz.rst b/docs/drivers_api/RohdeSchwarz.rst index 9ff4f265235..2d65fb715d6 100644 --- a/docs/drivers_api/RohdeSchwarz.rst +++ b/docs/drivers_api/RohdeSchwarz.rst @@ -5,3 +5,4 @@ Rohde & Schwarz Drivers .. automodule:: qcodes.instrument_drivers.rohde_schwarz :autosummary: + :no-inherited-members: diff --git a/src/qcodes/instrument_drivers/Minicircuits/Base_SPDT.py b/src/qcodes/instrument_drivers/Minicircuits/Base_SPDT.py index 952152e7393..d7177f0c16e 100644 --- a/src/qcodes/instrument_drivers/Minicircuits/Base_SPDT.py +++ b/src/qcodes/instrument_drivers/Minicircuits/Base_SPDT.py @@ -5,21 +5,26 @@ import warnings from typing import TYPE_CHECKING, Any +from typing_extensions import deprecated + from qcodes.instrument import ( ChannelList, Instrument, InstrumentBaseKWArgs, InstrumentChannel, ) +from qcodes.utils import QCoDeSDeprecationWarning from qcodes.validators import Ints if TYPE_CHECKING: from typing_extensions import Unpack + from qcodes.parameters import Parameter + log = logging.getLogger(__name__) -class SwitchChannelBase(InstrumentChannel): +class MiniCircuitsSPDTSwitchChannelBase(InstrumentChannel): def __init__( self, parent: Instrument, @@ -28,6 +33,9 @@ def __init__( **kwargs: Unpack[InstrumentBaseKWArgs], ): """ + Base class for MiniCircuits SPDT Switch channels. + Should not be instantiated directly. + Args: parent: The instrument the channel is a part of name: the name of the channel @@ -40,12 +48,13 @@ def __init__( _chanlist = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] self.channel_number = _chanlist.index(channel_letter) - self.add_parameter( + self.switch: Parameter = self.add_parameter( 'switch', label=f'switch {self.channel_letter}', set_cmd=self._set_switch, get_cmd=self._get_switch, vals=Ints(1, 2)) + """Parameter switch""" def __call__(self, *args: int) -> int | None: if len(args) == 1: @@ -63,10 +72,21 @@ def _set_switch(self, switch: int) -> None: def _get_switch(self) -> int: raise NotImplementedError() +@deprecated( + "Deprecated alias, use MiniCircuitsSPDTSwitchChannelBase.", + category=QCoDeSDeprecationWarning, +) +class SwitchChannelBase(MiniCircuitsSPDTSwitchChannelBase): + pass + -class SPDT_Base(Instrument): +class MiniCircuitsSPDTBase(Instrument): + """ + Base class for MiniCircuits SPDT Switch instruments. + Should not be instantiated directly. + """ - CHANNEL_CLASS: type[SwitchChannelBase] + CHANNEL_CLASS: type[MiniCircuitsSPDTSwitchChannelBase] def add_channels(self) -> None: channels = ChannelList( @@ -136,3 +156,11 @@ def get_number_of_channels(self) -> int: f" the model '{model}', it might not be supported" ) return int(channels) + + +@deprecated( + "Deprecated alias, use MiniCircuitsSPDTBase.", + category=QCoDeSDeprecationWarning, +) +class SPDT_Base(MiniCircuitsSPDTBase): + pass diff --git a/src/qcodes/instrument_drivers/Minicircuits/USBHIDMixin.py b/src/qcodes/instrument_drivers/Minicircuits/USBHIDMixin.py index 4c3af50d3af..98b323e3c18 100644 --- a/src/qcodes/instrument_drivers/Minicircuits/USBHIDMixin.py +++ b/src/qcodes/instrument_drivers/Minicircuits/USBHIDMixin.py @@ -6,6 +6,10 @@ import time from typing import TYPE_CHECKING, Optional +from typing_extensions import deprecated + +from qcodes.utils import QCoDeSDeprecationWarning + try: from pywinusb import hid # pyright: ignore[reportMissingModuleSource] @@ -23,6 +27,10 @@ from qcodes.instrument import InstrumentBaseKWArgs +@deprecated( + "USBHIDMixin is deprecated. This is unused in QCoDeS", + category=QCoDeSDeprecationWarning, +) class USBHIDMixin(Instrument): # The following class attributes should be set by subclasses @@ -164,7 +172,22 @@ def enumerate_devices(cls) -> list[str]: return [dev.instance_id for dev in devs] -class MiniCircuitsHIDMixin(USBHIDMixin): +class MiniCircuitsHIDMixin(Instrument): + # The following class attributes should be set by subclasses + vendor_id = 0x0000 + product_id = 0x0000 + + @staticmethod + def _check_hid_import() -> None: + if os.name != "nt": + raise ImportError("This driver only works on Windows.") + + if imported_hid is False: + raise ImportError( + "pywinusb is not installed. Please install it by typing " + "'pip install pywinusb' in a qcodes environment terminal" + ) + def __init__( self, name: str, @@ -188,13 +211,110 @@ def __init__( timeout: Specify a timeout for this instrument in seconds **kwargs: Forwarded to base class. """ + self._check_hid_import() + # USB interrupt code for sending SCPI commands self._sending_scpi_cmds_code = 1 self._usb_endpoint = 0 self._end_of_message = b"\x00" self.packet_size = 64 - super().__init__(name, instance_id, timeout, **kwargs) + devs = hid.HidDeviceFilter( # pyright: ignore[reportPossiblyUnboundVariable] + product_id=self.product_id, + vendor_id=self.vendor_id, + instance_id=instance_id, + ).get_devices() + + if len(devs) == 0: + raise RuntimeError("No instruments found!") + elif len(devs) > 1: + raise RuntimeError( + "Multiple HID devices detected! Please supply a instance id" + ) + + self._device = devs[0] + self._device.open() + + self._data_buffer: Optional[bytes] = None + self._device.set_raw_data_handler(self._handler) + + self._timeout = timeout + self._tries_per_second = 5 + + super().__init__(name, **kwargs) + + def _handler(self, data: bytes) -> None: + self._data_buffer = data + + def _get_data_buffer(self) -> Optional[bytes]: + data = self._data_buffer + self._data_buffer = None + return data + + def write_raw(self, cmd: str) -> None: + """ + Send a string command to the human interface device + + The given command is processed by `_pack_string` method to return a + byte sequence that is going to be actually sent to the device. + Subclasses must implement `_pack_string` method. + + Args: + cmd: a command to send in a form of a string + """ + data = self._pack_string(cmd) + + result = self._device.send_output_report(data) + if not result: + raise RuntimeError(f"Communication with device failed for command {cmd}") + + def ask_raw(self, cmd: str) -> str: + """ + Send a string command to the human interface device and wait for a reply + + The given command is processed by `_pack_string` method to return a + byte sequence that is going to be actually sent to the device. + Subclasses must implement `_pack_string` method. + + The byte sequence of the reply is processed by `_unpack_string` + method, and the resulting string is returned. Subclasses must + implement `_unpack_string` method. + + Args: + cmd: a command to send in a form of a string + """ + self.write_raw(cmd) + + number_of_tries = int(self._tries_per_second * self._timeout) + + response = None + for _ in range(number_of_tries): + time.sleep(1 / self._tries_per_second) + response = self._get_data_buffer() + if response is not None: + break + + if response is None: + raise TimeoutError(f"Timed out for command {cmd}") + + return self._unpack_string(response) + + def close(self) -> None: + self._device.close() + + @classmethod + def enumerate_devices(cls) -> list[str]: + """ + This method returns the 'instance_id's of all connected devices for + with the given product and vendor IDs. + """ + cls._check_hid_import() + + devs = hid.HidDeviceFilter( # pyright: ignore[reportPossiblyUnboundVariable] + porduct_id=cls.product_id, vendor_id=cls.vendor_id + ).get_devices() + + return [dev.instance_id for dev in devs] def _pack_string(self, cmd: str) -> bytes: """ diff --git a/src/qcodes/instrument_drivers/Minicircuits/__init__.py b/src/qcodes/instrument_drivers/Minicircuits/__init__.py index a97d608907a..82ffa06261f 100644 --- a/src/qcodes/instrument_drivers/Minicircuits/__init__.py +++ b/src/qcodes/instrument_drivers/Minicircuits/__init__.py @@ -1,10 +1,15 @@ from ._minicircuits_rc_sp4t import MiniCircuitsRCSP4T, MiniCircuitsRCSP4TChannel from ._minicircuits_rc_spdt import MiniCircuitsRCSPDT, MiniCircuitsRCSPDTChannel -from ._minicircuits_rudat_13g_90 import MiniCircuitsRudat13G90Usb +from ._minicircuits_rudat_13g_90 import ( + MiniCircuitsRudat13G90Base, + MiniCircuitsRudat13G90Usb, +) from ._minicircuits_usb_spdt import ( MiniCircuitsUsbSPDT, MiniCircuitsUsbSPDTSwitchChannel, ) +from .Base_SPDT import MiniCircuitsSPDTBase, MiniCircuitsSPDTSwitchChannelBase +from .USBHIDMixin import MiniCircuitsHIDMixin __all__ = [ "MiniCircuitsRCSP4T", @@ -12,6 +17,10 @@ "MiniCircuitsRCSPDT", "MiniCircuitsRCSPDTChannel", "MiniCircuitsRudat13G90Usb", + "MiniCircuitsRudat13G90Base", + "MiniCircuitsHIDMixin", "MiniCircuitsUsbSPDT", + "MiniCircuitsSPDTBase", "MiniCircuitsUsbSPDTSwitchChannel", + "MiniCircuitsSPDTSwitchChannelBase", ] diff --git a/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rc_sp4t.py b/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rc_sp4t.py index 4a96f0d6917..43c24118ce4 100644 --- a/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rc_sp4t.py +++ b/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rc_sp4t.py @@ -12,6 +12,8 @@ if TYPE_CHECKING: from typing_extensions import Unpack + from qcodes.parameters import Parameter + class MiniCircuitsRCSP4TChannel(InstrumentChannel): def __init__( @@ -34,13 +36,14 @@ def __init__( chanlist = ["a", "b"] self.channel_number = chanlist.index(channel_letter) - self.add_parameter( + self.switch: Parameter = self.add_parameter( "switch", label="switch", set_cmd=self._set_switch, get_cmd=self._get_switch, vals=vals.Ints(0, 4), ) + """Parameter switch""" def _set_switch(self, switch: int) -> None: if len(self._parent.channels) > 1: diff --git a/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rc_spdt.py b/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rc_spdt.py index 32c4e238e69..8ca6277a738 100644 --- a/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rc_spdt.py +++ b/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rc_spdt.py @@ -11,6 +11,8 @@ if TYPE_CHECKING: from typing_extensions import Unpack + from qcodes.parameters import Parameter + class MiniCircuitsRCSPDTChannel(InstrumentChannel): def __init__( @@ -33,13 +35,14 @@ def __init__( _chanlist = ["a", "b", "c", "d", "e", "f", "g", "h"] self.channel_number = _chanlist.index(channel_letter) - self.add_parameter( + self.switch: Parameter = self.add_parameter( "switch", label="switch", set_cmd=self._set_switch, get_cmd=self._get_switch, vals=vals.Ints(1, 2), ) + """Parameter switch""" def _set_switch(self, switch: int) -> None: self.write(f"SET{self.channel_letter}={switch-1}") diff --git a/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rudat_13g_90.py b/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rudat_13g_90.py index 85f02c71fb7..01f0ec120d3 100644 --- a/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rudat_13g_90.py +++ b/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rudat_13g_90.py @@ -7,34 +7,49 @@ if TYPE_CHECKING: from typing_extensions import Unpack + from qcodes.parameters import Parameter + class MiniCircuitsRudat13G90Base(Instrument): def __init__(self, name: str, **kwargs: "Unpack[InstrumentBaseKWArgs]") -> None: """ + Base class for drivers for MiniCircuits RUDAT-13G-90 + Should not be instantiated directly. + Args: name: Name of the instrument **kwargs: Forwarded to base class. """ super().__init__(name, **kwargs) - self.add_parameter("model_name", get_cmd=":MN?") + self.model_name: Parameter = self.add_parameter("model_name", get_cmd=":MN?") + """Parameter model_name""" - self.add_parameter("serial_number", get_cmd=":SN?") + self.serial_number: Parameter = self.add_parameter( + "serial_number", get_cmd=":SN?" + ) + """Parameter serial_number""" - self.add_parameter("firmware", get_cmd=":FIRMWARE?") + self.firmware: Parameter = self.add_parameter("firmware", get_cmd=":FIRMWARE?") + """Parameter firmware""" - self.add_parameter( + self.attenuation: Parameter = self.add_parameter( "attenuation", set_cmd=":SETATT={}", get_cmd=":ATT?", get_parser=float ) + """Parameter attenuation""" - self.add_parameter( + self.startup_attenuation: Parameter = self.add_parameter( "startup_attenuation", set_cmd=":STARTUPATT:VALUE:{}", get_cmd=":STARTUPATT:VALUE?", get_parser=float, ) + """Parameter startup_attenuation""" - self.add_parameter("hop_points", get_cmd="HOP:POINTS?", get_parser=int) + self.hop_points: Parameter = self.add_parameter( + "hop_points", get_cmd="HOP:POINTS?", get_parser=int + ) + """Parameter hop_points""" self.connect_message() diff --git a/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_usb_spdt.py b/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_usb_spdt.py index f9bb063c36d..f43e97cced8 100644 --- a/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_usb_spdt.py +++ b/src/qcodes/instrument_drivers/Minicircuits/_minicircuits_usb_spdt.py @@ -3,8 +3,8 @@ # QCoDeS imports from qcodes.instrument_drivers.Minicircuits.Base_SPDT import ( - SPDT_Base, - SwitchChannelBase, + MiniCircuitsSPDTBase, + MiniCircuitsSPDTSwitchChannelBase, ) if TYPE_CHECKING: @@ -22,7 +22,7 @@ ) -class MiniCircuitsUsbSPDTSwitchChannel(SwitchChannelBase): +class MiniCircuitsUsbSPDTSwitchChannel(MiniCircuitsSPDTSwitchChannelBase): def _set_switch(self, switch: int) -> None: self._parent.switch.Set_Switch(self.channel_letter, switch - 1) @@ -31,7 +31,7 @@ def _get_switch(self) -> int: return int(f"{status:04b}"[-1 - self.channel_number]) + 1 -class MiniCircuitsUsbSPDT(SPDT_Base): +class MiniCircuitsUsbSPDT(MiniCircuitsSPDTBase): CHANNEL_CLASS = MiniCircuitsUsbSPDTSwitchChannel PATH_TO_DRIVER = r"mcl_RF_Switch_Controller64" PATH_TO_DRIVER_45 = r"mcl_RF_Switch_Controller_NET45" diff --git a/src/qcodes/instrument_drivers/QDev/QDac_channels.py b/src/qcodes/instrument_drivers/QDev/QDac_channels.py index a13353fa00d..24d51c49b9b 100644 --- a/src/qcodes/instrument_drivers/QDev/QDac_channels.py +++ b/src/qcodes/instrument_drivers/QDev/QDac_channels.py @@ -25,6 +25,8 @@ from typing_extensions import Unpack + from qcodes.parameters import Parameter + log = logging.getLogger(__name__) @@ -52,72 +54,89 @@ def __init__( channum: The number of the channel in question (1-48) **kwargs: Forwarded to base class. """ - super().__init__(parent, name) + super().__init__(parent, name, **kwargs) # Validate the channel self._CHANNEL_VALIDATION.validate(channum) # Add the parameters - self.add_parameter('v', - label=f'Channel {channum} voltage', - unit='V', - set_cmd=partial(self._parent._set_voltage, channum), - get_cmd=partial(self._parent._get_voltage, channum), - get_parser=float, - vals=vals.Numbers(-10, 10) - ) - - self.add_parameter('vrange', - label=f'Channel {channum} atten.', - set_cmd=partial(self._parent._set_vrange, channum), - get_cmd=partial(self._parent._get_vrange, channum), - vals=vals.Enum(0, 1) - ) - - self.add_parameter('i', - label=f'Channel {channum} current', - get_cmd=f'get {channum}', - unit='A', - get_parser=self._parent._current_parser - ) - - self.add_parameter('irange', - label=f'Channel {channum} irange', - set_cmd=f'cur {channum} {{}}', - get_cmd=f'cur {channum}', - get_parser=int - ) - - self.add_parameter('slope', - label=f'Channel {channum} slope', - unit='V/s', - set_cmd=partial(self._parent._setslope, channum), - get_cmd=partial(self._parent._getslope, channum), - vals=vals.MultiType(vals.Enum('Inf'), - vals.Numbers(1e-3, 100)) - ) - - self.add_parameter('sync', - label=f'Channel {channum} sync output', - set_cmd=partial(self._parent._setsync, channum), - get_cmd=partial(self._parent._getsync, channum), - vals=vals.Ints(0, 5) - ) - - self.add_parameter(name='sync_delay', - label=f'Channel {channum} sync pulse delay', - unit='s', - get_cmd=None, set_cmd=None, - initial_value=0 - ) - - self.add_parameter(name='sync_duration', - label=f'Channel {channum} sync pulse duration', - unit='s', - get_cmd=None, set_cmd=None, - initial_value=0.01 - ) + self.v: Parameter = self.add_parameter( + "v", + label=f"Channel {channum} voltage", + unit="V", + set_cmd=partial(self._parent._set_voltage, channum), + get_cmd=partial(self._parent._get_voltage, channum), + get_parser=float, + vals=vals.Numbers(-10, 10), + ) + """Parameter v""" + + self.vrange: Parameter = self.add_parameter( + "vrange", + label=f"Channel {channum} atten.", + set_cmd=partial(self._parent._set_vrange, channum), + get_cmd=partial(self._parent._get_vrange, channum), + vals=vals.Enum(0, 1), + ) + """Parameter vrange""" + + self.i: Parameter = self.add_parameter( + "i", + label=f"Channel {channum} current", + get_cmd=f"get {channum}", + unit="A", + get_parser=self._parent._current_parser, + ) + """Parameter i""" + + self.irange: Parameter = self.add_parameter( + "irange", + label=f"Channel {channum} irange", + set_cmd=f"cur {channum} {{}}", + get_cmd=f"cur {channum}", + get_parser=int, + ) + """Parameter irange""" + + self.slope: Parameter = self.add_parameter( + "slope", + label=f"Channel {channum} slope", + unit="V/s", + set_cmd=partial(self._parent._setslope, channum), + get_cmd=partial(self._parent._getslope, channum), + vals=vals.MultiType(vals.Enum("Inf"), vals.Numbers(1e-3, 100)), + ) + """Parameter slope""" + + self.sync: Parameter = self.add_parameter( + "sync", + label=f"Channel {channum} sync output", + set_cmd=partial(self._parent._setsync, channum), + get_cmd=partial(self._parent._getsync, channum), + vals=vals.Ints(0, 5), + ) + """Parameter sync""" + + self.sync_delay: Parameter = self.add_parameter( + name="sync_delay", + label=f"Channel {channum} sync pulse delay", + unit="s", + get_cmd=None, + set_cmd=None, + initial_value=0, + ) + """Parameter sync_delay""" + + self.sync_duration: Parameter = self.add_parameter( + name="sync_duration", + label=f"Channel {channum} sync pulse duration", + unit="s", + get_cmd=None, + set_cmd=None, + initial_value=0.01, + ) + """Parameter sync_duration""" def snapshot_base( self, @@ -274,14 +293,16 @@ def __init__( get_cmd=f'tem {board} {sensor}', get_parser=self._num_verbose) - self.add_parameter(name='cal', - set_cmd='cal {}', - vals=self.channel_validator) + self.cal: Parameter = self.add_parameter( + name="cal", set_cmd="cal {}", vals=self.channel_validator + ) + """Parameter cal""" # TO-DO: maybe it's too dangerous to have this settable. # And perhaps ON is a better verbose mode default? - self.add_parameter(name='verbose', - set_cmd='ver {}', - val_mapping={True: 1, False: 0}) + self.verbose: Parameter = self.add_parameter( + name="verbose", set_cmd="ver {}", val_mapping={True: 1, False: 0} + ) + """Parameter verbose""" # Initialise the instrument, all channels DC (unbind func. generators) for chan in self.chan_range: diff --git a/src/qcodes/instrument_drivers/QuantumDesign/DynaCoolPPMS/DynaCool.py b/src/qcodes/instrument_drivers/QuantumDesign/DynaCoolPPMS/DynaCool.py index 1a48370caf0..016b76207bc 100644 --- a/src/qcodes/instrument_drivers/QuantumDesign/DynaCoolPPMS/DynaCool.py +++ b/src/qcodes/instrument_drivers/QuantumDesign/DynaCoolPPMS/DynaCool.py @@ -21,6 +21,8 @@ if TYPE_CHECKING: from typing_extensions import Unpack + from qcodes.parameters import Parameter + class DynaCool(VisaInstrument): """ @@ -59,147 +61,186 @@ def __init__( ) -> None: super().__init__(name=name, address=address, **kwargs) - self.add_parameter('temperature', - label='Temperature', - unit='K', - get_parser=partial(DynaCool._pick_one, 1, float), - get_cmd='TEMP?') + self.temperature: Parameter = self.add_parameter( + "temperature", + label="Temperature", + unit="K", + get_parser=partial(DynaCool._pick_one, 1, float), + get_cmd="TEMP?", + ) + """Parameter temperature""" # Note: from the Lyngby Materials Lab, we have been told that the # manual is wrong about the minimal temperature. The manual says # 1.8 K, but it is in fact 1.6 K - self.add_parameter('temperature_setpoint', - label='Temperature setpoint', - unit='K', - vals=vals.Numbers(1.6, 400), - set_cmd=partial(self._temp_setter, - 'temperature_setpoint'), - get_cmd=partial(self._temp_getter, - 'temperature_setpoint')) - - self.add_parameter('temperature_rate', - label='Temperature settle rate', - unit='K/s', - vals=vals.Numbers(0.0002, 0.3), - set_parser=lambda x: x*60, # conversion to K/min - get_parser=lambda x: x/60, # conversion to K/s - set_cmd=partial(self._temp_setter, - 'temperature_rate'), - get_cmd=partial(self._temp_getter, - 'temperature_rate')) - - self.add_parameter('temperature_settling', - label='Temperature settling mode', - val_mapping={'fast settle': 0, - 'no overshoot': 1}, - set_cmd=partial(self._temp_setter, - 'temperature_settling'), - get_cmd=partial(self._temp_getter, - 'temperature_settling')) - - self.add_parameter('temperature_state', - label='Temperature tracking state', - val_mapping={"tracking": 2, - 'stable': 1, - 'near': 5, - 'chasing': 6, - 'pot operation': 7, - 'standby': 10, - 'diagnostic': 13, - 'impedance control error': 14, - 'failure': 15}, - get_parser=partial(DynaCool._pick_one, 2, int), - get_cmd='TEMP?') - - self.add_parameter('field_measured', - label='Field', - unit='T', - get_cmd=self._measured_field_getter) - - self.add_parameter('field_target', - label='Field target', - unit='T', - get_cmd=None, - set_cmd=None, - vals=vals.Numbers(-14, 14)) - - self.add_parameter('field_ramp', - label='Field [ramp]', - unit='T', - get_cmd=None, - set_cmd=self._field_ramp_setter, - vals=vals.Numbers(-14, 14)) - - self.add_parameter('field_rate', - label='Field rate', - unit='T/s', - get_parser=lambda x: x*1e-4, # Oe to T - set_parser=lambda x: x*1e4, # T to Oe - set_cmd=None, - get_cmd=None, - initial_value=0, - vals=vals.Numbers(0, 1)) - - self.add_parameter('field_approach', - label='Field ramp approach', - val_mapping={'linear': 0, - 'no overshoot': 1, - 'oscillate': 2}, - set_cmd=None, - get_cmd=None, - initial_value='linear') - - self.add_parameter('magnet_state', - label='Magnet state', - val_mapping={'unknown': 0, - 'stable': 1, - 'switch warming': 2, - 'switch cool': 3, - 'holding': 4, - 'iterate': 5, - 'ramping': 6, - 'ramping ': 7, # map must have inverse - 'resetting': 8, - 'current error': 9, - 'switch error': 10, - 'quenching': 11, - 'charging error': 12, - 'power supply error': 14, - 'failure': 15}, - get_parser=partial(DynaCool._pick_one, 2, int), - get_cmd='FELD?') - - self.add_parameter('chamber_temperature', - label='Chamber Temperature', - unit='K', - get_parser=partial(DynaCool._pick_one, 1, float), - get_cmd='CHAT?') - - self.add_parameter('chamber_state', - label='Chamber vacuum state', - val_mapping={'purged and sealed': 1, - 'vented and sealed': 2, - 'sealed': 3, - 'performing purge/seal': 4, - 'performing vent/seal': 5, - 'pre-high vacuum': 6, - 'high vacuum': 7, - 'pumping continuously': 8, - 'flooding continuously': 9}, - get_parser=partial(DynaCool._pick_one, 1, int), - get_cmd='CHAM?') - - self.add_parameter('field_tolerance', - label="Field Tolerance", - unit='T', - get_cmd=None, - set_cmd=None, - vals=vals.Numbers(0, 1e-2), - set_parser=float, - docstring="The tolerance below which fields are " - "considered identical in a " - "blocking ramp.", - initial_value=5e-4) + self.temperature_setpoint: Parameter = self.add_parameter( + "temperature_setpoint", + label="Temperature setpoint", + unit="K", + vals=vals.Numbers(1.6, 400), + set_cmd=partial(self._temp_setter, "temperature_setpoint"), + get_cmd=partial(self._temp_getter, "temperature_setpoint"), + ) + """Parameter temperature_setpoint""" + + self.temperature_rate: Parameter = self.add_parameter( + "temperature_rate", + label="Temperature settle rate", + unit="K/s", + vals=vals.Numbers(0.0002, 0.3), + set_parser=lambda x: x * 60, # conversion to K/min + get_parser=lambda x: x / 60, # conversion to K/s + set_cmd=partial(self._temp_setter, "temperature_rate"), + get_cmd=partial(self._temp_getter, "temperature_rate"), + ) + """Parameter temperature_rate""" + + self.temperature_settling: Parameter = self.add_parameter( + "temperature_settling", + label="Temperature settling mode", + val_mapping={"fast settle": 0, "no overshoot": 1}, + set_cmd=partial(self._temp_setter, "temperature_settling"), + get_cmd=partial(self._temp_getter, "temperature_settling"), + ) + """Parameter temperature_settling""" + + self.temperature_state: Parameter = self.add_parameter( + "temperature_state", + label="Temperature tracking state", + val_mapping={ + "tracking": 2, + "stable": 1, + "near": 5, + "chasing": 6, + "pot operation": 7, + "standby": 10, + "diagnostic": 13, + "impedance control error": 14, + "failure": 15, + }, + get_parser=partial(DynaCool._pick_one, 2, int), + get_cmd="TEMP?", + ) + """Parameter temperature_state""" + + self.field_measured: Parameter = self.add_parameter( + "field_measured", + label="Field", + unit="T", + get_cmd=self._measured_field_getter, + ) + """Parameter field_measured""" + + self.field_target: Parameter = self.add_parameter( + "field_target", + label="Field target", + unit="T", + get_cmd=None, + set_cmd=None, + vals=vals.Numbers(-14, 14), + ) + """Parameter field_target""" + + self.field_ramp: Parameter = self.add_parameter( + "field_ramp", + label="Field [ramp]", + unit="T", + get_cmd=None, + set_cmd=self._field_ramp_setter, + vals=vals.Numbers(-14, 14), + ) + """Parameter field_ramp""" + + self.field_rate: Parameter = self.add_parameter( + "field_rate", + label="Field rate", + unit="T/s", + get_parser=lambda x: x * 1e-4, # Oe to T + set_parser=lambda x: x * 1e4, # T to Oe + set_cmd=None, + get_cmd=None, + initial_value=0, + vals=vals.Numbers(0, 1), + ) + """Parameter field_rate""" + + self.field_approach: Parameter = self.add_parameter( + "field_approach", + label="Field ramp approach", + val_mapping={"linear": 0, "no overshoot": 1, "oscillate": 2}, + set_cmd=None, + get_cmd=None, + initial_value="linear", + ) + """Parameter field_approach""" + + self.magnet_state: Parameter = self.add_parameter( + "magnet_state", + label="Magnet state", + val_mapping={ + "unknown": 0, + "stable": 1, + "switch warming": 2, + "switch cool": 3, + "holding": 4, + "iterate": 5, + "ramping": 6, + "ramping ": 7, # map must have inverse + "resetting": 8, + "current error": 9, + "switch error": 10, + "quenching": 11, + "charging error": 12, + "power supply error": 14, + "failure": 15, + }, + get_parser=partial(DynaCool._pick_one, 2, int), + get_cmd="FELD?", + ) + """Parameter magnet_state""" + + self.chamber_temperature: Parameter = self.add_parameter( + "chamber_temperature", + label="Chamber Temperature", + unit="K", + get_parser=partial(DynaCool._pick_one, 1, float), + get_cmd="CHAT?", + ) + """Parameter chamber_temperature""" + + self.chamber_state: Parameter = self.add_parameter( + "chamber_state", + label="Chamber vacuum state", + val_mapping={ + "purged and sealed": 1, + "vented and sealed": 2, + "sealed": 3, + "performing purge/seal": 4, + "performing vent/seal": 5, + "pre-high vacuum": 6, + "high vacuum": 7, + "pumping continuously": 8, + "flooding continuously": 9, + }, + get_parser=partial(DynaCool._pick_one, 1, int), + get_cmd="CHAM?", + ) + """Parameter chamber_state""" + + self.field_tolerance: Parameter = self.add_parameter( + "field_tolerance", + label="Field Tolerance", + unit="T", + get_cmd=None, + set_cmd=None, + vals=vals.Numbers(0, 1e-2), + set_parser=float, + docstring="The tolerance below which fields are " + "considered identical in a " + "blocking ramp.", + initial_value=5e-4, + ) + """The tolerance below which fields are considered identical in a blocking ramp.""" # The error code of the latest command self._error_code = 0 diff --git a/src/qcodes/instrument_drivers/oxford/MercuryiPS_VISA.py b/src/qcodes/instrument_drivers/oxford/MercuryiPS_VISA.py index 7ff28dc814f..f593e5ad4ad 100644 --- a/src/qcodes/instrument_drivers/oxford/MercuryiPS_VISA.py +++ b/src/qcodes/instrument_drivers/oxford/MercuryiPS_VISA.py @@ -20,6 +20,8 @@ if TYPE_CHECKING: from typing_extensions import Unpack + from qcodes.parameters import Parameter + log = logging.getLogger(__name__) visalog = logging.getLogger('qcodes.instrument.visa') @@ -95,81 +97,116 @@ def __init__( else: self.psu_string = "PSU" - self.add_parameter('voltage', - label='Output voltage', - get_cmd=partial(self._param_getter, 'SIG:VOLT'), - unit='V', - get_parser=partial(_signal_parser, 1)) - - self.add_parameter('current', - label='Output current', - get_cmd=partial(self._param_getter, 'SIG:CURR'), - unit='A', - get_parser=partial(_signal_parser, 1)) - - self.add_parameter('current_persistent', - label='Output persistent current', - get_cmd=partial(self._param_getter, 'SIG:PCUR'), - unit='A', - get_parser=partial(_signal_parser, 1)) - - self.add_parameter('current_target', - label='Target current', - get_cmd=partial(self._param_getter, 'SIG:CSET'), - unit='A', - get_parser=partial(_signal_parser, 1)) - - self.add_parameter('field_target', - label='Target field', - get_cmd=partial(self._param_getter, 'SIG:FSET'), - set_cmd=partial(self._param_setter, 'SIG:FSET'), - unit='T', - get_parser=partial(_signal_parser, 1)) + self.voltage: Parameter = self.add_parameter( + "voltage", + label="Output voltage", + get_cmd=partial(self._param_getter, "SIG:VOLT"), + unit="V", + get_parser=partial(_signal_parser, 1), + ) + """Parameter voltage""" + + self.current: Parameter = self.add_parameter( + "current", + label="Output current", + get_cmd=partial(self._param_getter, "SIG:CURR"), + unit="A", + get_parser=partial(_signal_parser, 1), + ) + """Parameter current""" + + self.current_persistent: Parameter = self.add_parameter( + "current_persistent", + label="Output persistent current", + get_cmd=partial(self._param_getter, "SIG:PCUR"), + unit="A", + get_parser=partial(_signal_parser, 1), + ) + """Parameter current_persistent""" + + self.current_target: Parameter = self.add_parameter( + "current_target", + label="Target current", + get_cmd=partial(self._param_getter, "SIG:CSET"), + unit="A", + get_parser=partial(_signal_parser, 1), + ) + """Parameter current_target""" + + self.field_target: Parameter = self.add_parameter( + "field_target", + label="Target field", + get_cmd=partial(self._param_getter, "SIG:FSET"), + set_cmd=partial(self._param_setter, "SIG:FSET"), + unit="T", + get_parser=partial(_signal_parser, 1), + ) + """Parameter field_target""" # NB: The current ramp rate follows the field ramp rate # (converted via the ATOB param) - self.add_parameter('current_ramp_rate', - label='Ramp rate (current)', - unit='A/s', - get_cmd=partial(self._param_getter, 'SIG:RCST'), - get_parser=partial(_signal_parser, 1/60)) - - self.add_parameter('field_ramp_rate', - label='Ramp rate (field)', - unit='T/s', - set_cmd=partial(self._param_setter, 'SIG:RFST'), - get_cmd=partial(self._param_getter, 'SIG:RFST'), - get_parser=partial(_signal_parser, 1/60), - set_parser=lambda x: x*60) - - self.add_parameter('field', - label='Field strength', - unit='T', - get_cmd=partial(self._param_getter, 'SIG:FLD'), - get_parser=partial(_signal_parser, 1)) - - self.add_parameter('field_persistent', - label='Persistent field strength', - unit='T', - get_cmd=partial(self._param_getter, 'SIG:PFLD'), - get_parser=partial(_signal_parser, 1)) - - self.add_parameter('ATOB', - label='Current to field ratio', - unit='A/T', - get_cmd=partial(self._param_getter, 'ATOB'), - get_parser=partial(_signal_parser, 1), - set_cmd=partial(self._param_setter, 'ATOB')) - - self.add_parameter('ramp_status', - label='Ramp status', - get_cmd=partial(self._param_getter, 'ACTN'), - set_cmd=self._ramp_status_setter, - get_parser=_response_preparser, - val_mapping={'HOLD': 'HOLD', - 'TO SET': 'RTOS', - 'CLAMP': 'CLMP', - 'TO ZERO': 'RTOZ'}) + self.current_ramp_rate: Parameter = self.add_parameter( + "current_ramp_rate", + label="Ramp rate (current)", + unit="A/s", + get_cmd=partial(self._param_getter, "SIG:RCST"), + get_parser=partial(_signal_parser, 1 / 60), + ) + """Parameter current_ramp_rate""" + + self.field_ramp_rate: Parameter = self.add_parameter( + "field_ramp_rate", + label="Ramp rate (field)", + unit="T/s", + set_cmd=partial(self._param_setter, "SIG:RFST"), + get_cmd=partial(self._param_getter, "SIG:RFST"), + get_parser=partial(_signal_parser, 1 / 60), + set_parser=lambda x: x * 60, + ) + """Parameter field_ramp_rate""" + + self.field: Parameter = self.add_parameter( + "field", + label="Field strength", + unit="T", + get_cmd=partial(self._param_getter, "SIG:FLD"), + get_parser=partial(_signal_parser, 1), + ) + """Parameter field""" + + self.field_persistent: Parameter = self.add_parameter( + "field_persistent", + label="Persistent field strength", + unit="T", + get_cmd=partial(self._param_getter, "SIG:PFLD"), + get_parser=partial(_signal_parser, 1), + ) + """Parameter field_persistent""" + + self.ATOB: Parameter = self.add_parameter( + "ATOB", + label="Current to field ratio", + unit="A/T", + get_cmd=partial(self._param_getter, "ATOB"), + get_parser=partial(_signal_parser, 1), + set_cmd=partial(self._param_setter, "ATOB"), + ) + """Parameter ATOB""" + + self.ramp_status: Parameter = self.add_parameter( + "ramp_status", + label="Ramp status", + get_cmd=partial(self._param_getter, "ACTN"), + set_cmd=self._ramp_status_setter, + get_parser=_response_preparser, + val_mapping={ + "HOLD": "HOLD", + "TO SET": "RTOS", + "CLAMP": "CLMP", + "TO ZERO": "RTOZ", + }, + ) + """Parameter ramp_status""" def ramp_to_target(self) -> None: """ @@ -325,22 +362,31 @@ def __init__( # FieldVector-valued parameters # - self.add_parameter(name="field_target", - label="target field", - unit="T", - get_cmd=self._get_target_field, - set_cmd=self._set_target_field) - - self.add_parameter(name="field_measured", - label="measured field", - unit="T", - get_cmd=self._get_field) - - self.add_parameter(name="field_ramp_rate", - label="ramp rate", - unit="T/s", - get_cmd=self._get_ramp_rate, - set_cmd=self._set_ramp_rate) + self.field_target: Parameter = self.add_parameter( + name="field_target", + label="target field", + unit="T", + get_cmd=self._get_target_field, + set_cmd=self._set_target_field, + ) + """Parameter field_target""" + + self.field_measured: Parameter = self.add_parameter( + name="field_measured", + label="measured field", + unit="T", + get_cmd=self._get_field, + ) + """Parameter field_measured""" + + self.field_ramp_rate: Parameter = self.add_parameter( + name="field_ramp_rate", + label="ramp rate", + unit="T/s", + get_cmd=self._get_ramp_rate, + set_cmd=self._set_ramp_rate, + ) + """Parameter field_ramp_rate""" self.connect_message() diff --git a/src/qcodes/instrument_drivers/oxford/triton.py b/src/qcodes/instrument_drivers/oxford/triton.py index a5e54555700..011f338178e 100644 --- a/src/qcodes/instrument_drivers/oxford/triton.py +++ b/src/qcodes/instrument_drivers/oxford/triton.py @@ -11,6 +11,8 @@ if TYPE_CHECKING: from typing_extensions import Unpack + from qcodes.parameters import Parameter + class OxfordTriton(IPInstrument): r""" @@ -61,92 +63,103 @@ def __init__( self._control_channel = 5 self.pump_label_dict = {"TURB1": "Turbo 1", "COMP": "Compressor"} - self.add_parameter( + self.time: Parameter = self.add_parameter( name="time", label="System Time", get_cmd="READ:SYS:TIME", get_parser=self._parse_time, ) + """Parameter time""" - self.add_parameter( + self.action: Parameter = self.add_parameter( name="action", label="Current action", get_cmd="READ:SYS:DR:ACTN", get_parser=self._parse_action, ) + """Parameter action""" - self.add_parameter( + self.status: Parameter = self.add_parameter( name="status", label="Status", get_cmd="READ:SYS:DR:STATUS", get_parser=self._parse_status, ) + """Parameter status""" - self.add_parameter( + self.pid_control_channel: Parameter = self.add_parameter( name="pid_control_channel", label="PID control channel", get_cmd=self._get_control_channel, set_cmd=self._set_control_channel, vals=Ints(1, 16), ) + """Parameter pid_control_channel""" - self.add_parameter( + self.pid_mode: Parameter = self.add_parameter( name="pid_mode", label="PID Mode", get_cmd=partial(self._get_control_param, "MODE"), set_cmd=partial(self._set_control_param, "MODE"), val_mapping={"on": "ON", "off": "OFF"}, ) + """Parameter pid_mode""" - self.add_parameter( + self.pid_ramp: Parameter = self.add_parameter( name="pid_ramp", label="PID ramp enabled", get_cmd=partial(self._get_control_param, "RAMP:ENAB"), set_cmd=partial(self._set_control_param, "RAMP:ENAB"), val_mapping={"on": "ON", "off": "OFF"}, ) + """Parameter pid_ramp""" - self.add_parameter( + self.pid_setpoint: Parameter = self.add_parameter( name="pid_setpoint", label="PID temperature setpoint", unit="K", get_cmd=partial(self._get_control_param, "TSET"), set_cmd=partial(self._set_control_param, "TSET"), ) + """Parameter pid_setpoint""" - self.add_parameter( + self.pid_p: Parameter = self.add_parameter( name="pid_p", label="PID proportionality", get_cmd=partial(self._get_control_param, "P"), set_cmd=partial(self._set_control_param, "P"), vals=Numbers(0, 1e3), ) + """Parameter pid_p""" - self.add_parameter( + self.pid_i: Parameter = self.add_parameter( name="pid_i", label="PID intergral", get_cmd=partial(self._get_control_param, "I"), set_cmd=partial(self._set_control_param, "I"), vals=Numbers(0, 1e3), ) + """Parameter pid_i""" - self.add_parameter( + self.pid_d: Parameter = self.add_parameter( name="pid_d", label="PID derivative", get_cmd=partial(self._get_control_param, "D"), set_cmd=partial(self._set_control_param, "D"), vals=Numbers(0, 1e3), ) + """Parameter pid_d""" - self.add_parameter( + self.pid_rate: Parameter = self.add_parameter( name="pid_rate", label="PID ramp rate", unit="K/min", get_cmd=partial(self._get_control_param, "RAMP:RATE"), set_cmd=partial(self._set_control_param, "RAMP:RATE"), ) + """Parameter pid_rate""" - self.add_parameter( + self.pid_range: Parameter = self.add_parameter( name="pid_range", label="PID heater range", # TODO: The units in the software are mA, how to @@ -156,74 +169,84 @@ def __init__( set_cmd=partial(self._set_control_param, "RANGE"), vals=Enum(*self._heater_range_curr), ) + """Parameter pid_range""" - self.add_parameter( + self.magnet_status: Parameter = self.add_parameter( name="magnet_status", label="Magnet status", unit="", get_cmd=partial(self._get_control_B_param, "ACTN"), ) + """Parameter magnet_status""" - self.add_parameter( + self.magnet_sweeprate: Parameter = self.add_parameter( name="magnet_sweeprate", label="Magnet sweep rate", unit="T/min", get_cmd=partial(self._get_control_B_param, "RVST:RATE"), set_cmd=partial(self._set_control_magnet_sweeprate_param), ) + """Parameter magnet_sweeprate""" - self.add_parameter( + self.magnet_sweeprate_insta: Parameter = self.add_parameter( name="magnet_sweeprate_insta", label="Instantaneous magnet sweep rate", unit="T/min", get_cmd=partial(self._get_control_B_param, "RFST"), ) + """Parameter magnet_sweeprate_insta""" - self.add_parameter( + self.B: Parameter = self.add_parameter( name="B", label="Magnetic field", unit="T", get_cmd=partial(self._get_control_B_param, "VECT"), ) + """Parameter B""" - self.add_parameter( + self.Bx: Parameter = self.add_parameter( name="Bx", label="Magnetic field x-component", unit="T", get_cmd=partial(self._get_control_Bcomp_param, "VECTBx"), set_cmd=partial(self._set_control_Bx_param), ) + """Parameter Bx""" - self.add_parameter( + self.By: Parameter = self.add_parameter( name="By", label="Magnetic field y-component", unit="T", get_cmd=partial(self._get_control_Bcomp_param, "VECTBy"), set_cmd=partial(self._set_control_By_param), ) + """Parameter By""" - self.add_parameter( + self.Bz: Parameter = self.add_parameter( name="Bz", label="Magnetic field z-component", unit="T", get_cmd=partial(self._get_control_Bcomp_param, "VECTBz"), set_cmd=partial(self._set_control_Bz_param), ) + """Parameter Bz""" - self.add_parameter( + self.magnet_sweep_time: Parameter = self.add_parameter( name="magnet_sweep_time", label="Magnet sweep time", unit="T/min", get_cmd=partial(self._get_control_B_param, "RVST:TIME"), ) + """Parameter magnet_sweep_time""" - self.add_parameter( + self.turb1_speed: Parameter = self.add_parameter( name="turb1_speed", label=self.pump_label_dict["TURB1"] + " speed", unit="Hz", get_cmd="READ:DEV:TURB1:PUMP:SIG:SPD", get_parser=self._get_parser_pump_speed, ) + """Parameter turb1_speed""" self._add_pump_state() self._add_temp_state() diff --git a/src/qcodes/instrument_drivers/rigol/Rigol_DG1062.py b/src/qcodes/instrument_drivers/rigol/Rigol_DG1062.py index 8dfb964af03..eb34ad2b801 100644 --- a/src/qcodes/instrument_drivers/rigol/Rigol_DG1062.py +++ b/src/qcodes/instrument_drivers/rigol/Rigol_DG1062.py @@ -15,6 +15,8 @@ if TYPE_CHECKING: from typing_extensions import Unpack + from qcodes.parameters import Parameter + log = logging.getLogger(__name__) @@ -34,21 +36,23 @@ def __init__( super().__init__(parent, name, **kwargs) self.channel = channel - self.add_parameter( + self.on: Parameter = self.add_parameter( "on", get_cmd=f":SOUR{channel}:BURS?", set_cmd=f":SOUR{channel}:BURS {{}}", vals=vals.Enum(0, 1, "ON", "OFF"), ) + """Parameter on""" - self.add_parameter( + self.polarity: Parameter = self.add_parameter( "polarity", get_cmd=f":SOUR{channel}:BURS:GATE:POL?", set_cmd=f":SOUR{channel}:BURS:GATE:POL {{}}", vals=vals.Enum("NORM", "INV"), ) + """Parameter polarity""" - self.add_parameter( + self.period: Parameter = self.add_parameter( "period", get_cmd=f":SOUR{channel}:BURS:INT:PER?", set_cmd=f":SOUR{channel}:BURS:INT:PER {{}}", @@ -56,50 +60,57 @@ def __init__( vals.Numbers(min_value=3e-6, max_value=500), vals.Enum("MIN", "MAX") ), ) + """Parameter period""" - self.add_parameter( + self.mode: Parameter = self.add_parameter( "mode", get_cmd=f":SOUR{channel}:BURS:MODE?", set_cmd=f":SOUR{channel}:BURS:MODE {{}}", vals=vals.Enum("TRIG", "INF", "GAT"), ) + """Parameter mode""" - self.add_parameter( + self.ncycles: Parameter = self.add_parameter( "ncycles", get_cmd=f":SOUR{channel}:BURS:NCYC?", set_cmd=f":SOUR{channel}:BURS:NCYC {{}}", vals=vals.Numbers(min_value=1, max_value=500000), ) + """Parameter ncycles""" - self.add_parameter( + self.phase: Parameter = self.add_parameter( "phase", get_cmd=f":SOUR{channel}:BURS:PHAS?", set_cmd=f":SOUR{channel}:BURS:PHAS {{}}", vals=vals.Numbers(min_value=0, max_value=360), ) + """Parameter phase""" - self.add_parameter( + self.time_delay: Parameter = self.add_parameter( "time_delay", get_cmd=f":SOUR{channel}:BURS:TDEL?", set_cmd=f":SOUR{channel}:BURS:TDEL {{}}", vals=vals.Numbers(min_value=0), ) + """Parameter time_delay""" - self.add_parameter( + self.trigger_slope: Parameter = self.add_parameter( "trigger_slope", get_cmd=f":SOUR{channel}:BURS:TRIG:SLOP?", set_cmd=f":SOUR{channel}:BURS:TRIG:SLOP {{}}", vals=vals.Enum("POS", "NEG"), ) + """Parameter trigger_slope""" - self.add_parameter( + self.source: Parameter = self.add_parameter( "source", get_cmd=f":SOUR{channel}:BURS:TRIG:SOUR?", set_cmd=f":SOUR{channel}:BURS:TRIG:SOUR {{}}", vals=vals.Enum("INT", "EXT", "MAN"), ) + """Parameter source""" - self.add_parameter( + self.idle: Parameter = self.add_parameter( "idle", get_cmd=f":SOUR{channel}:BURST:IDLE?", set_cmd=f":SOUR{channel}:BURST:IDLE {{}}", @@ -107,6 +118,7 @@ def __init__( vals.Enum("FPT", "TOP", "BOTTOM", "CENTER"), vals.Numbers() # DIY ), ) + """Parameter idle""" def trigger(self) -> None: """ @@ -178,11 +190,12 @@ def __init__( set_cmd=partial(self._set_waveform_param, param), ) - self.add_parameter( + self.waveform: Parameter = self.add_parameter( "waveform", get_cmd=partial(self._get_waveform_param, "waveform") ) + """Parameter waveform""" - self.add_parameter( + self.impedance: Parameter = self.add_parameter( "impedance", get_cmd=f":OUTPUT{channel}:IMP?", set_cmd=f":OUTPUT{channel}:IMP {{}}", @@ -201,29 +214,33 @@ def __init__( ), set_parser=lambda value: "INF" if value == "HighZ" else value, ) + """Parameter impedance""" - self.add_parameter( + self.sync: Parameter = self.add_parameter( "sync", get_cmd=f":OUTPUT{channel}:SYNC?", set_cmd=f"OUTPUT{channel}:SYNC {{}}", vals=vals.Enum(0, 1, "ON", "OFF"), ) + """Parameter sync""" - self.add_parameter( + self.polarity: Parameter = self.add_parameter( "polarity", get_cmd=f":OUTPUT{channel}:GAT:POL?", set_cmd=f":OUTPUT{channel}:GAT:POL {{}}", vals=vals.OnOff(), val_mapping={1: "POSITIVE", 0: "NEGATIVE"}, ) + """Parameter polarity""" - self.add_parameter( + self.state: Parameter = self.add_parameter( "state", get_cmd=f"OUTPUT{channel}:STATE?", set_cmd=f"OUTPUT{channel}:STATE {{}}", ) + """Parameter state""" - self.add_parameter( + self.duty_cycle: Parameter = self.add_parameter( "duty_cycle", get_cmd=self._get_duty_cycle, set_cmd=self._set_duty_cycle, @@ -237,6 +254,11 @@ def __init__( "the user an error" ), ) + """ + This functions reads/sets the duty cycle for a square and + pulse wave since these inherit a duty cycle. + For other waveforms it will give the user an error + """ burst = RigolDG1062Burst(cast(RigolDG1062, self.parent), "burst", self.channel) self.add_submodule("burst", burst) diff --git a/src/qcodes/instrument_drivers/rigol/Rigol_DG4000.py b/src/qcodes/instrument_drivers/rigol/Rigol_DG4000.py index f3b15f6d435..e68f45eb2ed 100644 --- a/src/qcodes/instrument_drivers/rigol/Rigol_DG4000.py +++ b/src/qcodes/instrument_drivers/rigol/Rigol_DG4000.py @@ -10,6 +10,8 @@ import numpy as np from typing_extensions import Unpack + from qcodes.parameters import Parameter + def is_number(s: str) -> bool: """Test whether a given string can be parsed as a float""" @@ -102,23 +104,25 @@ def __init__( on_off_map = {True: "ON", False: "OFF"} # Counter - self.add_parameter( + self.counter_attenuation: Parameter = self.add_parameter( "counter_attenuation", get_cmd="COUN:ATT?", set_cmd="COUN:ATT {}", val_mapping={1: "1X", 10: "10X"}, ) + """Parameter counter_attenuation""" self.add_function("auto_counter", call_cmd="COUN:AUTO") - self.add_parameter( + self.counter_coupling: Parameter = self.add_parameter( "counter_coupling", get_cmd="COUN:COUP?", set_cmd="COUN:COUP {}", vals=Enum("AC", "DC"), ) + """Parameter counter_coupling""" - self.add_parameter( + self.counter_gate_time: Parameter = self.add_parameter( "counter_gate_time", get_cmd="COUN:GATE?", set_cmd="COUN:GATE {}", @@ -133,23 +137,26 @@ def __init__( ">10": "USER6", }, ) + """Parameter counter_gate_time""" - self.add_parameter( + self.counter_hf_reject_enabled: Parameter = self.add_parameter( "counter_hf_reject_enabled", get_cmd="COUN:HF?", set_cmd="COUN:HF {}", val_mapping=on_off_map, ) + """Parameter counter_hf_reject_enabled""" - self.add_parameter( + self.counter_impedance: Parameter = self.add_parameter( "counter_impedance", get_cmd="COUN:IMP?", set_cmd="COUN:IMP {}", unit="Ohm", val_mapping={50: "50", 1e6: "1M"}, ) + """Parameter counter_impedance""" - self.add_parameter( + self.counter_trigger_level: Parameter = self.add_parameter( "counter_trigger_level", get_cmd="COUN:LEVE?", get_parser=float, @@ -157,13 +164,15 @@ def __init__( unit="V", vals=Numbers(min_value=-2.5, max_value=2.5), ) + """Parameter counter_trigger_level""" - self.add_parameter( + self.counter_enabled: Parameter = self.add_parameter( "counter_enabled", get_cmd="COUN:STAT?", set_cmd="COUN:STAT {}", val_mapping=on_off_map, ) + """Parameter counter_enabled""" measure_params = [ "frequency", @@ -181,7 +190,7 @@ def __init__( get_parser=partial(parse_single_output, i), ) - self.add_parameter( + self.counter_trigger_sensitivity: Parameter = self.add_parameter( "counter_trigger_sensitivity", get_cmd="COUN:SENS?", get_parser=float, @@ -189,6 +198,7 @@ def __init__( unit="%", vals=Numbers(min_value=0, max_value=100), ) + """Parameter counter_trigger_sensitivity""" # Output and Source parameters for both channel 1 and 2 for i in [1, 2]: @@ -652,12 +662,13 @@ def __init__( # System self.add_function("beep", call_cmd="SYST:BEEP") - self.add_parameter( + self.beeper_enabled: Parameter = self.add_parameter( "beeper_enabled", get_cmd="SYST:BEEP:STAT?", set_cmd="SYST:BEEP:STAT {}", val_mapping=on_off_map, ) + """Parameter beeper_enabled""" self.add_function("copy_config_to_ch1", call_cmd="SYST:CSC CH2,CH1") self.add_function("copy_config_to_ch2", call_cmd="SYST:CSC CH1,CH2") @@ -667,20 +678,22 @@ def __init__( self.add_function("get_error", call_cmd="SYST:ERR?", return_parser=str) - self.add_parameter( + self.keyboard_locked: Parameter = self.add_parameter( "keyboard_locked", get_cmd="SYST:KLOCK?", set_cmd="SYST:KLOCK {}", val_mapping=on_off_map, ) + """Parameter keyboard_locked""" - self.add_parameter( + self.startup_mode: Parameter = self.add_parameter( "startup_mode", get_cmd="SYST:POWS?", get_parser=str.lower, set_cmd="SYST:POWS {}", vals=Enum("user", "auto"), ) + """Parameter startup_mode""" system_states = Enum( "default", @@ -700,16 +713,20 @@ def __init__( self.add_function("restart", call_cmd="SYST:RESTART") - self.add_parameter( + self.reference_clock_source: Parameter = self.add_parameter( "reference_clock_source", get_cmd="SYST:ROSC:SOUR?", set_cmd="SYST:ROSC:SOUR {}", val_mapping={"internal": "INT", "external": "EXT"}, ) + """Parameter reference_clock_source""" self.add_function("shutdown", call_cmd="SYST:SHUTDOWN") - self.add_parameter("scpi_version", get_cmd="SYST:VERS?") + self.scpi_version: Parameter = self.add_parameter( + "scpi_version", get_cmd="SYST:VERS?" + ) + """Parameter scpi_version""" # Trace self.add_function("upload_data", call_cmd=self._upload_data, args=[Anything()]) diff --git a/src/qcodes/instrument_drivers/rigol/Rigol_DP821.py b/src/qcodes/instrument_drivers/rigol/Rigol_DP821.py index 1d197d41bb0..83b0eff9cb6 100644 --- a/src/qcodes/instrument_drivers/rigol/Rigol_DP821.py +++ b/src/qcodes/instrument_drivers/rigol/Rigol_DP821.py @@ -1,6 +1,6 @@ from typing import TYPE_CHECKING -from .private.DP8xx import _RigelDP8xx +from .private.DP8xx import RigolDP8xxBase if TYPE_CHECKING: from typing_extensions import Unpack @@ -8,7 +8,7 @@ from qcodes.instrument import VisaInstrumentKWArgs -class RigolDP821(_RigelDP8xx): +class RigolDP821(RigolDP8xxBase): """ This is the qcodes driver for the Rigol DP821(A) Power Supply """ diff --git a/src/qcodes/instrument_drivers/rigol/Rigol_DP831.py b/src/qcodes/instrument_drivers/rigol/Rigol_DP831.py index c62fd4d5ce5..75b3028be81 100644 --- a/src/qcodes/instrument_drivers/rigol/Rigol_DP831.py +++ b/src/qcodes/instrument_drivers/rigol/Rigol_DP831.py @@ -1,6 +1,6 @@ from typing import TYPE_CHECKING -from .private.DP8xx import _RigelDP8xx +from .private.DP8xx import RigolDP8xxBase if TYPE_CHECKING: from typing_extensions import Unpack @@ -8,7 +8,7 @@ from qcodes.instrument import VisaInstrumentKWArgs -class RigolDP831(_RigelDP8xx): +class RigolDP831(RigolDP8xxBase): """ This is the qcodes driver for the Rigol DP831(A) Power Supply """ diff --git a/src/qcodes/instrument_drivers/rigol/Rigol_DP832.py b/src/qcodes/instrument_drivers/rigol/Rigol_DP832.py index 4eaf72ea2e2..a905edc141c 100644 --- a/src/qcodes/instrument_drivers/rigol/Rigol_DP832.py +++ b/src/qcodes/instrument_drivers/rigol/Rigol_DP832.py @@ -1,6 +1,6 @@ from typing import TYPE_CHECKING -from .private.DP8xx import _RigelDP8xx +from .private.DP8xx import RigolDP8xxBase if TYPE_CHECKING: from typing_extensions import Unpack @@ -8,7 +8,7 @@ from qcodes.instrument import VisaInstrumentKWArgs -class RigolDP832(_RigelDP8xx): +class RigolDP832(RigolDP8xxBase): """ This is the qcodes driver for the Rigol DP832(A) Power Supply """ diff --git a/src/qcodes/instrument_drivers/rigol/Rigol_DS1074Z.py b/src/qcodes/instrument_drivers/rigol/Rigol_DS1074Z.py index 0f02393082d..2f21481789f 100644 --- a/src/qcodes/instrument_drivers/rigol/Rigol_DS1074Z.py +++ b/src/qcodes/instrument_drivers/rigol/Rigol_DS1074Z.py @@ -15,6 +15,8 @@ if TYPE_CHECKING: from typing_extensions import Unpack + from qcodes.parameters import Parameter + class RigolDS1074ZChannel(InstrumentChannel): """ @@ -35,14 +37,15 @@ def __init__( super().__init__(parent, name, **kwargs) self.channel = channel - self.add_parameter( + self.vertical_scale: Parameter = self.add_parameter( "vertical_scale", get_cmd=f":CHANnel{channel}:SCALe?", set_cmd=":CHANnel{}:SCALe {}".format(channel, "{}"), get_parser=float, ) + """Parameter vertical_scale""" - self.add_parameter( + self.trace: ParameterWithSetpoints = self.add_parameter( "trace", get_cmd=self._get_full_trace, vals=Arrays(shape=(self.parent.waveform_npoints,)), @@ -51,6 +54,7 @@ def __init__( parameter_class=ParameterWithSetpoints, snapshot_value=False, ) + """Parameter trace""" def _get_full_trace(self) -> np.ndarray: y_ori = self.root_instrument.waveform_yorigin() @@ -97,41 +101,47 @@ def __init__( ): super().__init__(name, address, **kwargs) - self.add_parameter( + self.waveform_xorigin: Parameter = self.add_parameter( "waveform_xorigin", get_cmd="WAVeform:XORigin?", unit="s", get_parser=float ) + """Parameter waveform_xorigin""" - self.add_parameter( + self.waveform_xincrem: Parameter = self.add_parameter( "waveform_xincrem", get_cmd=":WAVeform:XINCrement?", unit="s", get_parser=float, ) + """Parameter waveform_xincrem""" - self.add_parameter( + self.waveform_npoints: Parameter = self.add_parameter( "waveform_npoints", get_cmd="WAV:POIN?", set_cmd="WAV:POIN {}", unit="s", get_parser=int, ) + """Parameter waveform_npoints""" - self.add_parameter( + self.waveform_yorigin: Parameter = self.add_parameter( "waveform_yorigin", get_cmd="WAVeform:YORigin?", unit="V", get_parser=float ) + """Parameter waveform_yorigin""" - self.add_parameter( + self.waveform_yincrem: Parameter = self.add_parameter( "waveform_yincrem", get_cmd=":WAVeform:YINCrement?", unit="V", get_parser=float, ) + """Parameter waveform_yincrem""" - self.add_parameter( + self.waveform_yref: Parameter = self.add_parameter( "waveform_yref", get_cmd=":WAVeform:YREFerence?", unit="V", get_parser=float ) + """Parameter waveform_yref""" - self.add_parameter( + self.trigger_mode: Parameter = self.add_parameter( "trigger_mode", get_cmd=":TRIGger:MODE?", set_cmd=":TRIGger:MODE {}", @@ -139,17 +149,19 @@ def __init__( vals=Enum("edge", "pulse", "video", "pattern"), get_parser=str, ) + """Parameter trigger_mode""" # trigger source - self.add_parameter( + self.trigger_level: Parameter = self.add_parameter( "trigger_level", unit="V", get_cmd=self._get_trigger_level, set_cmd=self._set_trigger_level, vals=Numbers(), ) + """Parameter trigger_level""" - self.add_parameter( + self.trigger_edge_source: Parameter = self.add_parameter( "trigger_edge_source", label="Source channel for the edge trigger", get_cmd=":TRIGger:EDGE:SOURce?", @@ -161,16 +173,18 @@ def __init__( "ch4": "CHAN4", }, ) + """Parameter trigger_edge_source""" - self.add_parameter( + self.trigger_edge_slope: Parameter = self.add_parameter( "trigger_edge_slope", label="Slope of the edge trigger", get_cmd=":TRIGger:EDGE:SLOPe?", set_cmd=":TRIGger:EDGE:SLOPe {}", vals=Enum("positive", "negative", "neither"), ) + """Parameter trigger_edge_slope""" - self.add_parameter( + self.data_source: Parameter = self.add_parameter( "data_source", label="Waveform Data source", get_cmd=":WAVeform:SOURce?", @@ -182,8 +196,9 @@ def __init__( "ch4": "CHAN4", }, ) + """Parameter data_source""" - self.add_parameter( + self.time_axis: Parameter = self.add_parameter( "time_axis", unit="s", label="Time", @@ -192,6 +207,7 @@ def __init__( vals=Arrays(shape=(self.waveform_npoints,)), snapshot_value=False, ) + """Parameter time_axis""" channels = ChannelList( self, "channels", RigolDS1074ZChannel, snapshotable=False diff --git a/src/qcodes/instrument_drivers/rigol/Rigol_DS4000.py b/src/qcodes/instrument_drivers/rigol/Rigol_DS4000.py index 5978baec116..34d85436160 100644 --- a/src/qcodes/instrument_drivers/rigol/Rigol_DS4000.py +++ b/src/qcodes/instrument_drivers/rigol/Rigol_DS4000.py @@ -23,6 +23,8 @@ if TYPE_CHECKING: from typing_extensions import Unpack + from qcodes.parameters import Parameter + log = logging.getLogger(__name__) @@ -208,25 +210,29 @@ def __init__( ): super().__init__(parent, name, **kwargs) - self.add_parameter( + self.amplitude: Parameter = self.add_parameter( "amplitude", get_cmd=f":MEASure:VAMP? chan{channel}", get_parser=float ) - self.add_parameter( + """Parameter amplitude""" + self.vertical_scale: Parameter = self.add_parameter( "vertical_scale", get_cmd=f":CHANnel{channel}:SCALe?", set_cmd=":CHANnel{}:SCALe {}".format(channel, "{}"), get_parser=float, ) + """Parameter vertical_scale""" # Return the waveform displayed on the screen - self.add_parameter( + self.curvedata: ScopeArray = self.add_parameter( "curvedata", channel=channel, parameter_class=ScopeArray, raw=False ) + """Parameter curvedata""" # Return the waveform in the internal memory - self.add_parameter( + self.curvedata_raw: ScopeArray = self.add_parameter( "curvedata_raw", channel=channel, parameter_class=ScopeArray, raw=True ) + """Parameter curvedata_raw""" class RigolDS4000(VisaInstrument): @@ -274,7 +280,7 @@ def __init__( ) # general parameters - self.add_parameter( + self.trigger_type: Parameter = self.add_parameter( "trigger_type", label="Type of the trigger", get_cmd=":TRIGger:MODE?", @@ -295,14 +301,16 @@ def __init__( "USB", ), ) - self.add_parameter( + """Parameter trigger_type""" + self.trigger_mode: Parameter = self.add_parameter( "trigger_mode", label="Mode of the trigger", get_cmd=":TRIGger:SWEep?", set_cmd=":TRIGger:SWEep {}", vals=vals.Enum("AUTO", "NORM", "SING"), ) - self.add_parameter( + """Parameter trigger_mode""" + self.time_base: Parameter = self.add_parameter( "time_base", label="Horizontal time base", get_cmd=":TIMebase:MAIN:SCALe?", @@ -310,7 +318,8 @@ def __init__( get_parser=float, unit="s/div", ) - self.add_parameter( + """Parameter time_base""" + self.sample_point_count: Parameter = self.add_parameter( "sample_point_count", label="Number of the waveform points", get_cmd=":WAVeform:POINts?", @@ -318,7 +327,8 @@ def __init__( get_parser=int, vals=vals.Ints(min_value=1), ) - self.add_parameter( + """Parameter sample_point_count""" + self.enable_auto_scale: Parameter = self.add_parameter( "enable_auto_scale", label="Enable or disable autoscale", get_cmd=":SYSTem:AUToscale?", @@ -326,6 +336,7 @@ def __init__( get_parser=bool, vals=vals.Bool(), ) + """Parameter enable_auto_scale""" channels = ChannelList(self, "Channels", RigolDS4000Channel, snapshotable=False) diff --git a/src/qcodes/instrument_drivers/rigol/__init__.py b/src/qcodes/instrument_drivers/rigol/__init__.py index 6d4c60463be..468e37931a6 100644 --- a/src/qcodes/instrument_drivers/rigol/__init__.py +++ b/src/qcodes/instrument_drivers/rigol/__init__.py @@ -1,3 +1,4 @@ +from .private.DP8xx import RigolDP8xxBase from .Rigol_DG1062 import RigolDG1062, RigolDG1062Burst, RigolDG1062Channel from .Rigol_DG4000 import RigolDG4000 from .Rigol_DP821 import RigolDP821 @@ -11,6 +12,7 @@ "RigolDG1062Burst", "RigolDG1062Channel", "RigolDG4000", + "RigolDP8xxBase", "RigolDP821", "RigolDP831", "RigolDP832", diff --git a/src/qcodes/instrument_drivers/rigol/private/DP8xx.py b/src/qcodes/instrument_drivers/rigol/private/DP8xx.py index db488ffff0b..7771f62866f 100644 --- a/src/qcodes/instrument_drivers/rigol/private/DP8xx.py +++ b/src/qcodes/instrument_drivers/rigol/private/DP8xx.py @@ -14,11 +14,13 @@ from typing_extensions import Unpack + from qcodes.parameters import Parameter + class RigolDP8xxChannel(InstrumentChannel): def __init__( self, - parent: "_RigelDP8xx", + parent: "RigolDP8xxBase", name: str, channel: int, ch_range: tuple[float, float], @@ -38,7 +40,7 @@ def __init__( def strstrip(s: str) -> str: return str(s).strip() - self.add_parameter( + self.set_voltage: Parameter = self.add_parameter( "set_voltage", label="Target voltage output", set_cmd="{} :SOURce:VOLTage:LEVel:IMMediate:AMPLitude {}".format( @@ -49,7 +51,8 @@ def strstrip(s: str) -> str: unit="V", vals=vals.Numbers(min(0, self.vmax), max(0, self.vmax)), ) - self.add_parameter( + """Parameter set_voltage""" + self.set_current: Parameter = self.add_parameter( "set_current", label="Target current output", set_cmd="{} :SOURce:CURRent:LEVel:IMMediate:AMPLitude {}".format( @@ -60,7 +63,8 @@ def strstrip(s: str) -> str: unit="A", vals=vals.Numbers(0, self.imax), ) - self.add_parameter( + """Parameter set_current""" + self.state: Parameter = self.add_parameter( "state", label="Output enabled", set_cmd="{} :OUTPut:STATe {}".format(select_cmd, "{}"), @@ -68,7 +72,8 @@ def strstrip(s: str) -> str: get_parser=strstrip, vals=vals.OnOff(), ) - self.add_parameter( + """Parameter state""" + self.mode: Parameter = self.add_parameter( "mode", label="Get the output mode", get_cmd=f"{select_cmd} :OUTPut:MODE?", @@ -79,28 +84,32 @@ def strstrip(s: str) -> str: "Unregulated": "UR", }, ) - self.add_parameter( + """Parameter mode""" + self.voltage: Parameter = self.add_parameter( "voltage", label="Measured voltage", get_cmd=f"{select_cmd} :MEASure:VOLTage:DC?", get_parser=float, unit="V", ) - self.add_parameter( + """Parameter voltage""" + self.current: Parameter = self.add_parameter( "current", label="Measured current", get_cmd=f"{select_cmd} :MEASure:CURRent:DC?", get_parser=float, unit="A", ) - self.add_parameter( + """Parameter current""" + self.power: Parameter = self.add_parameter( "power", label="Measured power", get_cmd=f"{select_cmd} :MEASure:POWer?", get_parser=float, unit="W", ) - self.add_parameter( + """Parameter power""" + self.ovp_value: Parameter = self.add_parameter( "ovp_value", label="Over Voltage Protection value", set_cmd="{} :VOLTage:PROTection:LEVel {}".format(select_cmd, "{}"), @@ -109,7 +118,8 @@ def strstrip(s: str) -> str: unit="V", vals=vals.Numbers(self.ovp_range[0], self.ovp_range[1]), ) - self.add_parameter( + """Parameter ovp_value""" + self.ovp_state: Parameter = self.add_parameter( "ovp_state", label="Over Voltage Protection status", set_cmd="{} :VOLTage:PROTection:STATe {}".format(select_cmd, "{}"), @@ -117,7 +127,8 @@ def strstrip(s: str) -> str: get_parser=strstrip, vals=vals.OnOff(), ) - self.add_parameter( + """Parameter ovp_state""" + self.ocp_value: Parameter = self.add_parameter( "ocp_value", label="Over Current Protection value", set_cmd="{} :CURRent:PROTection:LEVel {}".format(select_cmd, "{}"), @@ -126,7 +137,8 @@ def strstrip(s: str) -> str: unit="A", vals=vals.Numbers(self.ocp_range[0], self.ocp_range[1]), ) - self.add_parameter( + """Parameter ocp_value""" + self.ocp_state: Parameter = self.add_parameter( "ocp_state", label="Over Current Protection status", set_cmd="{} :CURRent:PROTection:STATe {}".format(select_cmd, "{}"), @@ -134,14 +146,16 @@ def strstrip(s: str) -> str: get_parser=strstrip, vals=vals.OnOff(), ) + """Parameter ocp_state""" -class _RigelDP8xx(VisaInstrument): +class RigolDP8xxBase(VisaInstrument): """ This is the general DP8xx Power Supply driver class that implements shared parameters and functionality - among all similar power supply from Rigole. + among all similar power supply from Rigol. - This driver was written to be inherited from by a specific driver (e.g. DP832). + This driver was written to be inherited from by a specific driver (e.g. RigolDP832). This baseClass should not + be instantiated directly. """ def __init__( diff --git a/src/qcodes/instrument_drivers/rohde_schwarz/RTO1000.py b/src/qcodes/instrument_drivers/rohde_schwarz/RTO1000.py index 2055862ef68..d9a998812f9 100644 --- a/src/qcodes/instrument_drivers/rohde_schwarz/RTO1000.py +++ b/src/qcodes/instrument_drivers/rohde_schwarz/RTO1000.py @@ -17,7 +17,7 @@ VisaInstrument, VisaInstrumentKWArgs, ) -from qcodes.parameters import ArrayParameter, create_on_off_val_mapping +from qcodes.parameters import ArrayParameter, Parameter, create_on_off_val_mapping if TYPE_CHECKING: from typing_extensions import Unpack @@ -238,72 +238,99 @@ def __init__( 'M3STddev', 'MKPositive', 'MKNegative' ) - self.add_parameter('enable', - label=f'Measurement {meas_nr} enable', - set_cmd=f'MEASurement{meas_nr}:ENABle {{}}', - vals=vals.Enum('ON', 'OFF'), - docstring='Switches the measurement on or off.') - - self.add_parameter('source', - label=f'Measurement {meas_nr} source', - set_cmd=f'MEASurement{meas_nr}:SOURce {{}}', - vals=self.sources, - docstring='Set the source of a measurement if the ' - 'measurement only needs one source.') - - self.add_parameter('source_first', - label=f'Measurement {meas_nr} first source', - set_cmd=f'MEASurement{meas_nr}:FSRC {{}}', - vals=self.sources, - docstring='Set the first source of a measurement' - ' if the measurement only needs multiple' - ' sources.') - - self.add_parameter('source_second', - label=f'Measurement {meas_nr} second source', - set_cmd=f'MEASurement{meas_nr}:SSRC {{}}', - vals=self.sources, - docstring='Set the second source of a measurement' - ' if the measurement only needs multiple' - ' sources.') - - self.add_parameter('category', - label=f'Measurement {meas_nr} category', - set_cmd=f'MEASurement{meas_nr}:CATegory {{}}', - vals=self.categories, - docstring='Set the category of a measurement.') - - self.add_parameter('main', - label=f'Measurement {meas_nr} main', - set_cmd=f'MEASurement{meas_nr}:MAIN {{}}', - vals=self.meas_type, - docstring='Set the main of a measurement.') - - self.add_parameter('statistics_enable', - label=f'Measurement {meas_nr} enable statistics', - set_cmd=f'MEASurement{meas_nr}:STATistics:ENABle' - f' {{}}', - vals=vals.Enum('ON', 'OFF'), - docstring='Switches the measurement on or off.') - - self.add_parameter('clear', - label=f'Measurement {meas_nr} clear statistics', - set_cmd=f'MEASurement{meas_nr}:CLEar', - docstring='Clears/reset measurement.') - - self.add_parameter('event_count', - label=f'Measurement {meas_nr} number of events', - get_cmd=f'MEASurement{meas_nr}:RESult:EVTCount?', - get_parser=int, - docstring='Number of measurement results in the' - ' long-term measurement.') - - self.add_parameter('result_avg', - label=f'Measurement {meas_nr} averages', - get_cmd=f'MEASurement{meas_nr}:RESult:AVG?', - get_parser=float, - docstring='Average of the long-term measurement' - ' results.') + self.enable: Parameter = self.add_parameter( + "enable", + label=f"Measurement {meas_nr} enable", + set_cmd=f"MEASurement{meas_nr}:ENABle {{}}", + vals=vals.Enum("ON", "OFF"), + docstring="Switches the measurement on or off.", + ) + """Switches the measurement on or off.""" + + self.source: Parameter = self.add_parameter( + "source", + label=f"Measurement {meas_nr} source", + set_cmd=f"MEASurement{meas_nr}:SOURce {{}}", + vals=self.sources, + docstring="Set the source of a measurement if the " + "measurement only needs one source.", + ) + """Set the source of a measurement if the measurement only needs one source.""" + + self.source_first: Parameter = self.add_parameter( + "source_first", + label=f"Measurement {meas_nr} first source", + set_cmd=f"MEASurement{meas_nr}:FSRC {{}}", + vals=self.sources, + docstring="Set the first source of a measurement" + " if the measurement only needs multiple" + " sources.", + ) + """Set the first source of a measurement if the measurement only needs multiple sources.""" + + self.source_second: Parameter = self.add_parameter( + "source_second", + label=f"Measurement {meas_nr} second source", + set_cmd=f"MEASurement{meas_nr}:SSRC {{}}", + vals=self.sources, + docstring="Set the second source of a measurement" + " if the measurement only needs multiple" + " sources.", + ) + """Set the second source of a measurement if the measurement only needs multiple sources.""" + + self.category: Parameter = self.add_parameter( + "category", + label=f"Measurement {meas_nr} category", + set_cmd=f"MEASurement{meas_nr}:CATegory {{}}", + vals=self.categories, + docstring="Set the category of a measurement.", + ) + """Set the category of a measurement.""" + + self.main: Parameter = self.add_parameter( + "main", + label=f"Measurement {meas_nr} main", + set_cmd=f"MEASurement{meas_nr}:MAIN {{}}", + vals=self.meas_type, + docstring="Set the main of a measurement.", + ) + """Set the main of a measurement.""" + + self.statistics_enable: Parameter = self.add_parameter( + "statistics_enable", + label=f"Measurement {meas_nr} enable statistics", + set_cmd=f"MEASurement{meas_nr}:STATistics:ENABle {{}}", + vals=vals.Enum("ON", "OFF"), + docstring="Switches the measurement on or off.", + ) + """Switches the measurement on or off.""" + + self.clear: Parameter = self.add_parameter( + "clear", + label=f"Measurement {meas_nr} clear statistics", + set_cmd=f"MEASurement{meas_nr}:CLEar", + docstring="Clears/reset measurement.", + ) + """Clears/reset measurement.""" + + self.event_count: Parameter = self.add_parameter( + "event_count", + label=f"Measurement {meas_nr} number of events", + get_cmd=f"MEASurement{meas_nr}:RESult:EVTCount?", + get_parser=int, + docstring="Number of measurement results in the long-term measurement.", + ) + """Number of measurement results in the long-term measurement.""" + + self.result_avg: Parameter = self.add_parameter( + "result_avg", + label=f"Measurement {meas_nr} averages", + get_cmd=f"MEASurement{meas_nr}:RESult:AVG?", + get_parser=float, + docstring="Average of the long-term measurement results.", + ) + """Average of the long-term measurement results.""" ScopeMeasurement = RohdeSchwarzRTO1000ScopeMeasurement @@ -340,109 +367,146 @@ def __init__( super().__init__(parent, name, **kwargs) - self.add_parameter('state', - label=f'Channel {channum} state', - get_cmd=f'CHANnel{channum}:STATe?', - set_cmd=f'CHANnel{channum}:STATE {{}}', - vals=vals.Enum('ON', 'OFF'), - docstring='Switches the channel on or off') - - self.add_parameter('coupling', - label=f'Channel {channum} coupling', - get_cmd=f'CHANnel{channum}:COUPling?', - set_cmd=f'CHANnel{channum}:COUPling {{}}', - vals=vals.Enum('DC', 'DCLimit', 'AC'), - docstring=('Selects the connection of the channel' - 'signal. DC: 50 Ohm, DCLimit 1 MOhm, ' - 'AC: Con. through DC capacitor')) - - self.add_parameter('ground', - label=f'Channel {channum} ground', - get_cmd=f'CHANnel{channum}:GND?', - set_cmd=f'CHANnel{channum}:GND {{}}', - vals=vals.Enum('ON', 'OFF'), - docstring=('Connects/disconnects the signal to/from' - 'the ground.')) + self.state: Parameter = self.add_parameter( + "state", + label=f"Channel {channum} state", + get_cmd=f"CHANnel{channum}:STATe?", + set_cmd=f"CHANnel{channum}:STATE {{}}", + vals=vals.Enum("ON", "OFF"), + docstring="Switches the channel on or off", + ) + """Switches the channel on or off""" + + self.coupling: Parameter = self.add_parameter( + "coupling", + label=f"Channel {channum} coupling", + get_cmd=f"CHANnel{channum}:COUPling?", + set_cmd=f"CHANnel{channum}:COUPling {{}}", + vals=vals.Enum("DC", "DCLimit", "AC"), + docstring=( + "Selects the connection of the channel " + "signal. DC: 50 Ohm, DCLimit 1 MOhm, " + "AC: Con. through DC capacitor" + ), + ) + """ + Selects the connection of the channel signal. + DC: 50 Ohm, DCLimit 1 MOhm, AC: Con. through DC capacitor + """ + + self.ground: Parameter = self.add_parameter( + "ground", + label=f"Channel {channum} ground", + get_cmd=f"CHANnel{channum}:GND?", + set_cmd=f"CHANnel{channum}:GND {{}}", + vals=vals.Enum("ON", "OFF"), + docstring=("Connects/disconnects the signal to/from the ground."), + ) + """Connects/disconnects the signal to/from the ground.""" # NB (WilliamHPNielsen): This parameter depends on other parameters and # should be dynamically updated accordingly. Cf. p 1178 of the manual - self.add_parameter('scale', - label=f'Channel {channum} Y scale', - unit='V/div', - get_cmd=f'CHANnel{channum}:SCALe?', - set_cmd=self._set_scale, - get_parser=float, - ) - - self.add_parameter('range', - label=f'Channel {channum} Y range', - unit='V', - get_cmd=f'CHANnel{channum}:RANGe?', - set_cmd=self._set_range, - get_parser=float - ) + self.scale: Parameter = self.add_parameter( + "scale", + label=f"Channel {channum} Y scale", + unit="V/div", + get_cmd=f"CHANnel{channum}:SCALe?", + set_cmd=self._set_scale, + get_parser=float, + ) + """Parameter scale""" + + self.range: Parameter = self.add_parameter( + "range", + label=f"Channel {channum} Y range", + unit="V", + get_cmd=f"CHANnel{channum}:RANGe?", + set_cmd=self._set_range, + get_parser=float, + ) + """Parameter range""" # TODO (WilliamHPNielsen): would it be better to recast this in terms # of Volts? - self.add_parameter('position', - label=f'Channel {channum} vert. pos.', - unit='div', - get_cmd=f'CHANnel{channum}:POSition?', - set_cmd=f'CHANnel{channum}:POSition {{}}', - get_parser=float, - vals=vals.Numbers(-5, 5), - docstring=('Positive values move the waveform up,' - ' negative values move it down.')) - - self.add_parameter('offset', - label=f'Channel {channum} offset', - unit='V', - get_cmd=f'CHANnel{channum}:OFFSet?', - set_cmd=f'CHANnel{channum}:OFFSet {{}}', - get_parser=float, - ) - - self.add_parameter('invert', - label=f'Channel {channum} inverted', - get_cmd=f'CHANnel{channum}:INVert?', - set_cmd=f'CHANnel{channum}:INVert {{}}', - vals=vals.Enum('ON', 'OFF')) + self.position: Parameter = self.add_parameter( + "position", + label=f"Channel {channum} vert. pos.", + unit="div", + get_cmd=f"CHANnel{channum}:POSition?", + set_cmd=f"CHANnel{channum}:POSition {{}}", + get_parser=float, + vals=vals.Numbers(-5, 5), + docstring=( + "Positive values move the waveform up, negative values move it down." + ), + ) + """Positive values move the waveform up, negative values move it down.""" + + self.offset: Parameter = self.add_parameter( + "offset", + label=f"Channel {channum} offset", + unit="V", + get_cmd=f"CHANnel{channum}:OFFSet?", + set_cmd=f"CHANnel{channum}:OFFSet {{}}", + get_parser=float, + ) + """Parameter offset""" + + self.invert: Parameter = self.add_parameter( + "invert", + label=f"Channel {channum} inverted", + get_cmd=f"CHANnel{channum}:INVert?", + set_cmd=f"CHANnel{channum}:INVert {{}}", + vals=vals.Enum("ON", "OFF"), + ) + """Parameter invert""" # TODO (WilliamHPNielsen): This parameter should be dynamically # validated since 800 MHz BW is only available for 50 Ohm coupling - self.add_parameter('bandwidth', - label=f'Channel {channum} bandwidth', - get_cmd=f'CHANnel{channum}:BANDwidth?', - set_cmd=f'CHANnel{channum}:BANDwidth {{}}', - vals=vals.Enum('FULL', 'B800', 'B200', 'B20') - ) - - self.add_parameter('impedance', - label=f'Channel {channum} impedance', - unit='Ohm', - get_cmd=f'CHANnel{channum}:IMPedance?', - set_cmd=f'CHANnel{channum}:IMPedance {{}}', - vals=vals.Ints(1, 100000), - docstring=('Sets the impedance of the channel ' - 'for power calculations and ' - 'measurements.')) - - self.add_parameter('overload', - label=f'Channel {channum} overload', - get_cmd=f'CHANnel{channum}:OVERload?') - - self.add_parameter('arithmetics', - label=f'Channel {channum} arithmetics', - set_cmd=f'CHANnel{channum}:ARIThmetics {{}}', - get_cmd=f'CHANnel{channum}:ARIThmetics?', - val_mapping={'AVERAGE': 'AVER', - 'OFF': 'OFF', - 'ENVELOPE': 'ENV'} - ) - - self.add_parameter('trace', - channum=self.channum, - parameter_class=ScopeTrace) + self.bandwidth: Parameter = self.add_parameter( + "bandwidth", + label=f"Channel {channum} bandwidth", + get_cmd=f"CHANnel{channum}:BANDwidth?", + set_cmd=f"CHANnel{channum}:BANDwidth {{}}", + vals=vals.Enum("FULL", "B800", "B200", "B20"), + ) + """Parameter bandwidth""" + + self.impedance: Parameter = self.add_parameter( + "impedance", + label=f"Channel {channum} impedance", + unit="Ohm", + get_cmd=f"CHANnel{channum}:IMPedance?", + set_cmd=f"CHANnel{channum}:IMPedance {{}}", + vals=vals.Ints(1, 100000), + docstring=( + "Sets the impedance of the channel " + "for power calculations and " + "measurements." + ), + ) + """Sets the impedance of the channel for power calculations and measurements.""" + + self.overload: Parameter = self.add_parameter( + "overload", + label=f"Channel {channum} overload", + get_cmd=f"CHANnel{channum}:OVERload?", + ) + """Parameter overload""" + + self.arithmetics: Parameter = self.add_parameter( + "arithmetics", + label=f"Channel {channum} arithmetics", + set_cmd=f"CHANnel{channum}:ARIThmetics {{}}", + get_cmd=f"CHANnel{channum}:ARIThmetics?", + val_mapping={"AVERAGE": "AVER", "OFF": "OFF", "ENVELOPE": "ENV"}, + ) + """Parameter arithmetics""" + + self.trace: ScopeTrace = self.add_parameter( + "trace", channum=self.channum, parameter_class=ScopeTrace + ) + """Parameter trace""" self._trace_ready = False @@ -531,191 +595,255 @@ def __init__( self._horisontal_divs = int(self.ask('TIMebase:DIVisions?')) - self.add_parameter('display', - label='Display state', - set_cmd='SYSTem:DISPlay:UPDate {}', - val_mapping={'remote': 0, - 'view': 1}) + self.display: Parameter = self.add_parameter( + "display", + label="Display state", + set_cmd="SYSTem:DISPlay:UPDate {}", + val_mapping={"remote": 0, "view": 1}, + ) + """Parameter display""" # Triggering - self.add_parameter('trigger_display', - label='Trigger display state', - set_cmd='DISPlay:TRIGger:LINes {}', - get_cmd='DISPlay:TRIGger:LINes?', - val_mapping={'ON': 1, 'OFF': 0}) + self.trigger_display: Parameter = self.add_parameter( + "trigger_display", + label="Trigger display state", + set_cmd="DISPlay:TRIGger:LINes {}", + get_cmd="DISPlay:TRIGger:LINes?", + val_mapping={"ON": 1, "OFF": 0}, + ) + """Parameter trigger_display""" # TODO: (WilliamHPNielsen) There are more available trigger # settings than implemented here. See p. 1261 of the manual # here we just use trigger1, which is the A-trigger - self.add_parameter('trigger_source', - label='Trigger source', - set_cmd='TRIGger1:SOURce {}', - get_cmd='TRIGger1:SOURce?', - val_mapping={'CH1': 'CHAN1', - 'CH2': 'CHAN2', - 'CH3': 'CHAN3', - 'CH4': 'CHAN4', - 'EXT': 'EXT'}) - - self.add_parameter('trigger_mode', - label='Trigger mode', - set_cmd='TRIGger:MODE {}', - get_cmd='TRIGger1:SOURce?', - vals=vals.Enum('AUTO', 'NORMAL', 'FREERUN'), - docstring='Sets the trigger mode which determines' - ' the behaviour of the instrument if no' - ' trigger occurs.\n' - 'Options: AUTO, NORMAL, FREERUN.', - unit='none') - - self.add_parameter('trigger_type', - label='Trigger type', - set_cmd='TRIGger1:TYPE {}', - get_cmd='TRIGger1:TYPE?', - val_mapping={'EDGE': 'EDGE', - 'GLITCH': 'GLIT', - 'WIDTH': 'WIDT', - 'RUNT': 'RUNT', - 'WINDOW': 'WIND', - 'TIMEOUT': 'TIM', - 'INTERVAL': 'INT', - 'SLEWRATE': 'SLEW', - 'DATATOCLOCK': 'DAT', - 'STATE': 'STAT', - 'PATTERN': 'PATT', - 'ANEDGE': 'ANED', - 'SERPATTERN': 'SERP', - 'NFC': 'NFC', - 'TV': 'TV', - 'CDR': 'CDR'} - ) + self.trigger_source: Parameter = self.add_parameter( + "trigger_source", + label="Trigger source", + set_cmd="TRIGger1:SOURce {}", + get_cmd="TRIGger1:SOURce?", + val_mapping={ + "CH1": "CHAN1", + "CH2": "CHAN2", + "CH3": "CHAN3", + "CH4": "CHAN4", + "EXT": "EXT", + }, + ) + """Parameter trigger_source""" + + self.trigger_mode: Parameter = self.add_parameter( + "trigger_mode", + label="Trigger mode", + set_cmd="TRIGger:MODE {}", + get_cmd="TRIGger1:SOURce?", + vals=vals.Enum("AUTO", "NORMAL", "FREERUN"), + docstring="Sets the trigger mode which determines" + " the behaviour of the instrument if no" + " trigger occurs.\n" + "Options: AUTO, NORMAL, FREERUN.", + unit="none", + ) + """Sets the trigger mode which determines the behaviour of the instrument if no trigger occurs. +Options: AUTO, NORMAL, FREERUN.""" + + self.trigger_type: Parameter = self.add_parameter( + "trigger_type", + label="Trigger type", + set_cmd="TRIGger1:TYPE {}", + get_cmd="TRIGger1:TYPE?", + val_mapping={ + "EDGE": "EDGE", + "GLITCH": "GLIT", + "WIDTH": "WIDT", + "RUNT": "RUNT", + "WINDOW": "WIND", + "TIMEOUT": "TIM", + "INTERVAL": "INT", + "SLEWRATE": "SLEW", + "DATATOCLOCK": "DAT", + "STATE": "STAT", + "PATTERN": "PATT", + "ANEDGE": "ANED", + "SERPATTERN": "SERP", + "NFC": "NFC", + "TV": "TV", + "CDR": "CDR", + }, + ) + """Parameter trigger_type""" # See manual p. 1262 for an explanation of trigger types - self.add_parameter('trigger_level', - label='Trigger level', - set_cmd=self._set_trigger_level, - get_cmd=self._get_trigger_level) - - self.add_parameter('trigger_edge_slope', - label='Edge trigger slope', - set_cmd='TRIGger1:EDGE:SLOPe {}', - get_cmd='TRIGger1:EDGE:SLOPe?', - vals=vals.Enum('POS', 'NEG', 'EITH')) + self.trigger_level: Parameter = self.add_parameter( + "trigger_level", + label="Trigger level", + set_cmd=self._set_trigger_level, + get_cmd=self._get_trigger_level, + ) + """Parameter trigger_level""" + + self.trigger_edge_slope: Parameter = self.add_parameter( + "trigger_edge_slope", + label="Edge trigger slope", + set_cmd="TRIGger1:EDGE:SLOPe {}", + get_cmd="TRIGger1:EDGE:SLOPe?", + vals=vals.Enum("POS", "NEG", "EITH"), + ) + """Parameter trigger_edge_slope""" # Horizontal settings - self.add_parameter('timebase_scale', - label='Timebase scale', - set_cmd=self._set_timebase_scale, - get_cmd='TIMebase:SCALe?', - unit='s/div', - get_parser=float, - vals=vals.Numbers(25e-12, 10000)) - - self.add_parameter('timebase_range', - label='Timebase range', - set_cmd=self._set_timebase_range, - get_cmd='TIMebase:RANGe?', - unit='s', - get_parser=float, - vals=vals.Numbers(250e-12, 100e3)) - - self.add_parameter('timebase_position', - label='Horizontal position', - set_cmd=self._set_timebase_position, - get_cmd='TIMEbase:HORizontal:POSition?', - get_parser=float, - unit='s', - vals=vals.Numbers(-100e24, 100e24)) + self.timebase_scale: Parameter = self.add_parameter( + "timebase_scale", + label="Timebase scale", + set_cmd=self._set_timebase_scale, + get_cmd="TIMebase:SCALe?", + unit="s/div", + get_parser=float, + vals=vals.Numbers(25e-12, 10000), + ) + """Parameter timebase_scale""" + + self.timebase_range: Parameter = self.add_parameter( + "timebase_range", + label="Timebase range", + set_cmd=self._set_timebase_range, + get_cmd="TIMebase:RANGe?", + unit="s", + get_parser=float, + vals=vals.Numbers(250e-12, 100e3), + ) + """Parameter timebase_range""" + + self.timebase_position: Parameter = self.add_parameter( + "timebase_position", + label="Horizontal position", + set_cmd=self._set_timebase_position, + get_cmd="TIMEbase:HORizontal:POSition?", + get_parser=float, + unit="s", + vals=vals.Numbers(-100e24, 100e24), + ) + """Parameter timebase_position""" # Acquisition # I couldn't find a way to query the run mode, so we manually keep # track of it. It is very important when getting the trace to make # sense of completed_acquisitions. - self.add_parameter('run_mode', - label='Run/acquisition mode of the scope', - get_cmd=None, - set_cmd=None) + self.run_mode: Parameter = self.add_parameter( + "run_mode", + label="Run/acquisition mode of the scope", + get_cmd=None, + set_cmd=None, + ) + """Parameter run_mode""" self.run_mode('RUN CONT') - self.add_parameter('num_acquisitions', - label='Number of single acquisitions to perform', - get_cmd='ACQuire:COUNt?', - set_cmd='ACQuire:COUNt {}', - vals=vals.Ints(1, 16777215), - get_parser=int) - - self.add_parameter('completed_acquisitions', - label='Number of completed acquisitions', - get_cmd='ACQuire:CURRent?', - get_parser=int) - - self.add_parameter('sampling_rate', - label='Sample rate', - docstring='Number of averages for measuring ' - 'trace.', - unit='Sa/s', - get_cmd='ACQuire:POINts:ARATe' + '?', - get_parser=int) - - self.add_parameter('acquisition_sample_rate', - label='Acquisition sample rate', - unit='Sa/s', - docstring='recorded waveform samples per second', - get_cmd='ACQuire:SRATe'+'?', - set_cmd='ACQuire:SRATe ' + ' {:.2f}', - vals=vals.Numbers(2, 20e12), - get_parser=float) + self.num_acquisitions: Parameter = self.add_parameter( + "num_acquisitions", + label="Number of single acquisitions to perform", + get_cmd="ACQuire:COUNt?", + set_cmd="ACQuire:COUNt {}", + vals=vals.Ints(1, 16777215), + get_parser=int, + ) + """Parameter num_acquisitions""" + + self.completed_acquisitions: Parameter = self.add_parameter( + "completed_acquisitions", + label="Number of completed acquisitions", + get_cmd="ACQuire:CURRent?", + get_parser=int, + ) + """Parameter completed_acquisitions""" + + self.sampling_rate: Parameter = self.add_parameter( + "sampling_rate", + label="Sample rate", + docstring="Number of averages for measuring trace.", + unit="Sa/s", + get_cmd="ACQuire:POINts:ARATe" + "?", + get_parser=int, + ) + """Number of averages for measuring trace.""" + + self.acquisition_sample_rate: Parameter = self.add_parameter( + "acquisition_sample_rate", + label="Acquisition sample rate", + unit="Sa/s", + docstring="recorded waveform samples per second", + get_cmd="ACQuire:SRATe" + "?", + set_cmd="ACQuire:SRATe " + " {:.2f}", + vals=vals.Numbers(2, 20e12), + get_parser=float, + ) + """recorded waveform samples per second""" # Data - self.add_parameter('dataformat', - label='Export data format', - set_cmd='FORMat:DATA {}', - get_cmd='FORMat:DATA?', - vals=vals.Enum('ASC,0', 'REAL,32', - 'INT,8', 'INT,16')) + self.dataformat: Parameter = self.add_parameter( + "dataformat", + label="Export data format", + set_cmd="FORMat:DATA {}", + get_cmd="FORMat:DATA?", + vals=vals.Enum("ASC,0", "REAL,32", "INT,8", "INT,16"), + ) + """Parameter dataformat""" # High definition mode (might not be available on all instruments) if HD: - self.add_parameter('high_definition_state', - label='High definition (16 bit) state', - set_cmd=self._set_hd_mode, - get_cmd='HDEFinition:STAte?', - val_mapping=create_on_off_val_mapping(on_val=1, - off_val=0), - docstring='Sets the filter bandwidth for the' - ' high definition mode.\n' - 'ON: high definition mode, up to 16' - ' bit digital resolution\n' - 'Options: ON, OFF\n\n' - 'Warning/Bug: By opening the HD ' - 'acquisition menu on the scope, ' - 'this value will be set to "ON".') - - self.add_parameter('high_definition_bandwidth', - label='High definition mode bandwidth', - set_cmd='HDEFinition:BWIDth {}', - get_cmd='HDEFinition:BWIDth?', - unit='Hz', - get_parser=float, - vals=vals.Numbers(1e4, 1e9)) - - self.add_parameter('error_count', - label='Number of errors in the error stack', - get_cmd='SYSTem:ERRor:COUNt?', - unit='#', - get_parser=int) - - self.add_parameter('error_next', - label='Next error from the error stack', - get_cmd='SYSTem:ERRor:NEXT?', - get_parser=str) + self.high_definition_state: Parameter = self.add_parameter( + "high_definition_state", + label="High definition (16 bit) state", + set_cmd=self._set_hd_mode, + get_cmd="HDEFinition:STAte?", + val_mapping=create_on_off_val_mapping(on_val=1, off_val=0), + docstring="Sets the filter bandwidth for the" + " high definition mode.\n" + "ON: high definition mode, up to 16" + " bit digital resolution\n" + "Options: ON, OFF\n\n" + "Warning/Bug: By opening the HD " + "acquisition menu on the scope, " + 'this value will be set to "ON".', + ) + """Sets the filter bandwidth for the high definition mode. +ON: high definition mode, up to 16 bit digital resolution +Options: ON, OFF + +Warning/Bug: By opening the HD acquisition menu on the scope, this value will be set to "ON".""" + + self.high_definition_bandwidth: Parameter = self.add_parameter( + "high_definition_bandwidth", + label="High definition mode bandwidth", + set_cmd="HDEFinition:BWIDth {}", + get_cmd="HDEFinition:BWIDth?", + unit="Hz", + get_parser=float, + vals=vals.Numbers(1e4, 1e9), + ) + """Parameter high_definition_bandwidth""" + + self.error_count: Parameter = self.add_parameter( + "error_count", + label="Number of errors in the error stack", + get_cmd="SYSTem:ERRor:COUNt?", + unit="#", + get_parser=int, + ) + """Parameter error_count""" + + self.error_next: Parameter = self.add_parameter( + "error_next", + label="Next error from the error stack", + get_cmd="SYSTem:ERRor:NEXT?", + get_parser=str, + ) + """Parameter error_next""" # Add the channels to the instrument for ch in range(1, self.num_chans + 1): @@ -728,13 +856,16 @@ def __init__( ) self.add_submodule(f"meas{measId}", measCh) - self.add_function('stop', call_cmd='STOP') - self.add_function('reset', call_cmd='*RST') - self.add_parameter('opc', get_cmd='*OPC?') - self.add_parameter('stop_opc', get_cmd='STOP;*OPC?') - self.add_parameter('status_operation', - get_cmd='STATus:OPERation:CONDition?', - get_parser=int) + self.add_function("stop", call_cmd="STOP") + self.add_function("reset", call_cmd="*RST") + self.opc: Parameter = self.add_parameter("opc", get_cmd="*OPC?") + """Parameter opc""" + self.stop_opc: Parameter = self.add_parameter("stop_opc", get_cmd="STOP;*OPC?") + """Parameter stop_opc""" + self.status_operation: Parameter = self.add_parameter( + "status_operation", get_cmd="STATus:OPERation:CONDition?", get_parser=int + ) + """Parameter status_operation""" self.add_function('run_continues', call_cmd='RUNContinous') # starts the shutdown of the system self.add_function('system_shutdown', call_cmd='SYSTem:EXIT') diff --git a/src/qcodes/instrument_drivers/rohde_schwarz/Rohde_Schwarz_ZNB20.py b/src/qcodes/instrument_drivers/rohde_schwarz/Rohde_Schwarz_ZNB20.py index 5a4cd33de8f..f4f95849bd9 100644 --- a/src/qcodes/instrument_drivers/rohde_schwarz/Rohde_Schwarz_ZNB20.py +++ b/src/qcodes/instrument_drivers/rohde_schwarz/Rohde_Schwarz_ZNB20.py @@ -1,7 +1,7 @@ -from .ZNB import ZNB +from .ZNB import RohdeSchwarzZNBBase -class RohdeSchwarzZNB20(ZNB): +class RohdeSchwarzZNB20(RohdeSchwarzZNBBase): """ QCoDeS driver for Rohde & Schwarz ZNB20 diff --git a/src/qcodes/instrument_drivers/rohde_schwarz/Rohde_Schwarz_ZNB8.py b/src/qcodes/instrument_drivers/rohde_schwarz/Rohde_Schwarz_ZNB8.py index e26189b0acc..7eee00ba4fd 100644 --- a/src/qcodes/instrument_drivers/rohde_schwarz/Rohde_Schwarz_ZNB8.py +++ b/src/qcodes/instrument_drivers/rohde_schwarz/Rohde_Schwarz_ZNB8.py @@ -1,9 +1,9 @@ # Ensuring backwards compatibility -from .ZNB import ZNB +from .ZNB import RohdeSchwarzZNBBase -class RohdeSchwarzZNB8(ZNB): +class RohdeSchwarzZNB8(RohdeSchwarzZNBBase): """ QCoDeS driver for Rohde & Schwarz ZNB8 diff --git a/src/qcodes/instrument_drivers/rohde_schwarz/SGS100A.py b/src/qcodes/instrument_drivers/rohde_schwarz/SGS100A.py index f68ca8b56ef..130f504bbbf 100644 --- a/src/qcodes/instrument_drivers/rohde_schwarz/SGS100A.py +++ b/src/qcodes/instrument_drivers/rohde_schwarz/SGS100A.py @@ -7,6 +7,8 @@ if TYPE_CHECKING: from typing_extensions import Unpack + from qcodes.parameters import Parameter + class RohdeSchwarzSGS100A(VisaInstrument): """ @@ -40,7 +42,7 @@ def __init__( ) -> None: super().__init__(name, address, **kwargs) - self.add_parameter( + self.frequency: Parameter = self.add_parameter( name="frequency", label="Frequency", unit="Hz", @@ -49,7 +51,8 @@ def __init__( get_parser=float, vals=vals.Numbers(1e6, 20e9), ) - self.add_parameter( + """Parameter frequency""" + self.phase: Parameter = self.add_parameter( name="phase", label="Phase", unit="deg", @@ -58,7 +61,8 @@ def __init__( get_parser=float, vals=vals.Numbers(0, 360), ) - self.add_parameter( + """Parameter phase""" + self.power: Parameter = self.add_parameter( name="power", label="Power", unit="dBm", @@ -67,82 +71,93 @@ def __init__( get_parser=float, vals=vals.Numbers(-120, 25), ) - self.add_parameter( + """Parameter power""" + self.status: Parameter = self.add_parameter( "status", label="RF Output", get_cmd=":OUTP:STAT?", set_cmd=":OUTP:STAT {}", val_mapping=create_on_off_val_mapping(on_val="1", off_val="0"), ) - self.add_parameter( + """Parameter status""" + self.IQ_state: Parameter = self.add_parameter( "IQ_state", label="IQ Modulation", get_cmd=":IQ:STAT?", set_cmd=":IQ:STAT {}", val_mapping=create_on_off_val_mapping(on_val="1", off_val="0"), ) - self.add_parameter( + """Parameter IQ_state""" + self.pulsemod_state: Parameter = self.add_parameter( "pulsemod_state", label="Pulse Modulation", get_cmd=":SOUR:PULM:STAT?", set_cmd=":SOUR:PULM:STAT {}", val_mapping=create_on_off_val_mapping(on_val="1", off_val="0"), ) - self.add_parameter( + """Parameter pulsemod_state""" + self.pulsemod_source: Parameter = self.add_parameter( "pulsemod_source", label="Pulse Modulation Source", get_cmd="SOUR:PULM:SOUR?", set_cmd="SOUR:PULM:SOUR {}", vals=vals.Enum("INT", "EXT", "int", "ext"), ) - self.add_parameter( + """Parameter pulsemod_source""" + self.ref_osc_source: Parameter = self.add_parameter( "ref_osc_source", label="Reference Oscillator Source", get_cmd="SOUR:ROSC:SOUR?", set_cmd="SOUR:ROSC:SOUR {}", vals=vals.Enum("INT", "EXT", "int", "ext"), ) + """Parameter ref_osc_source""" # Define LO source INT/EXT (Only with K-90 option) - self.add_parameter( + self.LO_source: Parameter = self.add_parameter( "LO_source", label="Local Oscillator Source", get_cmd="SOUR:LOSC:SOUR?", set_cmd="SOUR:LOSC:SOUR {}", vals=vals.Enum("INT", "EXT", "int", "ext"), ) + """Parameter LO_source""" # Define output at REF/LO Output (Only with K-90 option) - self.add_parameter( + self.ref_LO_out: Parameter = self.add_parameter( "ref_LO_out", label="REF/LO Output", get_cmd="CONN:REFL:OUTP?", set_cmd="CONN:REFL:OUTP {}", vals=vals.Enum("REF", "LO", "OFF", "ref", "lo", "off", "Off"), ) + """Parameter ref_LO_out""" # Frequency mw_source outputs when used as a reference - self.add_parameter( + self.ref_osc_output_freq: Parameter = self.add_parameter( "ref_osc_output_freq", label="Reference Oscillator Output Frequency", get_cmd="SOUR:ROSC:OUTP:FREQ?", set_cmd="SOUR:ROSC:OUTP:FREQ {}", vals=vals.Enum("10MHz", "100MHz", "1000MHz"), ) + """Parameter ref_osc_output_freq""" # Frequency of the external reference mw_source uses - self.add_parameter( + self.ref_osc_external_freq: Parameter = self.add_parameter( "ref_osc_external_freq", label="Reference Oscillator External Frequency", get_cmd="SOUR:ROSC:EXT:FREQ?", set_cmd="SOUR:ROSC:EXT:FREQ {}", vals=vals.Enum("10MHz", "100MHz", "1000MHz"), ) + """Parameter ref_osc_external_freq""" # IQ impairments - self.add_parameter( + self.IQ_impairments: Parameter = self.add_parameter( "IQ_impairments", label="IQ Impairments", get_cmd=":SOUR:IQ:IMP:STAT?", set_cmd=":SOUR:IQ:IMP:STAT {}", val_mapping=create_on_off_val_mapping(on_val="1", off_val="0"), ) - self.add_parameter( + """Parameter IQ_impairments""" + self.I_offset: Parameter = self.add_parameter( "I_offset", label="I Offset", get_cmd="SOUR:IQ:IMP:LEAK:I?", @@ -150,7 +165,8 @@ def __init__( get_parser=float, vals=vals.Numbers(-10, 10), ) - self.add_parameter( + """Parameter I_offset""" + self.Q_offset: Parameter = self.add_parameter( "Q_offset", label="Q Offset", get_cmd="SOUR:IQ:IMP:LEAK:Q?", @@ -158,7 +174,8 @@ def __init__( get_parser=float, vals=vals.Numbers(-10, 10), ) - self.add_parameter( + """Parameter Q_offset""" + self.IQ_gain_imbalance: Parameter = self.add_parameter( "IQ_gain_imbalance", label="IQ Gain Imbalance", get_cmd="SOUR:IQ:IMP:IQR?", @@ -166,7 +183,8 @@ def __init__( get_parser=float, vals=vals.Numbers(-1, 1), ) - self.add_parameter( + """Parameter IQ_gain_imbalance""" + self.IQ_angle: Parameter = self.add_parameter( "IQ_angle", label="IQ Angle Offset", get_cmd="SOUR:IQ:IMP:QUAD?", @@ -174,8 +192,9 @@ def __init__( get_parser=float, vals=vals.Numbers(-8, 8), ) + """Parameter IQ_angle""" # Determines the signal at the input/output of the multi purpose [TRIG] connector. - self.add_parameter( + self.trigger_connector_mode: Parameter = self.add_parameter( "trigger_connector_mode", label="Trigger Connector Mode", get_cmd="CONN:TRIG:OMOD?", @@ -193,8 +212,9 @@ def __init__( "pems", # same as PEMS ), ) + """Parameter trigger_connector_mode""" # Pulse modulator - self.add_parameter( + self.pulsemod_delay: Parameter = self.add_parameter( "pulsemod_delay", label="Pulse delay", unit="s", @@ -203,7 +223,8 @@ def __init__( get_parser=float, vals=vals.Numbers(0, 100), ) - self.add_parameter( + """Parameter pulsemod_delay""" + self.pulsemod_double_delay: Parameter = self.add_parameter( "pulsemod_double_delay", label="Pulse double delay", unit="s", @@ -212,7 +233,8 @@ def __init__( get_parser=float, vals=vals.Numbers(40e-9, 100), ) - self.add_parameter( + """Parameter pulsemod_double_delay""" + self.pulsemod_double_width: Parameter = self.add_parameter( "pulsemod_double_width", label="Double pulse second width", unit="s", @@ -221,14 +243,16 @@ def __init__( get_parser=float, vals=vals.Numbers(20e-9, 100), ) - self.add_parameter( + """Parameter pulsemod_double_width""" + self.pulsemod_mode: Parameter = self.add_parameter( "pulsemod_mode", label="Pulse modulation mode", get_cmd="SOUR:PULM:MODE?", set_cmd="SOUR:PULM:MODE {}", vals=vals.Enum("SING", "DOUB", "sing", "doub", "single", "double"), ) - self.add_parameter( + """Parameter pulsemod_mode""" + self.pulsemod_period: Parameter = self.add_parameter( "pulsemod_period", label="Pulse mode period", unit="s", @@ -237,36 +261,41 @@ def __init__( get_parser=float, vals=vals.Numbers(100e-9, 100), ) - self.add_parameter( + """Parameter pulsemod_period""" + self.pulsemod_polarity: Parameter = self.add_parameter( "pulsemod_polarity", label="Pulse modulator signal polarity", get_cmd="SOUR:PULM:POL?", set_cmd="SOUR:PULM:POL {}", vals=vals.Enum("NORM", "INV", "norm", "inv", "normal", "inverted"), ) - self.add_parameter( + """Parameter pulsemod_polarity""" + self.pulsemod_trig_ext_gate_polarity: Parameter = self.add_parameter( "pulsemod_trig_ext_gate_polarity", label="Polarity of the Gate signal", get_cmd="SOUR:PULM:TRIG:EXT:GATE:POL?", set_cmd="SOUR:PULM:TRIG:EXT:GATE:POL {}", vals=vals.Enum("NORM", "INV", "norm", "inv", "normal", "inverted"), ) - self.add_parameter( + """Parameter pulsemod_trig_ext_gate_polarity""" + self.pulsemod_trig_ext_impedance: Parameter = self.add_parameter( "pulsemod_trig_ext_impedance", label="Impedance of the external pulse trigger", get_cmd="SOUR:PULM:TRIG:EXT:IMP?", set_cmd="SOUR:PULM:TRIG:EXT:IMP {}", vals=vals.Enum("G50", "G10K"), ) + """Parameter pulsemod_trig_ext_impedance""" # Sets the polarity of the active slope of an externally applied trigger signal. - self.add_parameter( + self.pulsemod_trig_ext_slope: Parameter = self.add_parameter( "pulsemod_trig_ext_slope", label="external pulse trigger active slope", get_cmd="SOUR:PULM:TRIG:EXT:SLOP?", set_cmd="SOUR:PULM:TRIG:EXT:SLOP {}", vals=vals.Enum("NEG", "POS", "neg", "pos", "negative", "positive"), ) - self.add_parameter( + """Parameter pulsemod_trig_ext_slope""" + self.pulsemod_trig_mode: Parameter = self.add_parameter( "pulsemod_trig_mode", label="external pulse trigger active slope", get_cmd="SOUR:PULM:TRIG:MODE?", @@ -275,7 +304,8 @@ def __init__( "AUTO", "EXT", "EGAT", "auto", "ext", "egat", "external", "egate" ), ) - self.add_parameter( + """Parameter pulsemod_trig_mode""" + self.pulsemod_width: Parameter = self.add_parameter( "pulsemod_width", label="Pulse width", unit="s", @@ -284,6 +314,7 @@ def __init__( get_parser=float, vals=vals.Numbers(20e-9, 100), ) + """Parameter pulsemod_width""" self.add_function("reset", call_cmd="*RST") self.add_function("run_self_tests", call_cmd="*TST?") diff --git a/src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py b/src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py index b812aa10537..d40ff4a6991 100644 --- a/src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py +++ b/src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py @@ -3,6 +3,7 @@ from typing import TYPE_CHECKING, Any, Optional import numpy as np +from typing_extensions import deprecated import qcodes.validators as vals from qcodes.instrument import ( @@ -17,9 +18,11 @@ ArrayParameter, ManualParameter, MultiParameter, + Parameter, ParamRawDataType, create_on_off_val_mapping, ) +from qcodes.utils import QCoDeSDeprecationWarning if TYPE_CHECKING: from typing_extensions import Unpack @@ -354,7 +357,7 @@ def get_raw(self) -> ParamRawDataType: class RohdeSchwarzZNBChannel(InstrumentChannel): def __init__( self, - parent: "ZNB", + parent: "RohdeSchwarzZNBBase", name: str, channel: int, vna_parameter: Optional[str] = None, @@ -422,14 +425,15 @@ def __init__( self._min_source_power: float self._min_source_power = self._model_min_source_power[model] - self.add_parameter( + self.vna_parameter: Parameter = self.add_parameter( name="vna_parameter", label="VNA parameter", get_cmd=f"CALC{self._instrument_channel}:PAR:MEAS? " f"'{self._tracename}'", get_parser=self._strip, ) - self.add_parameter( + """Parameter vna_parameter""" + self.power: Parameter = self.add_parameter( name="power", label="Power", unit="dBm", @@ -438,7 +442,8 @@ def __init__( get_parser=float, vals=vals.Numbers(self._min_source_power, 25), ) - self.add_parameter( + """Parameter power""" + self.bandwidth: Parameter = self.add_parameter( name="bandwidth", label="Bandwidth", unit="Hz", @@ -456,7 +461,13 @@ def __init__( "(p. 4 of manual) that does not get taken " "into account here.", ) - self.add_parameter( + """ + Measurement bandwidth of the IF filter. + The inverse of this sets the integration time per point. + There is an 'increased bandwidth option' (p. 4 of manual) + that does not get taken into account here. + """ + self.avg: Parameter = self.add_parameter( name="avg", label="Averages", unit="", @@ -465,7 +476,8 @@ def __init__( get_parser=int, vals=vals.Ints(1, 5000), ) - self.add_parameter( + """Parameter avg""" + self.start: Parameter = self.add_parameter( name="start", get_cmd=f"SENS{n}:FREQ:START?", set_cmd=self._set_start, @@ -473,7 +485,8 @@ def __init__( vals=vals.Numbers(self._parent._min_freq, self._parent._max_freq - 10), ) - self.add_parameter( + """Parameter start""" + self.stop: Parameter = self.add_parameter( name="stop", get_cmd=f"SENS{n}:FREQ:STOP?", set_cmd=self._set_stop, @@ -481,7 +494,8 @@ def __init__( vals=vals.Numbers(self._parent._min_freq + 1, self._parent._max_freq), ) - self.add_parameter( + """Parameter stop""" + self.center: Parameter = self.add_parameter( name="center", get_cmd=f"SENS{n}:FREQ:CENT?", set_cmd=self._set_center, @@ -490,7 +504,8 @@ def __init__( self._parent._min_freq + 0.5, self._parent._max_freq - 10 ), ) - self.add_parameter( + """Parameter center""" + self.span: Parameter = self.add_parameter( name="span", get_cmd=f"SENS{n}:FREQ:SPAN?", set_cmd=self._set_span, @@ -498,19 +513,22 @@ def __init__( vals=vals.Numbers(1, self._parent._max_freq - self._parent._min_freq), ) - self.add_parameter( + """Parameter span""" + self.npts: Parameter = self.add_parameter( name="npts", get_cmd=f"SENS{n}:SWE:POIN?", set_cmd=self._set_npts, get_parser=int, ) - self.add_parameter( + """Parameter npts""" + self.status: Parameter = self.add_parameter( name="status", get_cmd=f"CONF:CHAN{n}:MEAS?", set_cmd=f"CONF:CHAN{n}:MEAS {{}}", get_parser=int, ) - self.add_parameter( + """Parameter status""" + self.format: Parameter = self.add_parameter( name="format", get_cmd=partial(self._get_format, tracename=self._tracename), set_cmd=self._set_format, @@ -529,8 +547,9 @@ def __init__( "Complex": "COMP\n", }, ) + """Parameter format""" - self.add_parameter( + self.trace_mag_phase: FrequencySweepMagPhase = self.add_parameter( name="trace_mag_phase", start=self.start(), stop=self.stop(), @@ -538,8 +557,9 @@ def __init__( channel=n, parameter_class=FrequencySweepMagPhase, ) + """Parameter trace_mag_phase""" - self.add_parameter( + self.trace_db_phase: FrequencySweepDBPhase = self.add_parameter( name="trace_db_phase", start=self.start(), stop=self.stop(), @@ -547,7 +567,8 @@ def __init__( channel=n, parameter_class=FrequencySweepDBPhase, ) - self.add_parameter( + """Parameter trace_db_phase""" + self.trace: FrequencySweep = self.add_parameter( name="trace", start=self.start(), stop=self.stop(), @@ -555,7 +576,8 @@ def __init__( channel=n, parameter_class=FrequencySweep, ) - self.add_parameter( + """Parameter trace""" + self.electrical_delay: Parameter = self.add_parameter( name="electrical_delay", label="Electrical delay", get_cmd=f"SENS{n}:CORR:EDEL2:TIME?", @@ -563,14 +585,16 @@ def __init__( get_parser=float, unit="s", ) - self.add_parameter( + """Parameter electrical_delay""" + self.sweep_time: Parameter = self.add_parameter( name="sweep_time", label="Sweep time", get_cmd=f"SENS{n}:SWE:TIME?", get_parser=float, unit="s", ) - self.add_parameter( + """Parameter sweep_time""" + self.sweep_type: Parameter = self.add_parameter( name="sweep_type", get_cmd=f"SENS{n}:SWE:TYPE?", set_cmd=self._set_sweep_type, @@ -590,7 +614,13 @@ def __init__( "CW_Point modes have supporting " "measurement parameters.", ) - self.add_parameter( + """ + The sweep_type parameter is used to set the type of measurement sweeps. + It allows switching the default linear VNA sweep type to other types. + Note that at the moment only the linear and CW_Point modes + have supporting measurement parameters. + """ + self.cw_frequency: Parameter = self.add_parameter( name="cw_frequency", get_cmd=f"SENS{n}:FREQ:CW?", set_cmd=self._set_cw_frequency, @@ -602,8 +632,12 @@ def __init__( "querying for it when VNA sweep type is " "set to CW_Point mode.", ) + """ + Parameter for setting frequency and querying for it + when VNA sweep type is set to CW_Point mode. + """ - self.add_parameter( + self.cw_check_sweep_first: ManualParameter = self.add_parameter( "cw_check_sweep_first", parameter_class=ManualParameter, initial_value=True, @@ -616,21 +650,32 @@ def __init__( "one wants to minimize overhead in fast " "measurements. ", ) + """ + Parameter that enables a few commands which are called before each get + in continuous wave mode checking whether the vna is setup correctly. + Is recommended to be turned, but can be turned off if + one wants to minimize overhead in fast measurements. + """ - self.add_parameter( + self.trace_fixed_frequency: FixedFrequencyTraceIQ = self.add_parameter( name="trace_fixed_frequency", npts=self.npts(), bandwidth=self.bandwidth(), parameter_class=FixedFrequencyTraceIQ, ) - self.add_parameter( + """Parameter trace_fixed_frequency""" + self.point_fixed_frequency: FixedFrequencyPointIQ = self.add_parameter( name="point_fixed_frequency", parameter_class=FixedFrequencyPointIQ ) - self.add_parameter( - name="point_fixed_frequency_mag_phase", - parameter_class=FixedFrequencyPointMagPhase, + """Parameter point_fixed_frequency""" + self.point_fixed_frequency_mag_phase: FixedFrequencyPointMagPhase = ( + self.add_parameter( + name="point_fixed_frequency_mag_phase", + parameter_class=FixedFrequencyPointMagPhase, + ) ) - self.add_parameter( + """Parameter point_fixed_frequency_mag_phase""" + self.averaging_enabled: Parameter = self.add_parameter( name="averaging_enabled", initial_value=False, get_cmd=None, @@ -638,7 +683,8 @@ def __init__( vals=vals.Bool(), val_mapping=create_on_off_val_mapping(on_val="ON", off_val="OFF"), ) - self.add_parameter( + """Parameter averaging_enabled""" + self.auto_sweep_time_enabled: Parameter = self.add_parameter( name="auto_sweep_time_enabled", initial_value=False, get_cmd=None, @@ -649,6 +695,10 @@ def __init__( "calculated internally using the other channel settings " "and zero delay", ) + """ + When enabled, the (minimum) sweep time is calculated internally + using the other channel settings and zero delay + """ self.add_function( "set_electrical_delay_auto", call_cmd=f"SENS{n}:CORR:EDEL:AUTO ONCE" @@ -943,11 +993,12 @@ def _get_timeout(self) -> float: ZNBChannel = RohdeSchwarzZNBChannel -class ZNB(VisaInstrument): +class RohdeSchwarzZNBBase(VisaInstrument): """ - QCoDeS driver for the Rohde & Schwarz ZNB8 and ZNB20 + Base class for QCoDeS driver for the Rohde & Schwarz ZNB8 and ZNB20 virtual network analyser. It can probably be extended to ZNB4 and 40 - without too much work. + without too much work. This class should not be instantiated directly + the RohdeSchwarzZNB8 and RohdeSchwarzZNB20 should be used instead. Requires FrequencySweep parameter for taking a trace @@ -1001,17 +1052,19 @@ def __init__( self._max_freq: float self._min_freq, self._max_freq = m_frequency[model] - self.add_parameter(name="num_ports", - get_cmd="INST:PORT:COUN?", - get_parser=int) + self.num_ports: Parameter = self.add_parameter( + name="num_ports", get_cmd="INST:PORT:COUN?", get_parser=int + ) + """Parameter num_ports""" num_ports = self.num_ports() - self.add_parameter( + self.rf_power: Parameter = self.add_parameter( name="rf_power", get_cmd="OUTP1?", set_cmd="OUTP1 {}", val_mapping={True: "1\n", False: "0\n"}, ) + """Parameter rf_power""" self.add_function("reset", call_cmd="*RST") self.add_function("tooltip_on", call_cmd="SYST:ERR:DISP ON") self.add_function("tooltip_off", call_cmd="SYST:ERR:DISP OFF") @@ -1083,3 +1136,11 @@ def clear_channels(self) -> None: for submodule in self.submodules.values(): if isinstance(submodule, ChannelList): submodule.clear() + + +@deprecated( + "The ZNB base class has been renamed RohdeSchwarzZNBBase", + category=QCoDeSDeprecationWarning, +) +class ZNB(RohdeSchwarzZNBBase): + pass diff --git a/src/qcodes/instrument_drivers/rohde_schwarz/ZNB20.py b/src/qcodes/instrument_drivers/rohde_schwarz/ZNB20.py index 0dec0995016..819a71eb72d 100644 --- a/src/qcodes/instrument_drivers/rohde_schwarz/ZNB20.py +++ b/src/qcodes/instrument_drivers/rohde_schwarz/ZNB20.py @@ -1,5 +1,5 @@ # Ensuring backwards compatibility -from .ZNB import ZNB +from .ZNB import RohdeSchwarzZNBBase -ZNB20 = ZNB +ZNB20 = RohdeSchwarzZNBBase diff --git a/src/qcodes/instrument_drivers/rohde_schwarz/__init__.py b/src/qcodes/instrument_drivers/rohde_schwarz/__init__.py index 03b38cf0e2c..21ad88de1cd 100644 --- a/src/qcodes/instrument_drivers/rohde_schwarz/__init__.py +++ b/src/qcodes/instrument_drivers/rohde_schwarz/__init__.py @@ -6,7 +6,7 @@ RohdeSchwarzRTO1000ScopeMeasurement, ) from .SGS100A import RohdeSchwarzSGS100A -from .ZNB import RohdeSchwarzZNBChannel +from .ZNB import RohdeSchwarzZNBBase, RohdeSchwarzZNBChannel __all__ = [ "RohdeSchwarzRTO1000", @@ -15,5 +15,6 @@ "RohdeSchwarzSGS100A", "RohdeSchwarzZNB20", "RohdeSchwarzZNB8", + "RohdeSchwarzZNBBase", "RohdeSchwarzZNBChannel", ]