Skip to content
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
3 changes: 3 additions & 0 deletions docs/changes/newsfragments/7542.improved_driver
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The Stanford SR86x drivers now statically assign attributes statically
for more member InstrumentModules and parameters enabling better documentation,
type checking and IDE integration.
60 changes: 42 additions & 18 deletions src/qcodes/instrument_drivers/stanford_research/SR86x.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from qcodes.instrument import (
ChannelList,
ChannelTuple,
InstrumentBaseKWArgs,
InstrumentChannel,
VisaInstrument,
Expand Down Expand Up @@ -118,16 +119,14 @@ def __init__(
# Maximum amount of kB that can be read per single CAPTUREGET command
self.max_size_per_reading_in_kb = 64

self.capture_config: Parameter = (
self.add_parameter( # Configure which parameters we want to capture
"capture_config",
label="capture configuration",
get_cmd="CAPTURECFG?",
set_cmd="CAPTURECFG {}",
val_mapping={"X": "0", "X,Y": "1", "R,T": "2", "X,Y,R,T": "3"},
)
self.capture_config: Parameter = self.add_parameter(
"capture_config",
label="capture configuration",
get_cmd="CAPTURECFG?",
set_cmd="CAPTURECFG {}",
val_mapping={"X": "0", "X,Y": "1", "R,T": "2", "X,Y,R,T": "3"},
)
"""Parameter capture_config"""
"""Parameter capture_config configures which parameters we want to capture"""

self.capture_rate_max: Parameter = self.add_parameter(
"capture_rate_max",
Expand All @@ -150,12 +149,10 @@ def __init__(
max_rate = self.capture_rate_max()
self.available_frequencies = [max_rate / 2**i for i in range(20)]

self.capture_status: Parameter = (
self.add_parameter( # Are we capturing at the moment?
"capture_status", label="capture status", get_cmd="CAPTURESTAT?"
)
self.capture_status: Parameter = self.add_parameter(
"capture_status", label="capture status", get_cmd="CAPTURESTAT?"
)
"""Parameter capture_status"""
"""Parameter capture_status: Are we capturing at the moment?"""

self.count_capture_bytes: Parameter = self.add_parameter(
"count_capture_bytes",
Expand Down Expand Up @@ -187,8 +184,30 @@ def __init__(
then the returned value is simply equal to the current capture length.
"""

for parameter_name in ["X", "Y", "R", "T"]:
self.add_parameter(parameter_name, parameter_class=SR86xBufferReadout)
self.X: SR86xBufferReadout = self.add_parameter(
"X", parameter_class=SR86xBufferReadout
)
"""
X buffer readout.
"""
self.Y: SR86xBufferReadout = self.add_parameter(
"Y", parameter_class=SR86xBufferReadout
)
"""
Y buffer readout.
"""
self.R: SR86xBufferReadout = self.add_parameter(
"R", parameter_class=SR86xBufferReadout
)
"""
R buffer readout.
"""
self.T: SR86xBufferReadout = self.add_parameter(
"T", parameter_class=SR86xBufferReadout
)
"""
T buffer readout.
"""

def snapshot_base(
self,
Expand Down Expand Up @@ -1046,6 +1065,7 @@ def __init__(
"P", label="Phase", get_cmd="OUTP? 3", get_parser=float, unit="deg"
)
"""Parameter P"""

self.complex_voltage: Parameter = self.add_parameter(
"complex_voltage",
label="Voltage",
Expand Down Expand Up @@ -1146,7 +1166,10 @@ def __init__(
data_channels.append(data_channel)
self.add_submodule(ch_name, data_channel)

self.add_submodule("data_channels", data_channels.to_channel_tuple())
self.data_channels: ChannelTuple[SR86xDataChannel] = self.add_submodule(
"data_channels", data_channels.to_channel_tuple()
)
"""Interface for the SR86x data channels"""

# Interface
self.add_function("reset", call_cmd="*RST")
Expand All @@ -1155,7 +1178,8 @@ def __init__(
self.add_function("enable_front_panel", call_cmd="OVRM 1")

buffer = SR86xBuffer(self, f"{self.name}_buffer")
self.add_submodule("buffer", buffer)
self.buffer: SR86xBuffer = self.add_submodule("buffer", buffer)
"""Interface for the SR86x buffer"""

self.input_config()
self.connect_message()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .SG384 import SG384
from .SR86x import SR86x, SR86xBuffer
from .SR86x import SR86x, SR86xBuffer, SR86xDataChannel
from .SR560 import SR560
from .SR830 import SR830
from .SR860 import SR860
Expand All @@ -15,4 +15,5 @@
"SR865A",
"SR86x",
"SR86xBuffer",
"SR86xDataChannel",
]
Loading