fix undefined status in softcal
when the status of the rawsensor is not changed, the status of the calibrated module was not initialized properly. Change-Id: I2c23e245226ffb7643060e486c9dfde250a79ce9 Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/29356 Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
parent
43880346d6
commit
1922578dfa
@ -27,7 +27,8 @@ from os.path import basename, dirname, exists, join
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy.interpolate import splev, splrep # pylint: disable=import-error
|
from scipy.interpolate import splev, splrep # pylint: disable=import-error
|
||||||
|
|
||||||
from secop.core import Attached, BoolType, Parameter, Readable, StringType, FloatRange
|
from secop.core import Attached, BoolType, Parameter, Readable, StringType, \
|
||||||
|
FloatRange, Done
|
||||||
|
|
||||||
|
|
||||||
def linear(x):
|
def linear(x):
|
||||||
@ -182,7 +183,6 @@ class Sensor(Readable):
|
|||||||
|
|
||||||
description = 'a calibrated sensor value'
|
description = 'a calibrated sensor value'
|
||||||
_value_error = None
|
_value_error = None
|
||||||
enablePoll = False
|
|
||||||
|
|
||||||
def checkProperties(self):
|
def checkProperties(self):
|
||||||
if 'description' not in self.propertyValues:
|
if 'description' not in self.propertyValues:
|
||||||
@ -196,6 +196,9 @@ class Sensor(Readable):
|
|||||||
if self.description == '_':
|
if self.description == '_':
|
||||||
self.description = '%r calibrated with curve %r' % (self.rawsensor, self.calib)
|
self.description = '%r calibrated with curve %r' % (self.rawsensor, self.calib)
|
||||||
|
|
||||||
|
def doPoll(self):
|
||||||
|
self.read_status()
|
||||||
|
|
||||||
def write_calib(self, value):
|
def write_calib(self, value):
|
||||||
self._calib = CalCurve(value)
|
self._calib = CalCurve(value)
|
||||||
return value
|
return value
|
||||||
@ -221,3 +224,7 @@ class Sensor(Readable):
|
|||||||
|
|
||||||
def read_value(self):
|
def read_value(self):
|
||||||
return self._calib(self.rawsensor.read_value())
|
return self._calib(self.rawsensor.read_value())
|
||||||
|
|
||||||
|
def read_status(self):
|
||||||
|
self.update_status(self.rawsensor.status)
|
||||||
|
return Done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user