Skip to content

Commit db02785

Browse files
astafan8Dominik-Vogel
authored andcommitted
Merge pull request #1845 from vhartong/keysight_344xxA_firmware_has_DIG_fix
Keysight 344xx: DIG option is always enabled with 3.0 firmware, also add MEM option, use *OPT? for retrieving enabled options
1 parent e9df544 commit db02785

File tree

3 files changed

+53
-9
lines changed

3 files changed

+53
-9
lines changed

docs/changes/0.8.1.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ This is a bug fix release fixing the following issues
55

66
* QDac cache returns invalid data (#1844)
77
* Station config validation raises exception if validation failed (#1846)
8-
* make sure `start_all_logging` does not try to reach the internet (#1847)
8+
* Make sure `start_all_logging` does not try to reach the internet (#1847)
9+
* Keysight 344xxA driver: support the fact that DIG option is always enabled
10+
with firmware version 3.0, also add support for MEM option (#1845)
911

1012

1113
The QDac driver received a thorough overhauling of the `vrange` and `v` parameters. `read_state` has been deprecated.

qcodes/instrument/sims/Keysight_34465A.yaml

+8-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ devices:
99
error: ERROR
1010
dialogues:
1111
- q: "*IDN?"
12-
r: "Keysight, 34465A, 1000, 0.1"
12+
r: "Keysight, 34465A, 1000, A.02.16-02.40-02.16-00.51-03-01"
1313
- q: "DISPLay:TEXT:CLEar"
1414
r: null_response
1515
properties:
@@ -82,6 +82,13 @@ devices:
8282
q: "SYST:LIC:CAT?"
8383
r: "{}"
8484
type: string
85+
options:
86+
# experimentally proven that this command returns 5 items for 34465A model
87+
default: "0,0,DIG,MEM,0"
88+
getter:
89+
q: "*OPT?"
90+
r: "{}"
91+
type: string
8592
line_frequency:
8693
default: 50
8794
getter:

qcodes/instrument_drivers/Keysight/private/Keysight_344xxA_submodules.py

+42-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import numpy as np
33
from contextlib import ExitStack
44
from functools import partial
5-
from typing import Sequence
5+
from typing import Sequence, Tuple
6+
from distutils.version import LooseVersion
67

78
import qcodes.utils.validators as vals
89
from qcodes import VisaInstrument, InstrumentChannel
@@ -119,7 +120,7 @@ def __init__(self, parent: '_Keysight_344xxA', name: str, **kwargs):
119120
it buffers one trigger.""")
120121
_trigger_source_vals = vals.Enum('IMM', 'EXT', 'BUS')
121122

122-
if self.parent.is_34465A_34470A and self.parent.has_DIG:
123+
if self.parent.has_DIG:
123124
_trigger_source_vals = vals.Enum('IMM', 'EXT', 'BUS', 'INT')
124125
# extra empty lines are needed for readability of the docstring
125126
_trigger_source_docstring += textwrap.dedent("""\
@@ -149,11 +150,11 @@ def __init__(self, parent: '_Keysight_344xxA', name: str, **kwargs):
149150
super(Sample, self).__init__(parent, name, **kwargs)
150151

151152
if self.parent.is_34465A_34470A:
152-
_max_sample_count = 1e9
153+
_max_sample_count = int(1e9)
153154
elif self.parent.model == "34410A":
154155
_max_sample_count = 50_000
155156
else:
156-
_max_sample_count = 1e6
157+
_max_sample_count = int(1e6)
157158

158159
self.add_parameter('count',
159160
label='Sample Count',
@@ -172,18 +173,29 @@ def __init__(self, parent: '_Keysight_344xxA', name: str, **kwargs):
172173
option) or 2,000,000 readings (with the MEM option)"""))
173174

174175
if self.parent.has_DIG:
176+
if self.parent.has_MEM:
177+
_max_pretrig_count = int(2e6) - 1
178+
else:
179+
_max_pretrig_count = int(5e4) - 1
180+
175181
self.add_parameter('pretrigger_count',
176182
label='Sample Pretrigger Count',
177183
set_cmd='SAMPle:COUNt:PRETrigger {}',
178184
get_cmd='SAMPle:COUNt:PRETrigger?',
179185
vals=vals.MultiType(
180-
vals.Numbers(0, 2e6 - 1),
186+
vals.Numbers(0, _max_pretrig_count),
181187
vals.Enum('MIN', 'MAX', 'DEF')),
182188
get_parser=int,
183189
docstring=textwrap.dedent("""\
184190
Allows collection of the data being digitized the trigger.
185191
Reserves memory for pretrigger samples up to the specified
186-
num. of pretrigger samples."""))
192+
num. of pretrigger samples.
193+
194+
Note that the maximum number of pretrigger counts is bounded
195+
by the current number of sample counts as specified via the
196+
``sample.count`` parameter. Refer to the doc of the
197+
``sample.count`` parameter for information on the maximum
198+
number of sample counts."""))
187199

188200
if self.parent.is_34465A_34470A:
189201
self.add_parameter('source',
@@ -438,7 +450,15 @@ def __init__(self, name: str, address: str, silent: bool = False,
438450
####################################
439451
# Instrument specifications
440452

441-
self.has_DIG = 'DIG' in self._licenses()
453+
options = self._options()
454+
self.has_DIG = self.is_34465A_34470A and (
455+
'DIG' in options
456+
or LooseVersion('A.03') <= LooseVersion(idn['firmware'])
457+
)
458+
# Note that the firmware version check is still needed becuase ``_options``
459+
# (the ``*OPT?`` command) returns 'DIG' option for firmware 3.0 only
460+
# if it has been purchased before
461+
self.has_MEM = self.is_34465A_34470A and 'MEM' in options
442462

443463
PLCs = {'34410A': [0.006, 0.02, 0.06, 0.2, 1, 2, 10, 100],
444464
'34460A': [0.02, 0.2, 1, 10, 100],
@@ -756,6 +776,21 @@ def _licenses(self) -> Sequence[str]:
756776
return licenses_list
757777
return tuple()
758778

779+
def _options(self) -> Tuple[str, ...]:
780+
"""
781+
Return enabled options of the DMM returned by ``*OPT?`` command.
782+
The 34410A model does not have options, hence always returns an empty tuple.
783+
784+
Note that for firmware version 3.0, output of ```*OPT?`` will contain
785+
the ``DIG`` option only if it has been purchased before, although the option
786+
itself is enabled by default in the firmware version 3.0.
787+
"""
788+
if self.model != '34410A':
789+
options_raw = self.ask('*OPT?')
790+
options_list = [opt for opt in options_raw.split(',') if opt != '0']
791+
return tuple(options_list)
792+
return tuple()
793+
759794
def _get_parameter(self, sense_function: str = "DC Voltage") -> float:
760795
"""
761796
Measure the parameter given by sense_function

0 commit comments

Comments
 (0)