1313import qcodes .validators as vals
1414from qcodes .instrument import (
1515 ChannelList ,
16+ ChannelTuple ,
1617 InstrumentBase ,
1718 InstrumentBaseKWArgs ,
1819 InstrumentChannel ,
@@ -89,7 +90,11 @@ def get_raw(self) -> npt.NDArray:
8990 )
9091
9192
92- class DSOTraceParam (ParameterWithSetpoints ):
93+ class DSOTraceParam (
94+ ParameterWithSetpoints [
95+ npt .NDArray , "KeysightInfiniiumChannel | KeysightInfiniiumFunction"
96+ ]
97+ ):
9398 """
9499 Trace parameter for the Infiniium series DSO
95100 """
@@ -180,7 +185,7 @@ def update_setpoints(self, preamble: "Sequence[str] | None" = None) -> None:
180185 acquisition if instr.cache_setpoints is False
181186 """
182187 instrument : KeysightInfiniiumChannel | KeysightInfiniiumFunction
183- instrument = self .instrument # type: ignore[assignment]
188+ instrument = self .instrument
184189 if preamble is None :
185190 instrument .write (f":WAV:SOUR { self ._channel } " )
186191 preamble = instrument .ask (":WAV:PRE?" ).strip ().split ("," )
@@ -257,13 +262,15 @@ def __init__(
257262 self ,
258263 parent : InstrumentBase ,
259264 name : str ,
265+ channel : str ,
260266 ** kwargs : "Unpack[InstrumentBaseKWArgs]" ,
261267 ) -> None :
262268 """
263269 Add parameters to measurement subsystem. Note: This should not be initialized
264270 directly, rather initialize BoundMeasurementSubsystem
265271 or UnboundMeasurementSubsystem.
266272 """
273+ self ._channel = channel
267274 super ().__init__ (parent , name , ** kwargs )
268275
269276 ###################################
@@ -477,11 +484,8 @@ def __init__(
477484 """
478485 Initialize measurement subsystem bound to a specific channel
479486 """
480- # Bind the channel
481- self ._channel = parent .channel_name
482-
483487 # Initialize measurement parameters
484- super ().__init__ (parent , name , ** kwargs )
488+ super ().__init__ (parent , name , channel = parent . channel_name , ** kwargs )
485489
486490
487491BoundMeasurement = KeysightInfiniiumBoundMeasurement
@@ -500,11 +504,8 @@ def __init__(
500504 """
501505 Initialize measurement subsystem where target is set by the parameter `source`.
502506 """
503- # Blank channel
504- self ._channel = ""
505-
506507 # Initialize measurement parameters
507- super ().__init__ (parent , name , ** kwargs )
508+ super ().__init__ (parent , name , channel = "" , ** kwargs )
508509
509510 self .source = Parameter (
510511 name = "source" ,
@@ -515,6 +516,12 @@ def __init__(
515516 snapshot_value = False ,
516517 )
517518
519+ @property
520+ def root_instrument (self ) -> "KeysightInfiniium" :
521+ root_instrument = super ().root_instrument
522+ assert isinstance (root_instrument , KeysightInfiniium )
523+ return root_instrument
524+
518525 def _validate_source (self , source : str ) -> str :
519526 """Validate and set the source."""
520527 valid_channels = f"CHAN[1-{ self .root_instrument .no_channels } ]"
@@ -692,7 +699,7 @@ def _get_func(self) -> str:
692699"""
693700
694701
695- class KeysightInfiniiumChannel (InstrumentChannel ):
702+ class KeysightInfiniiumChannel (InstrumentChannel [ "KeysightInfiniium" ] ):
696703 def __init__ (
697704 self ,
698705 parent : "KeysightInfiniium" ,
@@ -1081,7 +1088,10 @@ def __init__(
10811088 channel = KeysightInfiniiumChannel (self , f"chan{ i } " , i )
10821089 _channels .append (channel )
10831090 self .add_submodule (f"ch{ i } " , channel )
1084- self .add_submodule ("channels" , _channels .to_channel_tuple ())
1091+ self .channels : ChannelTuple [KeysightInfiniiumChannel ] = self .add_submodule (
1092+ "channels" , _channels .to_channel_tuple ()
1093+ )
1094+ """Tuple of oscilloscope channels."""
10851095
10861096 # Functions
10871097 _functions = ChannelList (
@@ -1093,11 +1103,17 @@ def __init__(
10931103 self .add_submodule (f"func{ i } " , function )
10941104 # Have to call channel list "funcs" here as functions is a
10951105 # reserved name in Instrument.
1096- self .add_submodule ("funcs" , _functions .to_channel_tuple ())
1106+ self .funcs : ChannelTuple [KeysightInfiniiumFunction ] = self .add_submodule (
1107+ "funcs" , _functions .to_channel_tuple ()
1108+ )
1109+ """Tuple of oscilloscope functions."""
10971110
10981111 # Submodules
10991112 meassubsys = KeysightInfiniiumUnboundMeasurement (self , "measure" )
1100- self .add_submodule ("measure" , meassubsys )
1113+ self .measure : KeysightInfiniiumUnboundMeasurement = self .add_submodule (
1114+ "measure" , meassubsys
1115+ )
1116+ """Unbound measurement subsystem."""
11011117
11021118 def _query_capabilities (self ) -> None :
11031119 """
0 commit comments