Skip to content

Commit

Permalink
Merge branch 'master' into driver/ami430_expand
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshnielsen authored Jan 25, 2018
2 parents 3bc4528 + 6e75111 commit 653514f
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 11 deletions.
1 change: 0 additions & 1 deletion qcodes/.coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ omit =
instrument_drivers/Keysight/Infiniium.py
instrument_drivers/Keysight/Keysight_33500B.py
instrument_drivers/Keysight/Keysight_33500B_channels.py
instrument_drivers/Keysight/Keysight_34465A.py
instrument_drivers/Keysight/Keysight_E8267D.py
instrument_drivers/Keysight/M3201A.py
instrument_drivers/Keysight/M3300A.py
Expand Down
72 changes: 72 additions & 0 deletions qcodes/instrument/sims/Keysight_34465A.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Simulated Keysight 34465A instrument
spec: "1.0"
devices:
device 1:
eom:
GPIB INSTR:
q: "\n"
r: "\n"
error: ERROR
dialogues:
- q: "*IDN?"
r: "Keysight, 34465A, 1000, 0.1"
properties:
voltage:
default: 10
getter:
q: "READ?"
r: "{}"
dc_autorange:
default: 0
getter:
q: "SENSe:VOLTage:DC:RANGe:AUTO?"
r: "{}"
setter:
q: "SENSe:VOLTage:DC:RANGe:AUTO {}"
r: "{}"
specs:
valid: [0, 1]
type: int
dc_range:
default: 1
getter:
q: "SENSe:VOLTage:DC:RANGe?"
r: "{}"
setter:
q: "SENSe:VOLTage:DC:RANGe {}"
r: "{}"
specs:
valid: [0.1, 1, 10, 100, 1000]
type: float
NPLC:
default: 10.0
getter:
q: "SENSe:VOLTage:DC:NPLC?"
r: "{}"
setter:
q: "SENSe:VOLTage:DC:NPLC {}"
r: "{}"
specs:
valid: [0.001, 0.002, 0.006, 0.02, 0.06, .2, 1, 10, 100]
type: float
resolution:
default: +3.00000000E-05
getter:
q: "SENSe:VOLTage:DC:RESolution?"
r: "{}"
setter:
q: "SENSe:VOLTage:DC:RESolution {}"
r: "{}"
apterture_enabled:
default: 0
getter:
q: "SENSe:VOLTage:DC:APERture:ENABled?"
r: "{}"
setter:
q: "SENSe:VOLTage:DC:APERture:ENABled {}"
r: "{}"


resources:
GPIB::1::INSTR:
device: device 1
4 changes: 2 additions & 2 deletions qcodes/instrument_drivers/Keysight/Keysight_34465A.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ def errorparser(rawmssg: str) -> (int, str):

self.add_parameter('autorange',
label='Autorange',
set_cmd='SENSe:VOLtage:DC:RANGe:AUTO {}',
get_cmd='SENSe:VOLtage:DC:RANGe:AUTO?',
set_cmd='SENSe:VOLTage:DC:RANGe:AUTO {}',
get_cmd='SENSe:VOLTage:DC:RANGe:AUTO?',
val_mapping={'ON': 1, 'OFF': 0},
vals=vals.Enum('ON', 'OFF'))

Expand Down
8 changes: 4 additions & 4 deletions qcodes/instrument_drivers/stanford_research/SR830.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,20 +550,20 @@ def _get_input_config(self, s):
mode = self._N_TO_INPUT_CONFIG[int(s)]

if mode in ['a', 'a-b']:
self.sensitivity.set_validator(self._VOLT_ENUM)
self.sensitivity.vals = self._VOLT_ENUM
self._set_units('V')
else:
self.sensitivity.set_validator(self._CURR_ENUM)
self.sensitivity.vals = self._CURR_ENUM
self._set_units('A')

return mode

def _set_input_config(self, s):
if s in ['a', 'a-b']:
self.sensitivity.set_validator(self._VOLT_ENUM)
self.sensitivity.vals = self._VOLT_ENUM
self._set_units('V')
else:
self.sensitivity.set_validator(self._CURR_ENUM)
self.sensitivity.vals = self._CURR_ENUM
self._set_units('A')

return self._INPUT_CONFIG_TO_N[s]
Expand Down
8 changes: 4 additions & 4 deletions qcodes/instrument_drivers/stanford_research/SR86x.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,20 +539,20 @@ def _get_input_config(self, s):
mode = self._N_TO_INPUT_SIGNAL[int(s)]

if mode == 'voltage':
self.sensitivity.set_validator(self._VOLT_ENUM)
self.sensitivity.vals = self._VOLT_ENUM
self._set_units('V')
else:
self.sensitivity.set_validator(self._CURR_ENUM)
self.sensitivity.vals = self._CURR_ENUM
self._set_units('A')

return mode

def _set_input_config(self, s):
if s == 'voltage':
self.sensitivity.set_validator(self._VOLT_ENUM)
self.sensitivity.vals = self._VOLT_ENUM
self._set_units('V')
else:
self.sensitivity.set_validator(self._CURR_ENUM)
self.sensitivity.vals = self._CURR_ENUM
self._set_units('A')

return self._INPUT_SIGNAL_TO_N[s]
Expand Down
43 changes: 43 additions & 0 deletions qcodes/tests/drivers/test_keysight_34465a.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import pytest

import qcodes.instrument.sims as sims
from qcodes.instrument_drivers.Keysight.Keysight_34465A import Keysight_34465A
visalib = sims.__file__.replace('__init__.py', 'Keysight_34465A.yaml@sim')


@pytest.fixture(scope='function')
def driver():
keysight_sim = Keysight_34465A('keysight_34465A_sim',
address='GPIB::1::65535::INSTR',
visalib=visalib)

yield keysight_sim

keysight_sim.close()


def test_init(driver):
idn = driver.IDN()
assert idn['vendor'] == 'Keysight'


def test_NPLC(driver):
assert driver.NPLC.get() == 10.0
driver.NPLC.set(0.2)
assert driver.NPLC.get() == 0.2


def test_get_voltage(driver):
voltage = driver.volt.get()
assert voltage == 10.0


def test_set_get_autorange(driver):
ar = driver.autorange.get()
assert ar == 'OFF'
driver.autorange.set('ON')
ar = driver.autorange.get()
assert ar == 'ON'
driver.autorange.set('OFF')
ar = driver.autorange.get()
assert ar == 'OFF'

0 comments on commit 653514f

Please sign in to comment.