softcal: change name of param 'calib' to 'calcurve'

make it more consistent

Change-Id: I8d8f62190c07179de25c893bfcdf11300010cd78
This commit is contained in:
2025-06-24 10:49:26 +02:00
parent 1a70099974
commit 8385461163
6 changed files with 11 additions and 11 deletions

View File

@@ -54,7 +54,7 @@ Mod('T',
'frappy_psi.softcal.Sensor',
'temperature sensor, soft calibration',
rawsensor='res',
calib='X132254',
calcurve='X132254',
value=Param(
unit='K',
),

View File

@@ -16,5 +16,5 @@ Mod('T2',
'',
value = Param(unit = 'K'),
rawsensor = 'r2',
calib = 'X131346',
calcurve = 'X131346',
)

View File

@@ -43,5 +43,5 @@ Mod('ts',
'calibrated value for ts',
value = Param(unit = 'K'),
rawsensor = 'tsraw',
calib = 'X133834',
calcurve = 'X133834',
)

View File

@@ -38,6 +38,6 @@ Mod('T_sample',
output_module='htr_sample',
p=1,
i=0.01,
calib='X161269',
calcurve='X161269',
value=Param(unit='K'),
)

View File

@@ -52,7 +52,7 @@ Mod('T',
'frappy_psi.softcal.Sensor',
'sample T',
rawsensor='res',
calib='X132254',
calcurve='X132254',
value=Param(
unit='K',
),

View File

@@ -176,7 +176,7 @@ class CalCurve:
class Sensor(Readable):
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)
value = Parameter(datatype=FloatRange(unit='K'))
pollinterval = Parameter(export=False)
@@ -193,18 +193,18 @@ class Sensor(Readable):
def initModule(self):
super().initModule()
self.rawsensor.registerCallbacks(self, ['status']) # auto update status
self._calib = CalCurve(self.calib)
self._calcurve = CalCurve(self.calcurve)
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):
self._calib = CalCurve(value)
def write_calcurve(self, value):
self._calcurve = CalCurve(value)
return value
def _get_value(self, rawvalue):
if self.abs:
rawvalue = abs(float(rawvalue))
return self._calib(rawvalue)
return self._calcurve(rawvalue)
def _get_status(self, rawstatus):
return rawstatus if self._value_error is None else (self.Status.ERROR, self._value_error)