Skip to content

Commit

Permalink
Keysight before B models
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshnielsen committed May 14, 2024
1 parent 5a22d11 commit 1fe9835
Show file tree
Hide file tree
Showing 16 changed files with 221 additions and 67 deletions.
40 changes: 32 additions & 8 deletions src/qcodes/instrument_drivers/Keysight/Infiniium.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
from qcodes.instrument import (
ChannelList,
InstrumentBase,
InstrumentBaseKWArgs,
InstrumentChannel,
InstrumentModule,
VisaInstrument,
VisaInstrumentKWArgs,
)
from qcodes.parameters import (
Parameter,
Expand All @@ -23,6 +25,8 @@
if TYPE_CHECKING:
from collections.abc import Sequence

from typing_extensions import Unpack


class DSOTimeAxisParam(Parameter):
"""
Expand Down Expand Up @@ -244,7 +248,12 @@ class AbstractMeasurementSubsystem(InstrumentModule):
the measurement value.
"""

def __init__(self, parent: InstrumentBase, name: str, **kwargs: Any) -> None:
def __init__(
self,
parent: InstrumentBase,
name: str,
**kwargs: "Unpack[InstrumentBaseKWArgs]",
) -> None:
"""
Add parameters to measurement subsystem. Note: This should not be initialized
directly, rather initialize BoundMeasurementSubsystem
Expand Down Expand Up @@ -458,7 +467,7 @@ def __init__(
self,
parent: Union["KeysightInfiniiumChannel", "KeysightInfiniiumFunction"],
name: str,
**kwargs: Any,
**kwargs: "Unpack[InstrumentBaseKWArgs]",
):
"""
Initialize measurement subsystem bound to a specific channel
Expand All @@ -477,7 +486,12 @@ def __init__(


class KeysightInfiniiumUnboundMeasurement(AbstractMeasurementSubsystem):
def __init__(self, parent: "KeysightInfiniium", name: str, **kwargs: Any):
def __init__(
self,
parent: "KeysightInfiniium",
name: str,
**kwargs: "Unpack[InstrumentBaseKWArgs]",
):
"""
Initialize measurement subsystem where target is set by the parameter `source`.
"""
Expand Down Expand Up @@ -553,7 +567,11 @@ def _get_source(self) -> str:

class KeysightInfiniiumFunction(InstrumentChannel):
def __init__(
self, parent: "KeysightInfiniium", name: str, channel: int, **kwargs: Any
self,
parent: "KeysightInfiniium",
name: str,
channel: int,
**kwargs: "Unpack[InstrumentBaseKWArgs]",
):
"""
Initialize an infiniium channel.
Expand Down Expand Up @@ -671,7 +689,11 @@ def _get_func(self) -> str:

class KeysightInfiniiumChannel(InstrumentChannel):
def __init__(
self, parent: "KeysightInfiniium", name: str, channel: int, **kwargs: Any
self,
parent: "KeysightInfiniium",
name: str,
channel: int,
**kwargs: "Unpack[InstrumentBaseKWArgs]",
):
"""
Initialize an infiniium channel.
Expand Down Expand Up @@ -777,14 +799,16 @@ class KeysightInfiniium(VisaInstrument):
This is the QCoDeS driver for the Keysight Infiniium oscilloscopes
"""

default_timeout = 20
default_terminator = "\n"

def __init__(
self,
name: str,
address: str,
timeout: float = 20,
channels: int = 4,
silence_pyvisapy_warning: bool = False,
**kwargs: Any,
**kwargs: "Unpack[VisaInstrumentKWArgs]",
):
"""
Initialises the oscilloscope.
Expand All @@ -797,7 +821,7 @@ def __init__(
silence_pyvisapy_warning: Don't warn about pyvisa-py at startup
**kwargs: kwargs are forwarded to base class.
"""
super().__init__(name, address, timeout=timeout, terminator="\n", **kwargs)
super().__init__(name, address, **kwargs)

Check warning on line 824 in src/qcodes/instrument_drivers/Keysight/Infiniium.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/Keysight/Infiniium.py#L824

Added line #L824 was not covered by tests
self.connect_message()

# Check if we are using pyvisa-py as our visa lib and warn users that
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
from typing import Any
from typing import TYPE_CHECKING

from .private.Keysight_344xxA_submodules import _Keysight_344xxA

if TYPE_CHECKING:
from typing_extensions import Unpack

from qcodes.instrument import VisaInstrumentKWArgs


class Keysight34410A(_Keysight_344xxA):
"""
This is the qcodes driver for the Keysight 34410A Multimeter
"""
def __init__(self, name: str, address: str, silent: bool = False,
**kwargs: Any):

def __init__(
self,
name: str,
address: str,
silent: bool = False,
**kwargs: "Unpack[VisaInstrumentKWArgs]",
):
super().__init__(name, address, silent, **kwargs)


Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
from typing import Any
from typing import TYPE_CHECKING

from .private.Keysight_344xxA_submodules import _Keysight_344xxA

if TYPE_CHECKING:
from typing_extensions import Unpack

from qcodes.instrument import VisaInstrumentKWArgs


class Keysight34411A(_Keysight_344xxA):
"""
This is the qcodes driver for the Keysight 34411A Multimeter
"""
def __init__(self, name: str, address: str, silent: bool = False,
**kwargs: Any):

def __init__(
self,
name: str,
address: str,
silent: bool = False,
**kwargs: "Unpack[VisaInstrumentKWArgs]",
):
super().__init__(name, address, silent, **kwargs)


Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
from typing import Any
from typing import TYPE_CHECKING

from .private.Keysight_344xxA_submodules import _Keysight_344xxA

if TYPE_CHECKING:
from typing_extensions import Unpack

from qcodes.instrument import VisaInstrumentKWArgs


class Keysight34460A(_Keysight_344xxA):
"""
This is the qcodes driver for the Keysight 34460A Multimeter
"""
def __init__(self, name: str, address: str, silent: bool = False,
**kwargs: Any):

def __init__(
self,
name: str,
address: str,
silent: bool = False,
**kwargs: "Unpack[VisaInstrumentKWArgs]",
):
super().__init__(name, address, silent, **kwargs)


Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
from typing import Any
from typing import TYPE_CHECKING

from .private.Keysight_344xxA_submodules import _Keysight_344xxA

if TYPE_CHECKING:
from typing_extensions import Unpack

from qcodes.instrument import VisaInstrumentKWArgs


class Keysight34461A(_Keysight_344xxA):
"""
This is the qcodes driver for the Keysight 34461A Multimeter
"""
def __init__(self, name: str, address: str, silent: bool = False,
**kwargs: Any):

def __init__(
self,
name: str,
address: str,
silent: bool = False,
**kwargs: "Unpack[VisaInstrumentKWArgs]",
):
super().__init__(name, address, silent, **kwargs)


Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
from typing import Any
from typing import TYPE_CHECKING

from .private.Keysight_344xxA_submodules import _Keysight_344xxA

if TYPE_CHECKING:
from typing_extensions import Unpack

from qcodes.instrument import VisaInstrumentKWArgs


class Keysight34465A(_Keysight_344xxA):
"""
This is the qcodes driver for the Keysight 34465A Multimeter
"""
def __init__(self, name: str, address: str, silent: bool = False,
**kwargs: Any):

def __init__(
self,
name: str,
address: str,
silent: bool = False,
**kwargs: "Unpack[VisaInstrumentKWArgs]",
):
super().__init__(name, address, silent, **kwargs)


Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
from typing import Any
from typing import TYPE_CHECKING

from .private.Keysight_344xxA_submodules import _Keysight_344xxA

if TYPE_CHECKING:
from typing_extensions import Unpack

from qcodes.instrument import VisaInstrumentKWArgs


class Keysight34470A(_Keysight_344xxA):
"""
This is the qcodes driver for the Keysight 34470A Multimeter
"""
def __init__(self, name: str, address: str, silent: bool = False,
**kwargs: Any):

def __init__(
self,
name: str,
address: str,
silent: bool = False,
**kwargs: "Unpack[VisaInstrumentKWArgs]",
):
super().__init__(name, address, silent, **kwargs)


Expand Down
11 changes: 9 additions & 2 deletions src/qcodes/instrument_drivers/Keysight/_Keysight_N5232B.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
from typing import Any
from typing import TYPE_CHECKING

from . import N52xx

if TYPE_CHECKING:
from typing_extensions import Unpack

from qcodes.instrument import VisaInstrumentKWArgs


class KeysightN5232B(N52xx.PNABase):
def __init__(self, name: str, address: str, **kwargs: Any):
def __init__(
self, name: str, address: str, **kwargs: "Unpack[VisaInstrumentKWArgs]"
):
super().__init__(
name,
address,
Expand Down
21 changes: 12 additions & 9 deletions src/qcodes/instrument_drivers/Keysight/keysight_34980a.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
import re
import warnings
from functools import wraps
from typing import Any, Callable, Optional, TypeVar
from typing import TYPE_CHECKING, Any, Callable, Optional, TypeVar

from qcodes import validators as vals
from qcodes.instrument import VisaInstrument
from qcodes.instrument import VisaInstrument, VisaInstrumentKWArgs

from .keysight_34934a import Keysight34934A
from .keysight_34980a_submodules import Keysight34980ASwitchMatrixSubModule

if TYPE_CHECKING:
from typing_extensions import Unpack

KEYSIGHT_MODELS = {'34934A': Keysight34934A}


Expand Down Expand Up @@ -45,21 +48,21 @@ class Keysight34980A(VisaInstrument):
"""
QCodes driver for 34980A switch/measure unit
"""
def __init__(self,
name: str,
address: str,
terminator: str = '\n',
**kwargs: Any):

default_terminator = "\n"

def __init__(
self, name: str, address: str, **kwargs: "Unpack[VisaInstrumentKWArgs]"
):
"""
Create an instance of the instrument.
Args:
name: Name of the instrument instance
address: Visa-resolvable instrument address.
terminator: Character to terminate messages with.
**kwargs: kwargs are forwarded to base class.
"""
super().__init__(name, address, terminator=terminator, **kwargs)
super().__init__(name, address, **kwargs)

self._total_slot = 8
self._system_slots_info_dict: Optional[dict[int, dict[str, str]]] = None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from typing import Optional, Union
from typing import TYPE_CHECKING, Optional, Union

from qcodes.instrument import InstrumentChannel, VisaInstrument
from qcodes.instrument import InstrumentBaseKWArgs, InstrumentChannel, VisaInstrument

if TYPE_CHECKING:
from typing_extensions import Unpack


class KeysightSubModule(InstrumentChannel):
Expand All @@ -13,13 +16,13 @@ class KeysightSubModule(InstrumentChannel):
slot: the slot the module is installed
"""
def __init__(
self,
parent: Union[VisaInstrument, InstrumentChannel],
name: str,
slot: int
self,
parent: Union[VisaInstrument, InstrumentChannel],
name: str,
slot: int,
**kwargs: "Unpack[InstrumentBaseKWArgs]",
) -> None:

super().__init__(parent, name)
super().__init__(parent, name, **kwargs)

self.slot = slot

Expand Down

0 comments on commit 1fe9835

Please sign in to comment.