Debian Codegraph @

pymeasure/instruments/agilent/agilent34450A.py

raw
1 #
2 # This file is part of the PyMeasure package.
3 #
4 # Copyright (c) 2013-2024 PyMeasure Developers
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 # THE SOFTWARE.
23 #
24
25 import re
26 import logging
27
28 from pymeasure.instruments import Instrument, SCPIUnknownMixin
29 from pymeasure.instruments.validators import strict_discrete_set
30
31 log = logging.getLogger(__name__)
32 log.addHandler(logging.NullHandler())
33
34
35 class Agilent34450A(SCPIUnknownMixin, Instrument):
36 """
37 Represent the HP/Agilent/Keysight 34450A and related multimeters.
38
39 .. code-block:: python
40
41 dmm = Agilent34450A("USB0::...")
42 dmm.reset()
43 dmm.configure_voltage()
44 print(dmm.voltage)
45 dmm.shutdown()
46
47 """
48
49 BOOLS = {True: 1, False: 0}
50
51 MODES = {'current': 'CURR', 'ac current': 'CURR:AC',
52 'voltage': 'VOLT', 'ac voltage': 'VOLT:AC',
53 'resistance': 'RES', '4w resistance': 'FRES',
54 'current frequency': 'FREQ:ACI', 'voltage frequency': 'FREQ:ACV',
55 'continuity': 'CONT',
56 'diode': 'DIOD',
57 'temperature': 'TEMP',
58 'capacitance': 'CAP'}
59
60 @property
61 def mode(self):
62 get_command = ":configure?"
63 vals = self._conf_parser(self.values(get_command))
64 # Return only the mode parameter
65 inv_modes = {v: k for k, v in self.MODES.items()}
66 mode = inv_modes[vals[0]]
67 return mode
68
69 @mode.setter
70 def mode(self, value):
71 """ A string parameter that sets the measurement mode of the multimeter. Can be "current",
72 "ac current", "voltage", "ac voltage", "resistance", "4w resistance", "current frequency",
73 "voltage frequency", "continuity", "diode", "temperature", or "capacitance"."""
74 if value in self.MODES:
75 if value not in ['current frequency', 'voltage frequency']:
76 self.write(':configure:' + self.MODES[value])
77 else:
78 if value == 'current frequency':
79 self.mode = 'ac current'
80 else:
81 self.mode = 'ac voltage'
82 self.write(":configure:freq")
83 else:
84 raise ValueError(f'Value {value} is not a supported mode for this device.')
85
86 ###############
87 # Current (A) #
88 ###############
89
90 current = Instrument.measurement(":READ?",
91 """ Reads a DC current measurement in Amps, based on the
92 active :attr:`~.Agilent34450A.mode`. """
93 )
94 current_ac = Instrument.measurement(":READ?",
95 """ Reads an AC current measurement in Amps, based on the
96 active :attr:`~.Agilent34450A.mode`. """
97 )
98 current_range = Instrument.control(
99 ":SENS:CURR:RANG?", ":SENS:CURR:RANG:AUTO 0;:SENS:CURR:RANG %s",
100 """ A property that controls the DC current range in
101 Amps, which can take values 100E-6, 1E-3, 10E-3, 100E-3, 1, 10,
102 as well as "MIN", "MAX", or "DEF" (100 mA).
103 Auto-range is disabled when this property is set. """,
104 validator=strict_discrete_set,
105 values=[100E-6, 1E-3, 10E-3, 100E-3, 1, 10, "MIN", "DEF", "MAX"]
106 )
107 current_auto_range = Instrument.control(
108 ":SENS:CURR:RANG:AUTO?", ":SENS:CURR:RANG:AUTO %d",
109 """ A boolean property that toggles auto ranging for DC current. """,
110 validator=strict_discrete_set,
111 values=BOOLS,
112 map_values=True
113 )
114 current_resolution = Instrument.control(
115 ":SENS:CURR:RES?", ":SENS:CURR:RES %s",
116 """ A property that controls the resolution in the DC current
117 readings, which can take values 3.00E-5, 2.00E-5, 1.50E-6 (5 1/2 digits),
118 as well as "MIN", "MAX", and "DEF" (3.00E-5). """,
119 validator=strict_discrete_set,
120 values=[3.00E-5, 2.00E-5, 1.50E-6, "MAX", "MIN", "DEF"]
121 )
122 current_ac_range = Instrument.control(
123 ":SENS:CURR:AC:RANG?", ":SENS:CURR:AC:RANG:AUTO 0;:SENS:CURR:AC:RANG %s",
124 """ A property that controls the AC current range in Amps, which can take
125 values 10E-3, 100E-3, 1, 10, as well as "MIN", "MAX", or "DEF" (100 mA).
126 Auto-range is disabled when this property is set. """,
127 validator=strict_discrete_set,
128 values=[10E-3, 100E-3, 1, 10, "MIN", "MAX", "DEF"]
129 )
130 current_ac_auto_range = Instrument.control(
131 ":SENS:CURR:AC:RANG:AUTO?", ":SENS:CURR:AC:RANG:AUTO %d",
132 """ A boolean property that toggles auto ranging for AC current. """,
133 validator=strict_discrete_set,
134 values=BOOLS,
135 map_values=True
136 )
137 current_ac_resolution = Instrument.control(
138 ":SENS:CURR:AC:RES?", ":SENS:CURR:AC:RES %s",
139 """ An property that controls the resolution in the AC current
140 readings, which can take values 3.00E-5, 2.00E-5, 1.50E-6 (5 1/2 digits),
141 as well as "MIN", "MAX", or "DEF" (1.50E-6). """,
142 validator=strict_discrete_set,
143 values=[3.00E-5, 2.00E-5, 1.50E-6, "MAX", "MIN", "DEF"]
144 )
145
146 ###############
147 # Voltage (V) #
148 ###############
149
150 voltage = Instrument.measurement(":READ?",
151 """ Reads a DC voltage measurement in Volts, based on the
152 active :attr:`~.Agilent34450A.mode`. """
153 )
154 voltage_ac = Instrument.measurement(":READ?",
155 """ Reads an AC voltage measurement in Volts, based on the
156 active :attr:`~.Agilent34450A.mode`. """
157 )
158 voltage_range = Instrument.control(
159 ":SENS:VOLT:RANG?", ":SENS:VOLT:RANG:AUTO 0;:SENS:VOLT:RANG %s",
160 """ A property that controls the DC voltage range in Volts, which
161 can take values 100E-3, 1, 10, 100, 1000, as well as "MIN", "MAX", or
162 "DEF" (10 V). Auto-range is disabled when this property is set. """,
163 validator=strict_discrete_set,
164 values=[100E-3, 1, 10, 100, 1000, "MAX", "MIN", "DEF"]
165 )
166 voltage_auto_range = Instrument.control(
167 ":SENS:VOLT:RANG:AUTO?", ":SENS:VOLT:RANG:AUTO %d",
168 """ A boolean property that toggles auto ranging for DC voltage. """,
169 validator=strict_discrete_set,
170 values=BOOLS,
171 map_values=True
172 )
173 voltage_resolution = Instrument.control(
174 ":SENS:VOLT:RES?", ":SENS:VOLT:RES %s",
175 """ A property that controls the resolution in the DC voltage
176 readings, which can take values 3.00E-5, 2.00E-5, 1.50E-6 (5 1/2 digits),
177 as well as "MIN", "MAX", or "DEF" (1.50E-6). """,
178 validator=strict_discrete_set,
179 values=[3.00E-5, 2.00E-5, 1.50E-6, "MAX", "MIN", "DEF"]
180 )
181 voltage_ac_range = Instrument.control(
182 ":SENS:VOLT:AC:RANG?", ":SENS:VOLT:RANG:AUTO 0;:SENS:VOLT:AC:RANG %s",
183 """ A property that controls the AC voltage range in Volts, which can
184 take values 100E-3, 1, 10, 100, 750, as well as "MIN", "MAX", or "DEF"
185 (10 V).
186 Auto-range is disabled when this property is set. """,
187 validator=strict_discrete_set,
188 values=[100E-3, 1, 10, 100, 750, "MAX", "MIN", "DEF"]
189 )
190 voltage_ac_auto_range = Instrument.control(
191 ":SENS:VOLT:AC:RANG:AUTO?", ":SENS:VOLT:AC:RANG:AUTO %d",
192 """ A boolean property that toggles auto ranging for AC voltage. """,
193 validator=strict_discrete_set,
194 values=BOOLS,
195 map_values=True
196 )
197 voltage_ac_resolution = Instrument.control(
198 ":SENS:VOLT:AC:RES?", ":SENS:VOLT:AC:RES %s",
199 """ A property that controls the resolution in the AC voltage readings,
200 which can take values 3.00E-5, 2.00E-5, 1.50E-6 (5 1/2 digits),
201 as well as "MIN", "MAX", or "DEF" (1.50E-6). """,
202 validator=strict_discrete_set,
203 values=[3.00E-5, 2.00E-5, 1.50E-6, "MAX", "MIN", "DEF"]
204 )
205
206 ####################
207 # Resistance (Ohm) #
208 ####################
209
210 resistance = Instrument.measurement(":READ?",
211 """ Reads a resistance measurement in Ohms for 2-wire
212 configuration, based on the active
213 :attr:`~.Agilent34450A.mode`. """
214 )
215 resistance_4w = Instrument.measurement(":READ?",
216 """ Reads a resistance measurement in Ohms for
217 4-wire configuration, based on the active
218 :attr:`~.Agilent34450A.mode`. """
219 )
220 resistance_range = Instrument.control(
221 ":SENS:RES:RANG?", ":SENS:RES:RANG:AUTO 0;:SENS:RES:RANG %s",
222 """ A property that controls the 2-wire resistance range in Ohms, which can
223 take values 100, 1E3, 10E3, 100E3, 1E6, 10E6, 100E6, as well as "MIN", "MAX",
224 or "DEF" (1E3).
225 Auto-range is disabled when this property is set. """,
226 validator=strict_discrete_set,
227 values=[100, 1E3, 10E3, 100E3, 1E6, 10E6, 100E6, "MAX", "MIN", "DEF"]
228 )
229 resistance_auto_range = Instrument.control(
230 ":SENS:RES:RANG:AUTO?", ":SENS:RES:RANG:AUTO %d",
231 """ A boolean property that toggles auto ranging for 2-wire resistance. """,
232 validator=strict_discrete_set,
233 values=BOOLS,
234 map_values=True
235 )
236 resistance_resolution = Instrument.control(
237 ":SENS:RES:RES?", ":SENS:RES:RES %s",
238 """ A property that controls the resolution in the 2-wire
239 resistance readings, which can take values 3.00E-5, 2.00E-5, 1.50E-6 (5 1/2 digits),
240 as well as "MIN", "MAX", or "DEF" (1.50E-6). """,
241 validator=strict_discrete_set,
242 values=[3.00E-5, 2.00E-5, 1.50E-6, "MAX", "MIN", "DEF"]
243 )
244 resistance_4w_range = Instrument.control(
245 ":SENS:FRES:RANG?", ":SENS:FRES:RANG:AUTO 0;:SENS:FRES:RANG %s",
246 """ A property that controls the 4-wire resistance range
247 in Ohms, which can take values 100, 1E3, 10E3, 100E3, 1E6, 10E6, 100E6,
248 as well as "MIN", "MAX", or "DEF" (1E3).
249 Auto-range is disabled when this property is set. """,
250 validator=strict_discrete_set,
251 values=[100, 1E3, 10E3, 100E3, 1E6, 10E6, 100E6, "MAX", "MIN", "DEF"]
252 )
253 resistance_4w_auto_range = Instrument.control(
254 ":SENS:FRES:RANG:AUTO?", ":SENS:FRES:RANG:AUTO %d",
255 """ A boolean property that toggles auto ranging for 4-wire resistance. """,
256 validator=strict_discrete_set,
257 values=BOOLS,
258 map_values=True
259 )
260 resistance_4w_resolution = Instrument.control(
261 ":SENS:FRES:RES?", ":SENS:FRES:RES %s",
262 """ A property that controls the resolution in the 4-wire
263 resistance readings, which can take values 3.00E-5, 2.00E-5, 1.50E-6 (5 1/2 digits),
264 as well as "MIN", "MAX", or "DEF" (1.50E-6). """,
265 validator=strict_discrete_set,
266 values=[3.00E-5, 2.00E-5, 1.50E-6, "MAX", "MIN", "DEF"]
267 )
268
269 ##################
270 # Frequency (Hz) #
271 ##################
272
273 frequency = Instrument.measurement(":READ?",
274 """ Reads a frequency measurement in Hz, based on the
275 active :attr:`~.Agilent34450A.mode`. """
276 )
277 frequency_current_range = Instrument.control(
278 ":SENS:FREQ:CURR:RANG?", ":SENS:FREQ:CURR:RANG:AUTO 0;:SENS:FREQ:CURR:RANG %s",
279 """ A property that controls the current range in Amps for frequency on AC current
280 measurements, which can take values 10E-3, 100E-3, 1, 10, as well as "MIN",
281 "MAX", or "DEF" (100 mA).
282 Auto-range is disabled when this property is set. """,
283 validator=strict_discrete_set,
284 values=[10E-3, 100E-3, 1, 10, "MIN", "MAX", "DEF"]
285 )
286 frequency_current_auto_range = Instrument.control(
287 ":SENS:FREQ:CURR:RANG:AUTO?", ":SENS:FREQ:CURR:RANG:AUTO %d",
288 """ Boolean property that toggles auto ranging for AC current in frequency measurements.""",
289 validator=strict_discrete_set,
290 values=BOOLS,
291 map_values=True
292 )
293 frequency_voltage_range = Instrument.control(
294 ":SENS:FREQ:VOLT:RANG?", ":SENS:FREQ:VOLT:RANG:AUTO 0;:SENS:FREQ:VOLT:RANG %s",
295 """ A property that controls the voltage range in Volts for frequency on AC voltage
296 measurements, which can take values 100E-3, 1, 10, 100, 750,
297 as well as "MIN", "MAX", or "DEF" (10 V).
298 Auto-range is disabled when this property is set. """,
299 validator=strict_discrete_set,
300 values=[100E-3, 1, 10, 100, 750, "MAX", "MIN", "DEF"]
301 )
302 frequency_voltage_auto_range = Instrument.control(
303 ":SENS:FREQ:VOLT:RANG:AUTO?", ":SENS:FREQ:VOLT:RANG:AUTO %d",
304 """Boolean property that toggles auto ranging for AC voltage in frequency measurements. """,
305 validator=strict_discrete_set,
306 values=BOOLS,
307 map_values=True
308 )
309 frequency_aperture = Instrument.control(
310 ":SENS:FREQ:APER?", ":SENS:FREQ:APER %s",
311 """ A property that controls the frequency aperture in seconds,
312 which sets the integration period and measurement speed. Takes values
313 100 ms, 1 s, as well as "MIN", "MAX", or "DEF" (1 s). """,
314 validator=strict_discrete_set,
315 values=[100E-3, 1, "MIN", "MAX", "DEF"]
316 )
317
318 ###################
319 # Temperature (C) #
320 ###################
321
322 temperature = Instrument.measurement(
323 ":READ?",
324 """ Reads a temperature measurement in Celsius, based on the active :attr:`~.Agilent34450A.mode`.
325 """ # noqa: E501
326 )
327
328 #############
329 # Diode (V) #
330 #############
331
332 diode = Instrument.measurement(
333 ":READ?",
334 """ Reads a diode measurement in Volts, based on the active :attr:`~.Agilent34450A.mode`.
335 """
336 )
337
338 ###################
339 # Capacitance (F) #
340 ###################
341
342 capacitance = Instrument.measurement(
343 ":READ?",
344 """ Reads a capacitance measurement in Farads, based on the active :attr:`~.Agilent34450A.mode`.
345 """ # noqa: E501
346 )
347 capacitance_range = Instrument.control(
348 ":SENS:CAP:RANG?", ":SENS:CAP:RANG:AUTO 0;:SENS:CAP:RANG %s",
349 """ A property that controls the capacitance range
350 in Farads, which can take values 1E-9, 10E-9, 100E-9, 1E-6, 10E-6, 100E-6,
351 1E-3, 10E-3, as well as "MIN", "MAX", or "DEF" (1E-6).
352 Auto-range is disabled when this property is set. """,
353 validator=strict_discrete_set,
354 values=[1E-9, 10E-9, 100E-9, 1E-6, 10E-6, 100E-6, 1E-3, 10E-3, "MAX", "MIN", "DEF"]
355 )
356 capacitance_auto_range = Instrument.control(
357 ":SENS:CAP:RANG:AUTO?", ":SENS:CAP:RANG:AUTO %d",
358 """ A boolean property that toggles auto ranging for capacitance. """,
359 validator=strict_discrete_set,
360 values=BOOLS,
361 map_values=True
362 )
363
364 ####################
365 # Continuity (Ohm) #
366 ####################
367
368 continuity = Instrument.measurement(":READ?",
369 """ Reads a continuity measurement in Ohms,
370 based on the active :attr:`~.Agilent34450A.mode`. """
371 )
372
373 def __init__(self, adapter, name="HP/Agilent/Keysight 34450A Multimeter", **kwargs):
374 super().__init__(
375 adapter, name, timeout=10000, **kwargs
376 )
377 # Configuration changes can necessitate up to 8.8 secs (per datasheet)
378 self.check_errors()
379
380 def configure_voltage(self, voltage_range="AUTO", ac=False, resolution="DEF"):
381 """ Configures the instrument to measure voltage.
382
383 :param voltage_range: A voltage in Volts to set the voltage range.
384 DC values can be 100E-3, 1, 10, 100, 1000, as well as "MIN", "MAX",
385 "DEF" (10 V), or "AUTO". AC values can be 100E-3, 1, 10, 100, 750,
386 as well as "MIN", "MAX", "DEF" (10 V), or "AUTO".
387 :param ac: False for DC voltage, True for AC voltage
388 :param resolution: Desired resolution, can be 3.00E-5, 2.00E-5,
389 1.50E-6 (5 1/2 digits), as well as "MIN", "MAX", or "DEF" (1.50E-6).
390 """
391 if ac is True:
392 self.mode = 'ac voltage'
393 self.voltage_ac_resolution = resolution
394 if voltage_range == "AUTO":
395 self.voltage_ac_auto_range = True
396 else:
397 self.voltage_ac_range = voltage_range
398 elif ac is False:
399 self.mode = 'voltage'
400 self.voltage_resolution = resolution
401 if voltage_range == "AUTO":
402 self.voltage_auto_range = True
403 else:
404 self.voltage_range = voltage_range
405 else:
406 raise TypeError('Value of ac should be a boolean.')
407
408 def configure_current(self, current_range="AUTO", ac=False, resolution="DEF"):
409 """ Configures the instrument to measure current.
410
411 :param current_range: A current in Amps to set the current range.
412 DC values can be 100E-6, 1E-3, 10E-3, 100E-3, 1, 10, as well as "MIN",
413 "MAX", "DEF" (100 mA), or "AUTO". AC values can be 10E-3, 100E-3, 1, 10,
414 as well as "MIN", "MAX", "DEF" (100 mA), or "AUTO".
415 :param ac: False for DC current, and True for AC current
416 :param resolution: Desired resolution, can be 3.00E-5, 2.00E-5, 1.50E-6 (5 1/2 digits),
417 as well as "MIN", "MAX", or "DEF" (1.50E-6).
418 """
419 if ac is True:
420 self.mode = 'ac current'
421 self.current_ac_resolution = resolution
422 if current_range == "AUTO":
423 self.current_ac_auto_range = True
424 else:
425 self.current_ac_range = current_range
426 elif ac is False:
427 self.mode = 'current'
428 self.current_resolution = resolution
429 if current_range == "AUTO":
430 self.current_auto_range = True
431 else:
432 self.current_range = current_range
433 else:
434 raise TypeError('Value of ac should be a boolean.')
435
436 def configure_resistance(self, resistance_range="AUTO", wires=2, resolution="DEF"):
437 """ Configures the instrument to measure resistance.
438
439 :param resistance_range: A resistance in Ohms to set the resistance range, can be 100,
440 1E3, 10E3, 100E3, 1E6, 10E6, 100E6, as well as "MIN", "MAX", "DEF" (1E3), or "AUTO".
441 :param wires: Number of wires used for measurement, can be 2 or 4.
442 :param resolution: Desired resolution, can be 3.00E-5, 2.00E-5, 1.50E-6 (5 1/2 digits),
443 as well as "MIN", "MAX", or "DEF" (1.50E-6).
444 """
445 if wires == 2:
446 self.mode = 'resistance'
447 self.resistance_resolution = resolution
448 if resistance_range == "AUTO":
449 self.resistance_auto_range = True
450 else:
451 self.resistance_range = resistance_range
452 elif wires == 4:
453 self.mode = '4w resistance'
454 self.resistance_4w_resolution = resolution
455 if resistance_range == "AUTO":
456 self.resistance_4w_auto_range = True
457 else:
458 self.resistance_4w_range = resistance_range
459 else:
460 raise ValueError("Incorrect wires value, Agilent 34450A only supports 2 or 4 wire"
461 "resistance measurement.")
462
463 def configure_frequency(self, measured_from="voltage_ac",
464 measured_from_range="AUTO", aperture="DEF"):
465 """ Configures the instrument to measure frequency.
466
467 :param measured_from: "voltage_ac" or "current_ac"
468 :param measured_from_range: range of measured_from. AC voltage can have ranges 100E-3,
469 1, 10, 100, 750, as well as "MIN", "MAX", "DEF" (10 V),
470 or "AUTO". AC current can have ranges 10E-3, 100E-3, 1, 10,
471 as well as "MIN", "MAX", "DEF" (100 mA), or "AUTO".
472 :param aperture: Aperture time in Seconds, can be 100 ms, 1 s, as well as "MIN", "MAX",
473 or "DEF" (1 s).
474 """
475 if measured_from == "voltage_ac":
476 self.mode = "voltage frequency"
477 if measured_from_range == "AUTO":
478 self.frequency_voltage_auto_range = True
479 else:
480 self.frequency_voltage_range = measured_from_range
481 elif measured_from == "current_ac":
482 self.mode = "current frequency"
483 if measured_from_range == "AUTO":
484 self.frequency_current_auto_range = True
485 else:
486 self.frequency_current_range = measured_from_range
487 else:
488 raise ValueError('Incorrect value for measured_from parameter. Use '
489 '"voltage_ac" or "current_ac".')
490 self.frequency_aperture = aperture
491
492 def configure_temperature(self):
493 """ Configures the instrument to measure temperature.
494 """
495 self.mode = 'temperature'
496
497 def configure_diode(self):
498 """ Configures the instrument to measure diode voltage.
499 """
500 self.mode = 'diode'
501
502 def configure_capacitance(self, capacitance_range="AUTO"):
503 """ Configures the instrument to measure capacitance.
504
505 :param capacitance_range: A capacitance in Farads to set the capacitance range, can be
506 1E-9, 10E-9, 100E-9, 1E-6, 10E-6, 100E-6, 1E-3, 10E-3,
507 as well as "MIN", "MAX", "DEF" (1E-6), or "AUTO".
508 """
509 self.mode = 'capacitance'
510 if capacitance_range == "AUTO":
511 self.capacitance_auto_range = True
512 else:
513 self.capacitance_range = capacitance_range
514
515 def configure_continuity(self):
516 """ Configures the instrument to measure continuity.
517 """
518 self.mode = 'continuity'
519
520 def beep(self):
521 """ Sounds a system beep.
522 """
523 self.write(":SYST:BEEP")
524
525 def _conf_parser(self, conf_values):
526 """
527 Parse the string of configuration parameters read from Agilent34450A with
528 command ":configure?" and returns a list of parameters.
529
530 Use cases:
531
532 ['"CURR +1.000000E-01', '+1.500000E-06"'] from Instrument.measurement or Instrument.control
533 '"CURR +1.000000E-01,+1.500000E-06"' from Instrument.ask
534
535 becomes
536
537 ["CURR", +1000000E-01, +1.500000E-06]
538 """
539 # If not already one string, get one string
540
541 if isinstance(conf_values, list):
542 one_long_string = ', '.join(map(str, conf_values))
543 else:
544 one_long_string = conf_values
545
546 # Split string in elements
547 list_of_elements = re.split(r'["\s,]', one_long_string)
548
549 # Eliminate empty string elements
550 list_without_empty_elements = list(filter(lambda v: v != '', list_of_elements))
551
552 # Convert numbers from str to float, where applicable
553 for i, v in enumerate(list_without_empty_elements):
554 try:
555 list_without_empty_elements[i] = float(v)
556 except ValueError as e:
557 log.error(e)
558
559 return list_without_empty_elements