22 lines
821 B
Python
22 lines
821 B
Python
#Creating the raw channel device and the averager
|
|
#ch1 = Channel("SARFE10-PBPG050:HAMP-INTENSITY",'d',alias="CH1")
|
|
ch1 = create_channel_device("SARFE10-PBPG050:HAMP-INTENSITY", type='d', size=None, deviceName="CH1" )
|
|
av1 = create_averager(ch1, count = 30, interval = 1.0, name="AV1")
|
|
ch1.monitored = True
|
|
av1.monitored = True
|
|
add_device(ch1, True)
|
|
add_device(av1, True)
|
|
|
|
#Creating a pseudo-device reading the stdev
|
|
class StDev(ReadonlyRegisterBase):
|
|
def doRead(self):
|
|
return AV1.stdev.read()
|
|
sd1= StDev("SD1")
|
|
add_device(sd1, True)
|
|
|
|
#Forwarding the change events of the averager to the psudo-device so stripchart is updated
|
|
class MyListener (DeviceListener):
|
|
def onCacheChanged(self, device, value, former, timestamp, valueChange):
|
|
SD1.update()
|
|
l1 = MyListener()
|
|
av1.addListener(l1) |