Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Agilent drivers #6089

Merged
merged 4 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/changes/newsfragments/6089.improved_driver
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The Agilent 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 Agilent 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. It is the plan to make the same change to all drivers shipping
with QCoDeS in the near future.
1 change: 1 addition & 0 deletions docs/drivers_api/Agilent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Agilent Drivers

.. automodule:: qcodes.instrument_drivers.agilent
:autosummary:
:no-inherited-members:
31 changes: 28 additions & 3 deletions src/qcodes/instrument_drivers/agilent/Agilent_34401A.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
from ._Agilent_344xxA import _Agilent344xxA
from typing import TYPE_CHECKING

from qcodes.instrument import VisaInstrumentKWArgs
from qcodes.validators import Strings

class Agilent34401A(_Agilent344xxA):
from ._Agilent_344xxA import Agilent344xxA

if TYPE_CHECKING:
from typing_extensions import Unpack

from qcodes.instrument import VisaInstrumentKWArgs
from qcodes.parameters import Parameter


class Agilent34401A(Agilent344xxA):
"""
This is the QCoDeS driver for the Agilent 34401A DMM.
"""

pass
def __init__(
self,
name: str,
address: str,
**kwargs: "Unpack[VisaInstrumentKWArgs]",
) -> None:
super().__init__(name, address, **kwargs)

Check warning on line 26 in src/qcodes/instrument_drivers/agilent/Agilent_34401A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_34401A.py#L26

Added line #L26 was not covered by tests

self.display_text: Parameter = self.add_parameter(

Check warning on line 28 in src/qcodes/instrument_drivers/agilent/Agilent_34401A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_34401A.py#L28

Added line #L28 was not covered by tests
"display_text",
get_cmd="DISP:TEXT?",
set_cmd='DISP:TEXT "{}"',
vals=Strings(),
)
"""Parameter display_text"""

Check warning on line 34 in src/qcodes/instrument_drivers/agilent/Agilent_34401A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_34401A.py#L34

Added line #L34 was not covered by tests
39 changes: 36 additions & 3 deletions src/qcodes/instrument_drivers/agilent/Agilent_34410A.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,42 @@
from ._Agilent_344xxA import _Agilent344xxA
from typing import TYPE_CHECKING

from qcodes.instrument import VisaInstrumentKWArgs
from qcodes.validators import Strings

class Agilent34410A(_Agilent344xxA):
from ._Agilent_344xxA import Agilent344xxA

if TYPE_CHECKING:
from typing_extensions import Unpack

from qcodes.instrument import VisaInstrumentKWArgs
from qcodes.parameters import Parameter


class Agilent34410A(Agilent344xxA):
"""
This is the QCoDeS driver for the Agilent 34410A DMM.
"""

pass
def __init__(
self,
name: str,
address: str,
**kwargs: "Unpack[VisaInstrumentKWArgs]",
) -> None:
super().__init__(name, address, **kwargs)

Check warning on line 26 in src/qcodes/instrument_drivers/agilent/Agilent_34410A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_34410A.py#L26

Added line #L26 was not covered by tests

self.display_text: Parameter = self.add_parameter(

Check warning on line 28 in src/qcodes/instrument_drivers/agilent/Agilent_34410A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_34410A.py#L28

Added line #L28 was not covered by tests
"display_text",
get_cmd="DISP:WIND1:TEXT?",
set_cmd='DISP:WIND1:TEXT "{}"',
vals=Strings(),
)
"""Parameter display_text"""

Check warning on line 34 in src/qcodes/instrument_drivers/agilent/Agilent_34410A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_34410A.py#L34

Added line #L34 was not covered by tests

self.display_text_2: Parameter = self.add_parameter(

Check warning on line 36 in src/qcodes/instrument_drivers/agilent/Agilent_34410A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_34410A.py#L36

Added line #L36 was not covered by tests
"display_text_2",
get_cmd="DISP:WIND2:TEXT?",
set_cmd='DISP:WIND2:TEXT "{}"',
vals=Strings(),
)
"""Parameter display_text_2"""

Check warning on line 42 in src/qcodes/instrument_drivers/agilent/Agilent_34410A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_34410A.py#L42

Added line #L42 was not covered by tests
39 changes: 36 additions & 3 deletions src/qcodes/instrument_drivers/agilent/Agilent_34411A.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,42 @@
from ._Agilent_344xxA import _Agilent344xxA
from typing import TYPE_CHECKING

from qcodes.instrument import VisaInstrumentKWArgs
from qcodes.validators import Strings

class Agilent34411A(_Agilent344xxA):
from ._Agilent_344xxA import Agilent344xxA

if TYPE_CHECKING:
from typing_extensions import Unpack

from qcodes.instrument import VisaInstrumentKWArgs
from qcodes.parameters import Parameter


class Agilent34411A(Agilent344xxA):
"""
This is the QCoDeS driver for the Agilent 34411A DMM.
"""

pass
def __init__(
self,
name: str,
address: str,
**kwargs: "Unpack[VisaInstrumentKWArgs]",
) -> None:
super().__init__(name, address, **kwargs)

Check warning on line 26 in src/qcodes/instrument_drivers/agilent/Agilent_34411A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_34411A.py#L26

Added line #L26 was not covered by tests

self.display_text: Parameter = self.add_parameter(

Check warning on line 28 in src/qcodes/instrument_drivers/agilent/Agilent_34411A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_34411A.py#L28

Added line #L28 was not covered by tests
"display_text",
get_cmd="DISP:WIND1:TEXT?",
set_cmd='DISP:WIND1:TEXT "{}"',
vals=Strings(),
)
"""Parameter display_text"""

Check warning on line 34 in src/qcodes/instrument_drivers/agilent/Agilent_34411A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_34411A.py#L34

Added line #L34 was not covered by tests

self.display_text_2: Parameter = self.add_parameter(

Check warning on line 36 in src/qcodes/instrument_drivers/agilent/Agilent_34411A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_34411A.py#L36

Added line #L36 was not covered by tests
"display_text_2",
get_cmd="DISP:WIND2:TEXT?",
set_cmd='DISP:WIND2:TEXT "{}"',
vals=Strings(),
)
"""Parameter display_text_2"""

Check warning on line 42 in src/qcodes/instrument_drivers/agilent/Agilent_34411A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_34411A.py#L42

Added line #L42 was not covered by tests
14 changes: 9 additions & 5 deletions src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import qcodes.validators as vals
from qcodes.instrument import VisaInstrument, VisaInstrumentKWArgs
from qcodes.parameters import create_on_off_val_mapping
from qcodes.parameters import Parameter, create_on_off_val_mapping

if TYPE_CHECKING:
from typing_extensions import Unpack
Expand Down Expand Up @@ -91,7 +91,7 @@
self._min_power = -20
self._max_power = 5

self.add_parameter(
self.frequency: Parameter = self.add_parameter(

Check warning on line 94 in src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py#L94

Added line #L94 was not covered by tests
name="frequency",
label="Frequency",
unit="Hz",
Expand All @@ -101,8 +101,9 @@
set_parser=float,
vals=vals.Numbers(self._min_freq, self._max_freq),
)
"""Parameter frequency"""

Check warning on line 104 in src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py#L104

Added line #L104 was not covered by tests

self.add_parameter(
self.phase: Parameter = self.add_parameter(

Check warning on line 106 in src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py#L106

Added line #L106 was not covered by tests
name="phase",
label="Phase",
unit="deg",
Expand All @@ -112,8 +113,9 @@
set_parser=self.deg_to_rad,
vals=vals.Numbers(-180, 180),
)
"""Parameter phase"""

Check warning on line 116 in src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py#L116

Added line #L116 was not covered by tests

self.add_parameter(
self.power: Parameter = self.add_parameter(

Check warning on line 118 in src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py#L118

Added line #L118 was not covered by tests
name="power",
label="Power",
unit="dBm",
Expand All @@ -123,13 +125,15 @@
set_parser=float,
vals=vals.Numbers(self._min_power, self._max_power),
)
"""Parameter power"""

Check warning on line 128 in src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py#L128

Added line #L128 was not covered by tests

self.add_parameter(
self.output_enabled: Parameter = self.add_parameter(

Check warning on line 130 in src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py#L130

Added line #L130 was not covered by tests
"output_enabled",
get_cmd=":OUTP?",
set_cmd="OUTP {}",
val_mapping=create_on_off_val_mapping(on_val="1", off_val="0"),
)
"""Parameter output_enabled"""

Check warning on line 136 in src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py#L136

Added line #L136 was not covered by tests

self.connect_message()

Expand Down
30 changes: 21 additions & 9 deletions src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
if TYPE_CHECKING:
from typing_extensions import Unpack

from qcodes.parameters import Parameter


class AgilentE8267C(VisaInstrument):
"""
This is the QCoDeS driver for the Agilent E8267C signal generator.
Expand All @@ -23,7 +26,7 @@
) -> None:
super().__init__(name, address, **kwargs)
# general commands
self.add_parameter(
self.frequency: Parameter = self.add_parameter(

Check warning on line 29 in src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py#L29

Added line #L29 was not covered by tests
name="frequency",
label="Frequency",
unit="Hz",
Expand All @@ -32,7 +35,8 @@
get_parser=float,
vals=Numbers(min_value=100e3, max_value=40e9),
)
self.add_parameter(
"""Parameter frequency"""
self.freq_offset: Parameter = self.add_parameter(

Check warning on line 39 in src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py#L38-L39

Added lines #L38 - L39 were not covered by tests
name="freq_offset",
label="Frequency offset",
unit="Hz",
Expand All @@ -41,22 +45,25 @@
get_parser=float,
vals=Numbers(min_value=-200e9, max_value=200e9),
)
self.add_parameter(
"""Parameter freq_offset"""
self.freq_mode: Parameter = self.add_parameter(

Check warning on line 49 in src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py#L48-L49

Added lines #L48 - L49 were not covered by tests
"freq_mode",
label="Frequency mode",
set_cmd="FREQ:MODE {}",
get_cmd="FREQ:MODE?",
vals=Enum("FIX", "CW", "SWE", "LIST"),
)
self.add_parameter(
"""Parameter freq_mode"""
self.pulse_width: Parameter = self.add_parameter(

Check warning on line 57 in src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py#L56-L57

Added lines #L56 - L57 were not covered by tests
"pulse_width",
label="Pulse width",
unit="ns",
set_cmd="PULM:INT:PWID {}",
get_cmd="PULM:INT:PWID?",
vals=Numbers(min_value=10e-9, max_value=20e-9),
)
self.add_parameter(
"""Parameter pulse_width"""
self.phase: Parameter = self.add_parameter(

Check warning on line 66 in src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py#L65-L66

Added lines #L65 - L66 were not covered by tests
name="phase",
label="Phase",
unit="deg",
Expand All @@ -66,7 +73,8 @@
set_parser=self.deg_to_rad,
vals=Numbers(min_value=-180, max_value=179),
)
self.add_parameter(
"""Parameter phase"""
self.power: Parameter = self.add_parameter(

Check warning on line 77 in src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py#L76-L77

Added lines #L76 - L77 were not covered by tests
name="power",
label="Power",
unit="dBm",
Expand All @@ -75,7 +83,8 @@
get_parser=float,
vals=Numbers(min_value=-135, max_value=25),
)
self.add_parameter(
"""Parameter power"""
self.power_offset: Parameter = self.add_parameter(

Check warning on line 87 in src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py#L86-L87

Added lines #L86 - L87 were not covered by tests
name="power_offset",
label="Power offset",
unit="dBm",
Expand All @@ -84,18 +93,21 @@
get_parser=float,
vals=Numbers(min_value=-200, max_value=200),
)
self.add_parameter(
"""Parameter power_offset"""
self.output_rf: Parameter = self.add_parameter(

Check warning on line 97 in src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py#L96-L97

Added lines #L96 - L97 were not covered by tests
name="output_rf",
get_cmd="OUTP?",
set_cmd="OUTP {}",
val_mapping={"OFF": 0, "ON": 1},
)
self.add_parameter(
"""Parameter output_rf"""
self.modulation_rf: Parameter = self.add_parameter(

Check warning on line 104 in src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py#L103-L104

Added lines #L103 - L104 were not covered by tests
name="modulation_rf",
get_cmd="OUTP:MOD?",
set_cmd="OUTP:MOD {}",
val_mapping={"OFF": 0, "ON": 1},
)
"""Parameter modulation_rf"""

Check warning on line 110 in src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py#L110

Added line #L110 was not covered by tests
# reset values after each reconnect
self.power(0)
self.power_offset(0)
Expand Down
Loading
Loading