softcal: change name of param 'calib' to 'calcurve'
make it more consistent Change-Id: I8d8f62190c07179de25c893bfcdf11300010cd78
This commit is contained in:
@@ -54,7 +54,7 @@ Mod('T',
|
|||||||
'frappy_psi.softcal.Sensor',
|
'frappy_psi.softcal.Sensor',
|
||||||
'temperature sensor, soft calibration',
|
'temperature sensor, soft calibration',
|
||||||
rawsensor='res',
|
rawsensor='res',
|
||||||
calib='X132254',
|
calcurve='X132254',
|
||||||
value=Param(
|
value=Param(
|
||||||
unit='K',
|
unit='K',
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -16,5 +16,5 @@ Mod('T2',
|
|||||||
'',
|
'',
|
||||||
value = Param(unit = 'K'),
|
value = Param(unit = 'K'),
|
||||||
rawsensor = 'r2',
|
rawsensor = 'r2',
|
||||||
calib = 'X131346',
|
calcurve = 'X131346',
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -43,5 +43,5 @@ Mod('ts',
|
|||||||
'calibrated value for ts',
|
'calibrated value for ts',
|
||||||
value = Param(unit = 'K'),
|
value = Param(unit = 'K'),
|
||||||
rawsensor = 'tsraw',
|
rawsensor = 'tsraw',
|
||||||
calib = 'X133834',
|
calcurve = 'X133834',
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -38,6 +38,6 @@ Mod('T_sample',
|
|||||||
output_module='htr_sample',
|
output_module='htr_sample',
|
||||||
p=1,
|
p=1,
|
||||||
i=0.01,
|
i=0.01,
|
||||||
calib='X161269',
|
calcurve='X161269',
|
||||||
value=Param(unit='K'),
|
value=Param(unit='K'),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ Mod('T',
|
|||||||
'frappy_psi.softcal.Sensor',
|
'frappy_psi.softcal.Sensor',
|
||||||
'sample T',
|
'sample T',
|
||||||
rawsensor='res',
|
rawsensor='res',
|
||||||
calib='X132254',
|
calcurve='X132254',
|
||||||
value=Param(
|
value=Param(
|
||||||
unit='K',
|
unit='K',
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ class CalCurve:
|
|||||||
class Sensor(Readable):
|
class Sensor(Readable):
|
||||||
rawsensor = Attached()
|
rawsensor = Attached()
|
||||||
|
|
||||||
calib = Parameter('calibration name', datatype=StringType(), readonly=False)
|
calcurve = Parameter('calibration name', datatype=StringType(), readonly=False)
|
||||||
abs = Parameter('True: take abs(raw) before calib', datatype=BoolType(), readonly=False, default=True)
|
abs = Parameter('True: take abs(raw) before calib', datatype=BoolType(), readonly=False, default=True)
|
||||||
value = Parameter(datatype=FloatRange(unit='K'))
|
value = Parameter(datatype=FloatRange(unit='K'))
|
||||||
pollinterval = Parameter(export=False)
|
pollinterval = Parameter(export=False)
|
||||||
@@ -193,18 +193,18 @@ class Sensor(Readable):
|
|||||||
def initModule(self):
|
def initModule(self):
|
||||||
super().initModule()
|
super().initModule()
|
||||||
self.rawsensor.registerCallbacks(self, ['status']) # auto update status
|
self.rawsensor.registerCallbacks(self, ['status']) # auto update status
|
||||||
self._calib = CalCurve(self.calib)
|
self._calcurve = CalCurve(self.calcurve)
|
||||||
if self.description == '_':
|
if self.description == '_':
|
||||||
self.description = f'{self.rawsensor!r} calibrated with curve {self.calib!r}'
|
self.description = f'{self.rawsensor!r} calibrated with curve {self.calcurve!r}'
|
||||||
|
|
||||||
def write_calib(self, value):
|
def write_calcurve(self, value):
|
||||||
self._calib = CalCurve(value)
|
self._calcurve = CalCurve(value)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def _get_value(self, rawvalue):
|
def _get_value(self, rawvalue):
|
||||||
if self.abs:
|
if self.abs:
|
||||||
rawvalue = abs(float(rawvalue))
|
rawvalue = abs(float(rawvalue))
|
||||||
return self._calib(rawvalue)
|
return self._calcurve(rawvalue)
|
||||||
|
|
||||||
def _get_status(self, rawstatus):
|
def _get_status(self, rawstatus):
|
||||||
return rawstatus if self._value_error is None else (self.Status.ERROR, self._value_error)
|
return rawstatus if self._value_error is None else (self.Status.ERROR, self._value_error)
|
||||||
|
|||||||
Reference in New Issue
Block a user