Skip to content

Commit cb85f43

Browse files
committed
Merge remote-tracking branch 'refs/remotes/Labber-software/master'
2 parents db73837 + ffd2249 commit cb85f43

File tree

7 files changed

+1275
-0
lines changed

7 files changed

+1275
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Instrument driver configuration file.
2+
3+
[General settings]
4+
5+
# The name is shown in all the configuration windows
6+
name: Cryomagnetics LM510
7+
8+
# The version string should be updated whenever changes are made to this config file
9+
version: 1.0
10+
11+
# Name of folder containing the code defining a custom driver. Do not define this item
12+
# or leave it blank for any standard driver based on the built-in VISA interface.
13+
driver_path: Cryomagnetics LM510
14+
15+
16+
17+
[Model and options]
18+
# The option section allow instruments with different options to use the same driver
19+
20+
# Check instrument model id at startup (True or False). Default is False
21+
check_model: False
22+
23+
24+
model_id_1: LM-510
25+
26+
model_str_1: Cryomagnetics LM510
27+
28+
29+
30+
# General VISA settings for the instrument.
31+
[VISA settings]
32+
33+
# Enable or disable communication over the VISA protocol (True or False)
34+
# If False, the driver will not perform any operations (unless there is a custom driver).
35+
use_visa = True
36+
37+
# Reset the interface (not the instrument) at startup (True or False). Default is False
38+
reset: False
39+
40+
# Time (in seconds) before the timing out while waiting for an instrument response. Default is 5
41+
timeout: 2
42+
43+
# Query instrument errors (True or False). If True, every command sent to the device will
44+
# be followed by an error query. This is useful when testing new setups, but may degrade
45+
# performance by slowing down the instrument communication.
46+
query_instr_errors: False
47+
48+
# Bit mask for checking status byte errors (default is 255, include all errors)
49+
# The bits signal the following errors:
50+
# 0: Operation
51+
# 1: Request control
52+
# 2: Query error
53+
# 3: Device error
54+
# 4: Execution error
55+
# 5: Command error
56+
# 6: User request
57+
# 7: Power on
58+
error_bit_mask: 255
59+
60+
# SCPI string to be used when querying for instrument error messages
61+
error_cmd:
62+
63+
# Initialization commands are sent to the instrument when starting the driver
64+
# *RST will reset the device, *CLS clears the interface
65+
init:
66+
67+
# Final commands sent to the instrument when closing the driver
68+
final:
69+
70+
71+
# Define quantities in sections. The section name should be the same as the "name" value
72+
# The following keywords are allowed:
73+
# name: Quantity name
74+
# unit: Quantity unit
75+
# enabled: Determines wether the control is enabled from start. Default is True
76+
# datatype: The data type should be one of DOUBLE, BOOLEAN, COMBO or STRING
77+
# def_value: Default value
78+
# low_lim: Lowest allowable value. Defaults to -INF
79+
# high_lim: Highest allowable values. Defaults to +INF
80+
# combo_def_1: First option in a pull-down combo box. Only used when datatype=COMBO
81+
# combo_def_2: Second option in a pull-down combo box. Only used when datatype=COMBO
82+
# ...
83+
# combo_def_n: nth option in a pull-down combo box. Only used when datatype=COMBO
84+
# group: Name of the group where the control belongs.
85+
# state_quant: Quantity that determines this control's visibility
86+
# state_value_1: Value of "state_quant" for which the control is visible
87+
# state_value_2: Value of "state_quant" for which the control is visible
88+
# ...
89+
# state_value_n: Value of "state_quant" for which the control is visible
90+
# permission: Sets read/writability, options are BOTH, READ, WRITE or NONE. Default is BOTH
91+
# set_cmd: Command used to send data to the instrument. Put <*> where the value should appear.
92+
# sweep_cmd: Command used to sweep data. Use <sr> for sweep rate, and <*> for the value.
93+
# get_cmd: Command used to get the data from the instrument. Default is set_cmd?
94+
95+
96+
[LHe Level]
97+
permission: READ
98+
datatype: DOUBLE
99+
unit: cm
100+
get_cmd: MEAS?
101+
102+
[Interval]
103+
datatype: DOUBLE
104+
unit: s
105+
get_cmd: INTVL?
106+
set_cmd: INTVL
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env python
2+
3+
import InstrumentDriver
4+
from VISA_Driver import VISA_Driver
5+
import visa
6+
from InstrumentConfig import InstrumentQuantity
7+
8+
__version__ = "0.0.1"
9+
10+
class Error(Exception):
11+
pass
12+
13+
class Driver(VISA_Driver):
14+
""" This class implements the Lakeshore 475 driver"""
15+
16+
def performOpen(self, options={}):
17+
"""Perform the operation of opening the instrument connection"""
18+
# calling the generic VISA open to make sure we have a connection
19+
VISA_Driver.performOpen(self, options=options)
20+
21+
22+
def performGetValue(self, quant, options={}):
23+
"""Perform the Get Value instrument operation"""
24+
# check type of quantity
25+
self.write(quant.get_cmd, bCheckError=True)
26+
self.read(None, ignore_termination=False)
27+
value = self.read(None, ignore_termination=False)
28+
if quant.name in ('LHe Level'):
29+
value = value[:-3]
30+
if quant.name in ('Interval'):
31+
hms = value.split(":")
32+
value = int(hms[0]) * 3600 + int(hms[1])*60 + int(hms[2])
33+
return value
34+
35+
def performSetValue(self, quant, value, sweepRate=0.0, options={}):
36+
"""Perform the set value operation"""
37+
self.write("REMOTE")
38+
self.read(None, ignore_termination=False)
39+
if quant.name in ('Interval'):
40+
m, s = divmod(value, 60)
41+
h, m = divmod(m, 60)
42+
cmd = quant.set_cmd + " " + ("%02d:%02d:%02d" % (h, m, s))
43+
self.writeAndLog(cmd, bCheckError=True)
44+
self.read(None, ignore_termination=False)
45+
self.write("LOCAL")
46+
self.read(None, ignore_termination=False)
47+
return value
48+
49+
if __name__ == '__main__':
50+
pass
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
3+
def upgradeDriverCfg(version, dValue={}, dOption=[]):
4+
"""Upgrade the config given by the dict dValue and dict dOption to the
5+
latest version."""
6+
# the dQuantUpdate dict contains rules for replacing missing quantities
7+
dQuantReplace = {}
8+
# update quantities depending on version
9+
if version == '1.0':
10+
# convert version 1.0 -> 1.1
11+
# changes:
12+
# zero-span mode moved from bool to combo box with start-stop, center-span
13+
version = '1.1'
14+
# assume old value quantity was referring to a voltage
15+
if 'Zero-span mode' in dValue:
16+
bZeroSpan = dValue.pop('Zero-span mode')
17+
if bZeroSpan:
18+
dValue['Range type'] = 'Zero-span mode'
19+
else:
20+
dValue['Range type'] = 'Center - Span'
21+
# return new version and data
22+
return (version, dValue, dOption, dQuantReplace)

0 commit comments

Comments
 (0)