]> jspc29.x-matter.uni-frankfurt.de Git - mvd_epics.git/commitdiff
OPUS20: rm monkey-patched adel/mdel support (now built-in)
authorPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Fri, 25 Aug 2017 13:11:14 +0000 (15:11 +0200)
committerPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Fri, 25 Aug 2017 13:11:14 +0000 (15:11 +0200)
LUFFT_OPUS20/lufft_opus20_driver.py
LUFFT_OPUS20/requirements.txt

index 4e1dfe7a6cbe18fbfea564d0f253f999d930bead..4fbfaf4691a897d866bff831807bcdc6b43697f5 100644 (file)
@@ -1,28 +1,10 @@
 
 from pcaspy import Driver, Alarm, Severity
 from pcaspy.driver import manager
-from pcaspy import PVInfo
-from pcaspy import cas
-import pcaspy
 from opus20 import Opus20, OPUS20_CHANNEL_SPEC, Opus20ConnectionException
 
 import time, threading
 
-class ExtendedPVInfo(PVInfo):
-    """
-    Derived class from PVInfo
-    Aim: monkey patching PVInfo to support MDEL/ADEL
-    """
-    def __init__(self, info):
-        # initialize from info dict with defaults
-        self.mdel = info.get('mdel', None)
-        self.adel = info.get('adel', None)
-        PVInfo.__init__(self, info)
-
-# apply PVInfo monkey patch:
-pcaspy.PVInfo = ExtendedPVInfo
-pcaspy.driver.PVInfo = ExtendedPVInfo
-
 class Opus20Driver(Driver):
     def __init__(self, hostname, opus20_port=None, opus20_timeout=0.1, scan_period=5.0):
         self.hostname = hostname
@@ -34,32 +16,6 @@ class Opus20Driver(Driver):
 
         super(Opus20Driver, self).__init__()
 
-    def setParamValue(self, reason, value):
-        """
-        overriding Driver.setParamValue()
-        <https://github.com/paulscherrerinstitute/pcaspy/blob/master/pcaspy/driver.py#L155>
-        Made to support the ADEL/MDEL fields
-        """
-        # check whether update is needed
-        same = self.pvDB[reason].value == value
-        if (type(same) == bool and not same) or (hasattr(same, 'all') and not same.all()):
-            # make a copy of mutable objects, list, numpy.ndarray
-            if isinstance(value, list):
-                value = value[:]
-            elif 'numpy.ndarray' in str(type(value)):
-                value = value.copy()
-            mask = 0
-            pv = manager.pvs[self.port][reason]
-            abs_delta = abs(value-self.pvDB[reason].value)
-            if not pv.info.mdel or (abs_delta > pv.info.mdel):
-                mask |= cas.DBE_VALUE
-            if not pv.info.adel or (abs_delta > pv.info.adel):
-                mask |= cas.DBE_LOG
-            self.pvDB[reason].value = value
-            self.pvDB[reason].flag = True
-            self.pvDB[reason].mask = mask
-        self.pvDB[reason].time = cas.epicsTimeStamp()
-
     def connect_opus20(self):
         kwargs = {}
         if self.opus20_port: kwargs['port'] = self.opus20_port
index 8c4f5e012e6a504a349b9bf180dc0da57c2563fb..1350af2d0b98ed350e13a0368a00a0767c0a6225 100644 (file)
@@ -1,2 +1,3 @@
-PCASpy
+#PCASpy
+https://github.com/paulscherrerinstitute/pcaspy/archive/master.zip
 opus20