main module of LS370 is now drivable
- the main value is the channel - it is busy when pausing during scanning + allow softcal to ignore the sign
This commit is contained in:
parent
ad07ecdd69
commit
82b4af4faa
@ -21,7 +21,6 @@
|
|||||||
"""LakeShore Model 370 resistance channel"""
|
"""LakeShore Model 370 resistance channel"""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import json
|
|
||||||
|
|
||||||
from secop.modules import Readable, Drivable, Parameter, Override, Property, Attached
|
from secop.modules import Readable, Drivable, Parameter, Override, Property, Attached
|
||||||
from secop.metaclass import Done
|
from secop.metaclass import Done
|
||||||
@ -85,7 +84,11 @@ class Main(HasIodev, Drivable):
|
|||||||
self.sendRecv('INSET %d,0,0,0,0,0;INSET?%d' % (ch, ch))
|
self.sendRecv('INSET %d,0,0,0,0,0;INSET?%d' % (ch, ch))
|
||||||
|
|
||||||
def read_value(self):
|
def read_value(self):
|
||||||
channel, auto = json.loads('[%s]' % self.sendRecv('SCAN?'))
|
channel, auto = scan.send_command(self)
|
||||||
|
# response = self.sendRecv('SCAN?').strip().split(',')
|
||||||
|
# channel, auto = (int(s) for s in response)
|
||||||
|
if channel not in self._channels:
|
||||||
|
return channel
|
||||||
if not self._channels[channel].enabled:
|
if not self._channels[channel].enabled:
|
||||||
# channel was disabled recently, but still selected
|
# channel was disabled recently, but still selected
|
||||||
nextchannel = 0
|
nextchannel = 0
|
||||||
@ -96,13 +99,12 @@ class Main(HasIodev, Drivable):
|
|||||||
break
|
break
|
||||||
if nextchannel == 0:
|
if nextchannel == 0:
|
||||||
nextchannel = ch
|
nextchannel = ch
|
||||||
if not nextchannel:
|
if nextchannel:
|
||||||
self.write_target(nextchannel)
|
self.write_target(nextchannel)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
now = time.time()
|
now = time.time()
|
||||||
if channel != self.target:
|
if channel != self.target:
|
||||||
print('changed' , channel, self.target)
|
|
||||||
self._channel_changed = now
|
self._channel_changed = now
|
||||||
self.target = channel
|
self.target = channel
|
||||||
self.autoscan = int(auto)
|
self.autoscan = int(auto)
|
||||||
@ -113,7 +115,8 @@ class Main(HasIodev, Drivable):
|
|||||||
return channel
|
return channel
|
||||||
|
|
||||||
def write_target(self, channel):
|
def write_target(self, channel):
|
||||||
self.sendRecv('SCAN %d,%d;SCAN?' % (channel, self.autoscan))
|
scan.send_change(self, channel, self.autoscan)
|
||||||
|
# self.sendRecv('SCAN %d,%d;SCAN?' % (channel, self.autoscan))
|
||||||
if channel != self.value:
|
if channel != self.value:
|
||||||
self.value = 0
|
self.value = 0
|
||||||
self._channel_changed = time.time()
|
self._channel_changed = time.time()
|
||||||
|
@ -26,7 +26,7 @@ import math
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy.interpolate import splrep, splev # pylint: disable=import-error
|
from scipy.interpolate import splrep, splev # pylint: disable=import-error
|
||||||
|
|
||||||
from secop.core import Readable, Parameter, Override, Attached, StringType
|
from secop.core import Readable, Parameter, Override, Attached, StringType, BoolType
|
||||||
|
|
||||||
|
|
||||||
def linear(x):
|
def linear(x):
|
||||||
@ -152,6 +152,7 @@ class Sensor(Readable):
|
|||||||
}
|
}
|
||||||
parameters = {
|
parameters = {
|
||||||
'calib': Parameter('calibration name', datatype=StringType(), readonly=False),
|
'calib': Parameter('calibration name', datatype=StringType(), readonly=False),
|
||||||
|
'abs': Parameter('True: take abs(raw) before calib', datatype=BoolType(), readonly=False, default=True),
|
||||||
'value': Override(unit='K'),
|
'value': Override(unit='K'),
|
||||||
'pollinterval': Override(export=False),
|
'pollinterval': Override(export=False),
|
||||||
'status': Override(default=(Readable.Status.ERROR, 'unintialized'))
|
'status': Override(default=(Readable.Status.ERROR, 'unintialized'))
|
||||||
@ -169,10 +170,15 @@ class Sensor(Readable):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
def update_value(self, value):
|
def update_value(self, value):
|
||||||
|
if self.abs:
|
||||||
|
value = abs(value)
|
||||||
self.value = self._calib(value)
|
self.value = self._calib(value)
|
||||||
self._value_error = None
|
self._value_error = None
|
||||||
|
|
||||||
def error_update_value(self, err):
|
def error_update_value(self, err):
|
||||||
|
if self.abs and str(err) == 'R_UNDER':
|
||||||
|
self._value_error = None
|
||||||
|
return None
|
||||||
self._value_error = repr(err)
|
self._value_error = repr(err)
|
||||||
raise err
|
raise err
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user