Skip to content

Commit 0bb16b1

Browse files
committed
QDac type improvments
1 parent 0dafc31 commit 0bb16b1

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

src/qcodes/instrument_drivers/QDev/QDac_channels.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from qcodes import validators as vals
1212
from qcodes.instrument import (
1313
ChannelList,
14-
Instrument,
14+
ChannelTuple,
1515
InstrumentBaseKWArgs,
1616
InstrumentChannel,
1717
VisaInstrument,
@@ -29,7 +29,7 @@
2929
log = logging.getLogger(__name__)
3030

3131

32-
class QDevQDacChannel(InstrumentChannel):
32+
class QDevQDacChannel(InstrumentChannel["QDevQDac"]):
3333
"""
3434
A single output channel of the QDac.
3535
@@ -40,7 +40,7 @@ class QDevQDacChannel(InstrumentChannel):
4040

4141
def __init__(
4242
self,
43-
parent: Instrument,
43+
parent: "QDevQDac",
4444
name: str,
4545
channum: int,
4646
**kwargs: "Unpack[InstrumentBaseKWArgs]",
@@ -143,9 +143,20 @@ def snapshot_base(
143143
update: bool | None = False,
144144
params_to_skip_update: "Sequence[str] | None" = None,
145145
) -> dict[Any, Any]:
146-
update_currents = self._parent._update_currents and update
147-
if update and not self._parent._get_status_performed:
148-
self._parent._update_cache(readcurrents=update_currents)
146+
# setting update not None will override parent setting
147+
# otherwise we use parent setting
148+
# parent._update | update | do update
149+
# True | True | True
150+
# True | None | True
151+
# True | False | False
152+
# False | True | True
153+
# False | None | False
154+
# False | False | False
155+
update_currents = (
156+
self.parent._update_currents and update is not False
157+
) or update is True
158+
if update and not self.parent._get_status_performed:
159+
self.parent._update_cache(readcurrents=update_currents)
149160
# call get_status rather than getting the status individually for
150161
# each parameter. This is only done if _get_status_performed is False
151162
# this is used to signal that the parent has already called it and
@@ -287,7 +298,10 @@ def __init__(
287298
channels.append(channel)
288299
# Should raise valueerror if name is invalid (silently fails now)
289300
self.add_submodule(f"ch{i:02}", channel)
290-
self.add_submodule("channels", channels.to_channel_tuple())
301+
self.channels: ChannelTuple[QDevQDacChannel] = self.add_submodule(
302+
"channels", channels.to_channel_tuple()
303+
)
304+
"""ChannelTuple containing all QDevQDacChannel instances"""
291305

292306
for board in range(6):
293307
for sensor in range(3):

0 commit comments

Comments
 (0)