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 drivers HP -> Ithaco #6114

Merged
merged 3 commits into from
May 24, 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/6114.improved_driver
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The HP, Harvard and Ithaco 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.
1 change: 1 addition & 0 deletions docs/drivers_api/HP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Hewlett Packard Drivers

.. automodule:: qcodes.instrument_drivers.HP
:autosummary:
:no-inherited-members:
1 change: 1 addition & 0 deletions docs/drivers_api/Harvard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Harvard Drivers

.. automodule:: qcodes.instrument_drivers.Harvard
:autosummary:
:no-inherited-members:
1 change: 1 addition & 0 deletions docs/drivers_api/Ithaco.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Ithaco Drivers

.. automodule:: qcodes.instrument_drivers.ithaco
:autosummary:
:no-inherited-members:
29 changes: 20 additions & 9 deletions src/qcodes/instrument_drivers/HP/HP_8133A.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
if TYPE_CHECKING:
from typing_extensions import Unpack

from qcodes.parameters import Parameter


class HP8133A(VisaInstrument):
"""
Expand All @@ -23,7 +25,7 @@
):
super().__init__(name, address, **kwargs)

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

Check warning on line 28 in src/qcodes/instrument_drivers/HP/HP_8133A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_8133A.py#L28

Added line #L28 was not covered by tests
name="frequency",
label="Frequency",
unit="Hz",
Expand All @@ -32,7 +34,8 @@
get_parser=float,
vals=Numbers(min_value=31.3e6, max_value=3.5e9),
)
self.add_parameter(
"""Parameter frequency"""
self.period: Parameter = self.add_parameter(

Check warning on line 38 in src/qcodes/instrument_drivers/HP/HP_8133A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_8133A.py#L37-L38

Added lines #L37 - L38 were not covered by tests
name="period",
label="Period",
unit="s",
Expand All @@ -41,7 +44,8 @@
get_parser=float,
vals=Numbers(min_value=286e-12, max_value=31.949e-9),
)
self.add_parameter(
"""Parameter period"""
self.phase: Parameter = self.add_parameter(

Check warning on line 48 in src/qcodes/instrument_drivers/HP/HP_8133A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_8133A.py#L47-L48

Added lines #L47 - L48 were not covered by tests
name="phase",
label="Phase",
unit="deg",
Expand All @@ -50,7 +54,8 @@
get_parser=float,
vals=Numbers(min_value=-3.6e3, max_value=3.6e3),
)
self.add_parameter(
"""Parameter phase"""
self.duty_cycle: Parameter = self.add_parameter(

Check warning on line 58 in src/qcodes/instrument_drivers/HP/HP_8133A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_8133A.py#L57-L58

Added lines #L57 - L58 were not covered by tests
name="duty_cycle",
label="Duty cycle",
unit="%",
Expand All @@ -59,7 +64,8 @@
get_parser=float,
vals=Numbers(min_value=0, max_value=100),
)
self.add_parameter(
"""Parameter duty_cycle"""
self.delay: Parameter = self.add_parameter(

Check warning on line 68 in src/qcodes/instrument_drivers/HP/HP_8133A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_8133A.py#L67-L68

Added lines #L67 - L68 were not covered by tests
name="delay",
label="Delay",
unit="s",
Expand All @@ -68,7 +74,8 @@
get_parser=float,
vals=Numbers(min_value=-5e-9, max_value=5e-9),
)
self.add_parameter(
"""Parameter delay"""
self.width: Parameter = self.add_parameter(

Check warning on line 78 in src/qcodes/instrument_drivers/HP/HP_8133A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_8133A.py#L77-L78

Added lines #L77 - L78 were not covered by tests
name="width",
label="Width",
unit="s",
Expand All @@ -77,7 +84,8 @@
get_parser=float,
vals=Numbers(min_value=1e-12, max_value=10.5e-9),
)
self.add_parameter(
"""Parameter width"""
self.amplitude: Parameter = self.add_parameter(

Check warning on line 88 in src/qcodes/instrument_drivers/HP/HP_8133A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_8133A.py#L87-L88

Added lines #L87 - L88 were not covered by tests
name="amplitude",
label="Amplitude",
unit="V",
Expand All @@ -86,7 +94,8 @@
get_parser=float,
vals=Numbers(min_value=0.1, max_value=3.3),
)
self.add_parameter(
"""Parameter amplitude"""
self.amplitude_offset: Parameter = self.add_parameter(

Check warning on line 98 in src/qcodes/instrument_drivers/HP/HP_8133A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_8133A.py#L97-L98

Added lines #L97 - L98 were not covered by tests
name="amplitude_offset",
label="Offset",
unit="V",
Expand All @@ -95,13 +104,15 @@
get_parser=float,
vals=Numbers(min_value=-2.95, max_value=3.95),
)
self.add_parameter(
"""Parameter amplitude_offset"""
self.output: Parameter = self.add_parameter(

Check warning on line 108 in src/qcodes/instrument_drivers/HP/HP_8133A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_8133A.py#L107-L108

Added lines #L107 - L108 were not covered by tests
name="output",
label="Output",
get_cmd="OUTP?",
set_cmd="OUTP {}",
val_mapping={"OFF": 0, "ON": 1},
)
"""Parameter output"""

Check warning on line 115 in src/qcodes/instrument_drivers/HP/HP_8133A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_8133A.py#L115

Added line #L115 was not covered by tests

# resets amplitude and offset each time user connects
self.amplitude(0.1)
Expand Down
183 changes: 106 additions & 77 deletions src/qcodes/instrument_drivers/HP/HP_83650A.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
if TYPE_CHECKING:
from typing_extensions import Unpack

from qcodes.parameters import Parameter

log = logging.getLogger(__name__)


Expand Down Expand Up @@ -37,83 +39,110 @@
log.debug('Initializing instrument')
super().__init__(name, address, **kwargs)

self.add_parameter('frequency',
label='Frequency',
get_cmd='FREQ:CW?',
set_cmd='FREQ:CW {}',
vals=vals.Numbers(10e6, 40e9),
docstring='Microwave frequency, ....',
get_parser=float,
unit='Hz')

self.add_parameter('freqmode',
label='Frequency mode',
get_cmd='FREQ:MODE?',
set_cmd='FREQ:MODE {}',
vals=vals.Strings(),
get_parser=parsestr,
docstring='Microwave frequency mode, ....')

self.add_parameter('power',
label='Power',
get_cmd='SOUR:POW?',
set_cmd='SOUR:POW {}',
vals=vals.Numbers(-20, 20),
get_parser=float,
unit='dBm',
docstring='Microwave power, ....')

self.add_parameter('rfstatus',
label='RF status',
get_cmd=':POW:STAT?',
set_cmd=':POW:STAT {}',
val_mapping={'on': '1', 'off': '0'},
vals=vals.Strings(),
get_parser=parsestr,
docstring='Status, ....')

self.add_parameter('fmstatus',
label='FM status',
get_cmd=':FM:STAT?',
set_cmd=':FM:STAT {}',
val_mapping={'on': '1', 'off': '0'},
vals=vals.Strings(),
get_parser=parsestr,
docstring='FM status, ....')

self.add_parameter('fmcoup',
label='FM coupling',
get_cmd=':FM:COUP?',
set_cmd=':FM:COUP {}',
vals=vals.Strings(),
get_parser=parsestr,
docstring='FM coupling, ....')

self.add_parameter('amstatus',
label='AM status',
get_cmd=':AM:STAT?',
set_cmd=':AM:STAT {}',
val_mapping={'on': '1', 'off': '0'},
vals=vals.Strings(),
get_parser=parsestr,
docstring='AM status, ....')

self.add_parameter('pulsestatus',
label='Pulse status',
get_cmd=':PULS:STAT?',
set_cmd=':PULS:STAT {}',
val_mapping={'on': '1', 'off': '0'},
vals=vals.Strings(),
get_parser=parsestr,
docstring='Pulse status, ....')

self.add_parameter('pulsesource',
label='Pulse source',
get_cmd=':PULS:SOUR?',
set_cmd=':PULS:SOUR {}',
vals=vals.Strings(),
get_parser=parsestr,
docstring='Pulse source, ....')
self.frequency: Parameter = self.add_parameter(

Check warning on line 42 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L42

Added line #L42 was not covered by tests
"frequency",
label="Frequency",
get_cmd="FREQ:CW?",
set_cmd="FREQ:CW {}",
vals=vals.Numbers(10e6, 40e9),
docstring="Microwave frequency, ....",
get_parser=float,
unit="Hz",
)
"""Microwave frequency, ...."""

Check warning on line 52 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L52

Added line #L52 was not covered by tests

self.freqmode: Parameter = self.add_parameter(

Check warning on line 54 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L54

Added line #L54 was not covered by tests
"freqmode",
label="Frequency mode",
get_cmd="FREQ:MODE?",
set_cmd="FREQ:MODE {}",
vals=vals.Strings(),
get_parser=parsestr,
docstring="Microwave frequency mode, ....",
)
"""Microwave frequency mode, ...."""

Check warning on line 63 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L63

Added line #L63 was not covered by tests

self.power: Parameter = self.add_parameter(

Check warning on line 65 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L65

Added line #L65 was not covered by tests
"power",
label="Power",
get_cmd="SOUR:POW?",
set_cmd="SOUR:POW {}",
vals=vals.Numbers(-20, 20),
get_parser=float,
unit="dBm",
docstring="Microwave power, ....",
)
"""Microwave power, ...."""

Check warning on line 75 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L75

Added line #L75 was not covered by tests

self.rfstatus: Parameter = self.add_parameter(

Check warning on line 77 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L77

Added line #L77 was not covered by tests
"rfstatus",
label="RF status",
get_cmd=":POW:STAT?",
set_cmd=":POW:STAT {}",
val_mapping={"on": "1", "off": "0"},
vals=vals.Strings(),
get_parser=parsestr,
docstring="Status, ....",
)
"""Status, ...."""

Check warning on line 87 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L87

Added line #L87 was not covered by tests

self.fmstatus: Parameter = self.add_parameter(

Check warning on line 89 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L89

Added line #L89 was not covered by tests
"fmstatus",
label="FM status",
get_cmd=":FM:STAT?",
set_cmd=":FM:STAT {}",
val_mapping={"on": "1", "off": "0"},
vals=vals.Strings(),
get_parser=parsestr,
docstring="FM status, ....",
)
"""FM status, ...."""

Check warning on line 99 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L99

Added line #L99 was not covered by tests

self.fmcoup: Parameter = self.add_parameter(

Check warning on line 101 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L101

Added line #L101 was not covered by tests
"fmcoup",
label="FM coupling",
get_cmd=":FM:COUP?",
set_cmd=":FM:COUP {}",
vals=vals.Strings(),
get_parser=parsestr,
docstring="FM coupling, ....",
)
"""FM coupling, ...."""

Check warning on line 110 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L110

Added line #L110 was not covered by tests

self.amstatus: Parameter = self.add_parameter(

Check warning on line 112 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L112

Added line #L112 was not covered by tests
"amstatus",
label="AM status",
get_cmd=":AM:STAT?",
set_cmd=":AM:STAT {}",
val_mapping={"on": "1", "off": "0"},
vals=vals.Strings(),
get_parser=parsestr,
docstring="AM status, ....",
)
"""AM status, ...."""

Check warning on line 122 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L122

Added line #L122 was not covered by tests

self.pulsestatus: Parameter = self.add_parameter(

Check warning on line 124 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L124

Added line #L124 was not covered by tests
"pulsestatus",
label="Pulse status",
get_cmd=":PULS:STAT?",
set_cmd=":PULS:STAT {}",
val_mapping={"on": "1", "off": "0"},
vals=vals.Strings(),
get_parser=parsestr,
docstring="Pulse status, ....",
)
"""Pulse status, ...."""

Check warning on line 134 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L134

Added line #L134 was not covered by tests

self.pulsesource: Parameter = self.add_parameter(

Check warning on line 136 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L136

Added line #L136 was not covered by tests
"pulsesource",
label="Pulse source",
get_cmd=":PULS:SOUR?",
set_cmd=":PULS:SOUR {}",
vals=vals.Strings(),
get_parser=parsestr,
docstring="Pulse source, ....",
)
"""Pulse source, ...."""

Check warning on line 145 in src/qcodes/instrument_drivers/HP/HP_83650A.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/HP/HP_83650A.py#L145

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

def reset(self) -> None:
Expand Down
Loading
Loading