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

Complete instrument refactor (except Tektronix) #6163

Merged
merged 9 commits into from
Jun 7, 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/6163.improved_driver
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The SignalHound, SRS, Stahl, Weinschel and Yokogawa 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/SRS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Stanford Research Systems Drivers

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

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

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

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

.. automodule:: qcodes.instrument_drivers.yokogawa
:autosummary:
:no-inherited-members:
111 changes: 85 additions & 26 deletions src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,38 +211,48 @@
self._set_ctypes_argtypes()

self.hf = Constants
self.add_parameter(
self.frequency: SweepTraceParameter = self.add_parameter(

Check warning on line 214 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L214

Added line #L214 was not covered by tests
"frequency",
label="Frequency",
unit="Hz",
initial_value=5e9,
vals=vals.Numbers(),
parameter_class=SweepTraceParameter,
docstring="Center frequency for sweep."
docstring="Center frequency for sweep. "
"This is the set center, the actual "
"center may be subject to round off "
"compared to this value",
)
self.add_parameter(
"""

Check warning on line 226 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L226

Added line #L226 was not covered by tests
Center frequency for sweep.

This is the set center, the actual center may be subject to round off compared to this value
"""
self.span: SweepTraceParameter = self.add_parameter(

Check warning on line 231 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L231

Added line #L231 was not covered by tests
"span",
label="Span",
unit="Hz",
initial_value=0.25e6,
vals=vals.Numbers(),
parameter_class=SweepTraceParameter,
docstring="Width of frequency span"
docstring="Width of frequency span. "
"This is the set span, the actual "
"span may be subject to round off "
"compared to this value",
)
self.add_parameter(
"""Width of frequency span.

Check warning on line 243 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L243

Added line #L243 was not covered by tests

This is the set span, the actual span may be subject to round off compared to this value
"""
self.npts: Parameter = self.add_parameter(

Check warning on line 247 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L247

Added line #L247 was not covered by tests
"npts",
label="Number of Points",
get_cmd=self._get_npts,
set_cmd=False,
docstring="Number of points in frequency sweep.",
)
self.add_parameter(
"""Number of points in frequency sweep."""
self.avg: Parameter = self.add_parameter(

Check warning on line 255 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L254-L255

Added lines #L254 - L255 were not covered by tests
"avg",
label="Averages",
initial_value=1,
Expand All @@ -253,19 +263,27 @@
"Averages are performed in software by "
"acquiring multiple sweeps",
)
self.add_parameter(
"""Number of averages to perform.

Check warning on line 266 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L266

Added line #L266 was not covered by tests


Averages are performed in software by acquiring multiple sweeps"""
self.ref_lvl: TraceParameter = self.add_parameter(

Check warning on line 270 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L270

Added line #L270 was not covered by tests
"ref_lvl",
label="Reference power",
unit="dBm",
initial_value=0,
vals=vals.Numbers(max_value=20),
parameter_class=TraceParameter,
docstring="Setting reference level will "
"automatically select gain and attenuation"
"automatically select gain and attenuation "
"optimal for measuring at and below "
"this level",
)
self.add_parameter(
"""

Check warning on line 282 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L282

Added line #L282 was not covered by tests
Setting reference level will automatically select gain and attenuation
optimal for measuring at and below this level
"""
self.external_reference: ExternalRefParameter = self.add_parameter(

Check warning on line 286 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L286

Added line #L286 was not covered by tests
"external_reference",
initial_value=False,
vals=vals.Bool(),
Expand All @@ -275,37 +293,60 @@
"disabling external ref. To disable close "
"the connection and restart.",
)
self.add_parameter("device_type", set_cmd=False, get_cmd=self._get_device_type)
self.add_parameter(
"""

Check warning on line 296 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L296

Added line #L296 was not covered by tests
Use an external 10 MHz reference source.

Note that Signal Hound does not support disabling external ref.
To disable close the connection and restart.
"""
self.device_type: Parameter = self.add_parameter(

Check warning on line 302 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L302

Added line #L302 was not covered by tests
"device_type", set_cmd=False, get_cmd=self._get_device_type
)
"""Parameter device_type"""
self.device_mode: Parameter = self.add_parameter(

Check warning on line 306 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L305-L306

Added lines #L305 - L306 were not covered by tests
"device_mode",
get_cmd=lambda: "sweeping",
set_cmd=False,
docstring="The driver currently only "
"supports sweeping mode. "
"It is therefor not possible"
"It is therefor not possible "
"to set this parameter to anything else",
)
self.add_parameter(
"""

Check warning on line 315 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L315

Added line #L315 was not covered by tests
The driver currently only supports sweeping mode.

It is therefor not possible to set this parameter to anything else
"""
self.acquisition_mode: Parameter = self.add_parameter(

Check warning on line 320 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L320

Added line #L320 was not covered by tests
"acquisition_mode",
get_cmd=lambda: "average",
set_cmd=False,
docstring="The driver only supports averaging "
"mode it is therefor not possible to set"
"mode it is therefor not possible to set "
"this parameter to anything else",
)
self.add_parameter(
"""

Check warning on line 328 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L328

Added line #L328 was not covered by tests
The driver only supports averaging mode.

It is therefor not possible to set
this parameter to anything else
"""
self.rbw: TraceParameter = self.add_parameter(

Check warning on line 334 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L334

Added line #L334 was not covered by tests
"rbw",
label="Resolution Bandwidth",
unit="Hz",
initial_value=1e3,
vals=vals.Numbers(0.1, 250e3),
parameter_class=TraceParameter,
docstring="Resolution Bandwidth (RBW) is"
docstring="Resolution Bandwidth (RBW) is "
"the bandwidth of "
"spectral energy represented in each "
"frequency bin",
)
self.add_parameter(
"""Resolution Bandwidth (RBW)

Check warning on line 346 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L346

Added line #L346 was not covered by tests
is the bandwidth of spectral energy represented in each frequency bin
"""
self.vbw: TraceParameter = self.add_parameter(

Check warning on line 349 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L349

Added line #L349 was not covered by tests
"vbw",
label="Video Bandwidth",
unit="Hz",
Expand All @@ -321,8 +362,15 @@
"bin over several overlapping FFTs. "
"For best performance use RBW as the VBW.",
)
"""

Check warning on line 365 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L365

Added line #L365 was not covered by tests
The video bandwidth (VBW)
is applied after the signal has been converted to frequency domain as power,
voltage, or log units. It is implemented as a simple rectangular window,
averaging the amplitude readings for each frequency bin over several overlapping FFTs.
For best performance use RBW as the VBW.
"""

self.add_parameter(
self.reject_image: TraceParameter = self.add_parameter(

Check warning on line 373 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L373

Added line #L373 was not covered by tests
"reject_image",
label="Reject image",
unit="",
Expand All @@ -332,7 +380,8 @@
docstring="Apply software filter to remove undersampling mirroring",
vals=vals.Bool(),
)
self.add_parameter(
"""Apply software filter to remove undersampling mirroring"""
self.sleep_time: Parameter = self.add_parameter(

Check warning on line 384 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L383-L384

Added lines #L383 - L384 were not covered by tests
"sleep_time",
label="Sleep time",
unit="s",
Expand All @@ -343,41 +392,49 @@
"getting data from the instrument",
vals=vals.Numbers(0),
)
"""Time to sleep before and after getting data from the instrument"""

Check warning on line 395 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L395

Added line #L395 was not covered by tests
# We don't know the correct values of
# the sweep parameters yet so we supply
# some defaults. The correct will be set when we call configure below
self.add_parameter(
self.trace: FrequencySweep = self.add_parameter(

Check warning on line 399 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L399

Added line #L399 was not covered by tests
name="trace",
sweep_len=1,
start_freq=1,
stepsize=1,
parameter_class=FrequencySweep,
)
self.add_parameter(
"""Parameter trace"""
self.power: Parameter = self.add_parameter(

Check warning on line 407 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L406-L407

Added lines #L406 - L407 were not covered by tests
"power",
label="Power",
unit="dBm",
get_cmd=self._get_power_at_freq,
set_cmd=False,
docstring="The maximum power in a window of 250 kHz"
"around the specified frequency with "
docstring="The maximum power in a window of 250 kHz "
"around the specified frequency with "
"Resolution bandwidth set to 1 kHz."
"The integration window is specified by "
"the VideoBandWidth (set by vbw)",
)
"""

Check warning on line 419 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L419

Added line #L419 was not covered by tests
The maximum power in a window of 250 kHz around the specified frequency with Resolution bandwidth set to 1 kHz.

The integration window is specified by the VideoBandWidth (set by vbw)
"""
# scale is defined after the trace and power parameter so that
# it can change the units of those in it's set method when the
# scale changes
self.add_parameter(
self.scale: ScaleParameter = self.add_parameter(

Check warning on line 427 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L427

Added line #L427 was not covered by tests
"scale",
initial_value="log-scale",
vals=vals.Enum(
"log-scale", "lin-scale", "log-full-scale", "lin-full-scale"
),
parameter_class=ScaleParameter,
)
"""Parameter scale"""

Check warning on line 435 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L435

Added line #L435 was not covered by tests

self.add_parameter(
self.frequency_axis: Parameter = self.add_parameter(

Check warning on line 437 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L437

Added line #L437 was not covered by tests
"frequency_axis",
label="Frequency",
unit="Hz",
Expand All @@ -386,7 +443,8 @@
vals=vals.Arrays(shape=(self.npts,)),
snapshot_value=False,
)
self.add_parameter(
"""Parameter frequency_axis"""
self.freq_sweep: ParameterWithSetpoints = self.add_parameter(

Check warning on line 447 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L446-L447

Added lines #L446 - L447 were not covered by tests
"freq_sweep",
label="Power",
unit="depends on mode",
Expand All @@ -397,6 +455,7 @@
setpoints=(self.frequency_axis,),
snapshot_value=False,
)
"""Parameter freq_sweep"""

Check warning on line 458 in src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py#L458

Added line #L458 was not covered by tests

self.openDevice()
self.configure()
Expand Down
Loading
Loading