[sardana] 01/06: Imported Upstream version 1.3.1

Frédéric-Emmanuel Picca picca at moszumanska.debian.org
Sun Apr 13 10:46:04 UTC 2014


This is an automated email from the git hooks/post-receive script.

picca pushed a commit to branch master
in repository sardana.

commit b523d0ed6fb17b335a2fe85af33949b29d65b2db
Author: Picca Frédéric-Emmanuel <picca at debian.org>
Date:   Mon Feb 17 13:51:08 2014 +0100

    Imported Upstream version 1.3.1
---
 PKG-INFO                                           |  10 +-
 setup.py                                           |   1 +
 .../pool/poolcontrollers/OneDControllerTimer.py    | 255 ++++++++++++++++++++
 .../pool/poolcontrollers/OneDControllerTimer.py~   | 257 +++++++++++++++++++++
 src/sardana/release.py                             |   2 +-
 5 files changed, 519 insertions(+), 6 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 2cf95bc..1587018 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: sardana
-Version: 1.3.0
+Version: 1.3.1
 Summary: instrument control and data acquisition system
 Home-page: http://packages.python.org/sardana
 Author: Zbigniew Reszela
@@ -8,10 +8,10 @@ Author-email: zreszela at cells.es
 License: LGPL
 Download-URL: http://pypi.python.org/packages/source/s/sardana
 Description: Sardana is a Supervision, Control And Data Acquisition (SCADA) system for
-         scientific installations. It is written in Python and based on the TANGO
-         library. The hardware control and data acquisition routines can be
-         accessed via an IPython console and a generic graphical user interface
-         (both of which are easily extensible by the user).
+        scientific installations. It is written in Python and based on the TANGO
+        library. The hardware control and data acquisition routines can be
+        accessed via an IPython console and a generic graphical user interface
+        (both of which are easily extensible by the user).
 Keywords: Sardana,Tango,Python,Control System
 Platform: Linux
 Platform: Windows XP/2000/NT
diff --git a/setup.py b/setup.py
index 83ef466..1e5cb6a 100644
--- a/setup.py
+++ b/setup.py
@@ -321,6 +321,7 @@ def main():
         'sardana.spock',
         'sardana.spock.ipython_00_10',
         'sardana.spock.ipython_00_11',
+        'sardana.spock.ipython_01_00',
     ]
 
     provides = [
diff --git a/src/sardana/pool/poolcontrollers/OneDControllerTimer.py b/src/sardana/pool/poolcontrollers/OneDControllerTimer.py
new file mode 100644
index 0000000..8e9cd78
--- /dev/null
+++ b/src/sardana/pool/poolcontrollers/OneDControllerTimer.py
@@ -0,0 +1,255 @@
+##############################################################################
+##
+## This file is part of Sardana
+##
+## http://www.tango-controls.org/static/sardana/latest/doc/html/axisex.html
+##
+## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
+## 
+## Sardana is free software: you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+## 
+## Sardana is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU Lesser General Public License for more details.
+## 
+## You should have received a copy of the GNU Lesser General Public License
+## along with Sardana.  If not, see <http://www.gnu.org/licenses/>.
+##
+##############################################################################
+
+import time
+import numpy
+
+from sardana import State
+from sardana.pool.controller import OneDController, MaxDimSize
+from sardana.pool.controller import DefaultValue, Description, FGet, FSet, Type
+
+def gauss(x, mean, ymax, fwhm, yoffset=0):
+    return yoffset + ymax*numpy.power(2,-4*((x-mean)/fwhm)**2)
+
+class Channel:
+    
+    def __init__(self,idx):
+        self.idx = idx            # 1 based axisex
+        self.value = []
+        self.is_counting = False
+        self.active = True
+        self.amplitude = BaseValue('1.0')
+
+
+class BaseValue(object):
+    
+    def __init__(self, value):
+        self.raw_value = value
+        self.init()
+    
+    def init(self):
+        self.value = float(self.raw_value)
+    
+    def get(self):
+        return self.value
+
+    def get_value_name(self):
+        return self.raw_value
+
+
+class TangoValue(BaseValue):
+    
+    def init(self):
+        import PyTango
+        self.attr_proxy = PyTango.AttributeProxy(self.raw_value)
+
+    def get(self):
+        return self.attr_proxy.read().value
+
+
+class OneDControllerTimer(OneDController):
+    "This class is the Tango Sardana OneDController controller for tests"
+
+    gender = "Simulation"
+    model  = "Basic"
+    organization = "Sardana team"
+
+    MaxDevice = 1024
+    
+    BufferSize = 1024,
+
+    axis_attributes = {
+        'Amplitude' : { 
+            Type : str,
+            FGet : 'getAmplitude', 
+            FSet : 'setAmplitude',        
+            Description : 'Amplitude. Maybe a number or a tango attribute(must start with tango://)',
+            DefaultValue : '1.0' },
+        'IntegrationTime' : { 
+            Type : float,
+            FGet : 'getIntegrationTime', 
+            FSet : 'setIntegrationTime',        
+            Description : 'IntegrationTime',
+            DefaultValue : '1.0' },
+    }
+    
+    def __init__(self, inst, props, *args, **kwargs):
+        OneDController.__init__(self, inst, props, *args, **kwargs)
+        self.channels = self.MaxDevice*[None,]
+        self.reset()
+
+    def GetAxisAttributes(self, axis):
+        # the default max shape for 'value' is (16*1024,). We don't need so much
+        # so we set it to BufferSize
+        attrs = super(OneDControllerTimer, self).GetAxisAttributes(axis)
+        attrs['Value'][MaxDimSize] = self.BufferSize
+        return attrs
+        
+    def reset(self):
+        self.start_time = None
+        self.integ_time = .1
+        self.monitor_count = None
+        self.read_channels = {}
+        self.counting_channels = {}
+        
+    def AddDevice(self,axis):
+        idx = axis - 1
+        self.channels[idx] = channel = Channel(axis)
+        channel.value = numpy.zeros(self.BufferSize, dtype=numpy.float64)
+        
+    def DeleteDevice(self,axis):
+        idx = axis - 1
+        self.channels[idx] = None
+
+    def PreStateAll(self):
+        pass
+    
+    def PreStateOne(self, axis):
+        pass
+    
+    def StateAll(self):
+        pass
+    
+    def StateOne(self, axis):
+        idx = axis - 1
+        sta = State.On
+        status = "Stopped"
+        if axis in self.counting_channels:
+            channel = self.channels[idx]
+            now = time.time()
+            elapsed_time = now - self.start_time
+            self._updateChannelState(axis, elapsed_time)
+            if channel.is_counting:
+                sta = State.Moving
+                status = "Acquiring"
+        return sta, status
+        
+    def _updateChannelState(self, axis, elapsed_time):
+        channel = self.channels[axis-1]
+        if self.integ_time is not None:
+            # counting in time
+            if elapsed_time >= self.integ_time:
+                self._finish(elapsed_time)
+        elif self.monitor_count is not None:
+            # monitor counts
+            v = int(elapsed_time*100*axis)
+            if v >= self.monitor_count:
+                self._finish(elapsed_time)
+    
+    def _updateChannelValue(self, axis, elapsed_time):
+        channel = self.channels[axis-1]
+        t = elapsed_time
+        if self.integ_time is not None and not channel.is_counting:
+            t = self.integ_time
+        x = numpy.linspace(-10, 10, self.BufferSize[0])
+        amplitude = axis * t * channel.amplitude.get()
+        channel.value = gauss(x, 0, amplitude, 4)
+    
+    def _finish(self, elapsed_time, axis=None):
+        if axis is None:
+            for axis, channel in self.counting_channels.items():
+                channel.is_counting = False
+                self._updateChannelValue(axis, elapsed_time)
+        else:
+            if axis in self.counting_channels:
+                channel = self.counting_channels[axis]
+                channel.is_counting = False
+                self._updateChannelValue(axis, elapsed_time)
+            else:
+                channel = self.channels[axis-1]
+                channel.is_counting = False
+        self.counting_channels = {}
+                
+    def PreReadAll(self):
+        self.read_channels = {}
+    
+    def PreReadOne(self,axis):
+        channel = self.channels[axis-1]
+        self.read_channels[axis] = channel
+
+    def ReadAll(self):
+        # if in acquisition then calculate the values to return
+        if self.counting_channels:
+            now = time.time()
+            elapsed_time = now - self.start_time
+            for axis, channel in self.read_channels.items():
+                self._updateChannelState(axis, elapsed_time)
+                if channel.is_counting:
+                    self._updateChannelValue(axis, elapsed_time)
+    
+    def ReadOne(self, axis):
+        self._log.debug("ReadOne(%s)", axis)
+        v = self.read_channels[axis].value
+        return v
+    
+    def PreStartAll(self):
+        self.counting_channels = {}
+    
+    def PreStartOne(self, axis, value):
+        idx = axis - 1
+        channel = self.channels[idx]
+        channel.value = 0.0
+        self.counting_channels[axis] = channel
+        return True
+    
+    def StartOne(self, axis, value):
+        self.counting_channels[axis].is_counting = True
+    
+    def StartAll(self):
+        self.start_time = time.time()
+    
+    def LoadOne(self, axis, value):
+        idx = axis - 1
+        if value > 0:
+            self.integ_time = value
+            self.monitor_count = None
+        else:
+            self.integ_time = None
+            self.monitor_count = -value
+    
+    def AbortOne(self, axis):
+        now = time.time()
+        if axis in self.counting_channels:
+            elapsed_time = now - self.start_time
+            self._finish(elapsed_time, axis=axis)
+    
+    def getAmplitude(self, axis):
+        idx = axis - 1
+        channel = self.channels[idx]
+        return channel.amplitude.get_value_name()
+    
+    def setAmplitude(self, axis, value):
+        idx = axis - 1
+        channel = self.channels[idx]
+        
+        klass = BaseValue
+        if value.startswith("tango://"):
+            klass = TangoValue
+        channel.amplitude = klass(value) 
+        
+    def getIntegrationTime(self, axis):
+        return self.integ_time
+    
+    def setIntegrationTime(self, axis, value):
+        self.integ_time = value
+        
\ No newline at end of file
diff --git a/src/sardana/pool/poolcontrollers/OneDControllerTimer.py~ b/src/sardana/pool/poolcontrollers/OneDControllerTimer.py~
new file mode 100644
index 0000000..4227366
--- /dev/null
+++ b/src/sardana/pool/poolcontrollers/OneDControllerTimer.py~
@@ -0,0 +1,257 @@
+##############################################################################
+##
+## This file is part of Sardana
+##
+## http://www.tango-controls.org/static/sardana/latest/doc/html/axisex.html
+##
+## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
+## 
+## Sardana is free software: you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+## 
+## Sardana is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU Lesser General Public License for more details.
+## 
+## You should have received a copy of the GNU Lesser General Public License
+## along with Sardana.  If not, see <http://www.gnu.org/licenses/>.
+##
+##############################################################################
+
+import time
+import numpy
+
+from sardana import State
+from sardana.pool.controller import OneDController, MaxDimSize
+from sardana.pool.controller import DefaultValue, Description, FGet, FSet, Type
+
+def gauss(x, mean, ymax, fwhm, yoffset=0):
+    return yoffset + ymax*numpy.power(2,-4*((x-mean)/fwhm)**2)
+
+class Channel:
+    
+    def __init__(self,idx):
+        self.idx = idx            # 1 based axisex
+        self.value = []
+        self.is_counting = False
+        self.active = True
+        self.amplitude = BaseValue('1.0')
+
+
+class BaseValue(object):
+    
+    def __init__(self, value):
+        self.raw_value = value
+        self.init()
+    
+    def init(self):
+        self.value = float(self.raw_value)
+    
+    def get(self):
+        return self.value
+
+    def get_value_name(self):
+        return self.raw_value
+
+
+class TangoValue(BaseValue):
+    
+    def init(self):
+        import PyTango
+        self.attr_proxy = PyTango.AttributeProxy(self.raw_value)
+
+    def get(self):
+        return self.attr_proxy.read().value
+
+
+class OneDControllerTimer(OneDController):
+    "This class is the Tango Sardana OneDController controller for tests"
+
+    gender = "Simulation"
+    model  = "Basic"
+    organization = "Sardana team"
+
+    MaxDevice = 1024
+    
+    BufferSize = 1024,
+
+    axis_attributes = {
+        'Amplitude' : { 
+            Type : str,
+            FGet : 'getAmplitude', 
+            FSet : 'setAmplitude',        
+            Description : 'Amplitude. Maybe a number or a tango attribute(must start with tango://)',
+            DefaultValue : '1.0' },
+        'IntegrationTime' : { 
+            Type : float,
+            FGet : 'getIntegrationTime', 
+            FSet : 'setIntegrationTime',        
+            Description : 'IntegrationTime',
+            DefaultValue : '1.0' },
+    }
+    
+    def __init__(self, inst, props, *args, **kwargs):
+        OneDController.__init__(self, inst, props, *args, **kwargs)
+        self.channels = self.MaxDevice*[None,]
+        self.reset()
+
+    def GetAxisAttributes(self, axis):
+        # the default max shape for 'value' is (16*1024,). We don't need so much
+        # so we set it to BufferSize
+        attrs = super(OneDControllerTimer, self).GetAxisAttributes(axis)
+        attrs['Value'][MaxDimSize] = self.BufferSize
+        return attrs
+        
+    def reset(self):
+        self.start_time = None
+        self.integ_time = .1
+        self.monitor_count = None
+        self.read_channels = {}
+        self.counting_channels = {}
+        
+    def AddDevice(self,axis):
+        idx = axis - 1
+        self.channels[idx] = channel = Channel(axis)
+        channel.value = numpy.zeros(self.BufferSize, dtype=numpy.float64)
+        
+    def DeleteDevice(self,axis):
+        idx = axis - 1
+        self.channels[idx] = None
+
+    def PreStateAll(self):
+        pass
+    
+    def PreStateOne(self, axis):
+        pass
+    
+    def StateAll(self):
+        pass
+    
+    def StateOne(self, axis):
+        idx = axis - 1
+        sta = State.On
+        status = "Stopped"
+        if axis in self.counting_channels:
+            channel = self.channels[idx]
+            now = time.time()
+            elapsed_time = now - self.start_time
+            self._updateChannelState(axis, elapsed_time)
+            if channel.is_counting:
+                sta = State.Moving
+                status = "Acquiring"
+        return sta, status
+        
+    def _updateChannelState(self, axis, elapsed_time):
+        channel = self.channels[axis-1]
+        if self.integ_time is not None:
+            # counting in time
+            if elapsed_time >= self.integ_time:
+                self._finish(elapsed_time)
+        elif self.monitor_count is not None:
+            # monitor counts
+            v = int(elapsed_time*100*axis)
+            if v >= self.monitor_count:
+                self._finish(elapsed_time)
+    
+    def _updateChannelValue(self, axis, elapsed_time):
+        channel = self.channels[axis-1]
+        t = elapsed_time
+        if self.integ_time is not None and not channel.is_counting:
+            t = self.integ_time
+        x = numpy.linspace(-10, 10, self.BufferSize[0])
+        amplitude = axis * t * channel.amplitude.get()
+        channel.value = gauss(x, 0, amplitude, 4)
+    
+    def _finish(self, elapsed_time, axis=None):
+        if axis is None:
+            for axis, channel in self.counting_channels.items():
+                channel.is_counting = False
+                self._updateChannelValue(axis, elapsed_time)
+        else:
+            if axis in self.counting_channels:
+                channel = self.counting_channels[axis]
+                channel.is_counting = False
+                self._updateChannelValue(axis, elapsed_time)
+            else:
+                channel = self.channels[axis-1]
+                channel.is_counting = False
+        self.counting_channels = {}
+                
+    def PreReadAll(self):
+        self.read_channels = {}
+    
+    def PreReadOne(self,axis):
+        channel = self.channels[axis-1]
+        self.read_channels[axis] = channel
+
+    def ReadAll(self):
+        # if in acquisition then calculate the values to return
+        if self.counting_channels:
+            now = time.time()
+            elapsed_time = now - self.start_time
+            for axis, channel in self.read_channels.items():
+                self._updateChannelState(axis, elapsed_time)
+                if channel.is_counting:
+                    self._updateChannelValue(axis, elapsed_time)
+    
+    def ReadOne(self, axis):
+        self._log.debug("ReadOne(%s)", axis)
+        if axis == 1:
+            return self.integ_time
+        v = self.read_channels[axis].value
+        return v
+    
+    def PreStartAll(self):
+        self.counting_channels = {}
+    
+    def PreStartOne(self, axis, value):
+        idx = axis - 1
+        channel = self.channels[idx]
+        channel.value = 0.0
+        self.counting_channels[axis] = channel
+        return True
+    
+    def StartOne(self, axis, value):
+        self.counting_channels[axis].is_counting = True
+    
+    def StartAll(self):
+        self.start_time = time.time()
+    
+    def LoadOne(self, axis, value):
+        idx = axis - 1
+        if value > 0:
+            self.integ_time = value
+            self.monitor_count = None
+        else:
+            self.integ_time = None
+            self.monitor_count = -value
+    
+    def AbortOne(self, axis):
+        now = time.time()
+        if axis in self.counting_channels:
+            elapsed_time = now - self.start_time
+            self._finish(elapsed_time, axis=axis)
+    
+    def getAmplitude(self, axis):
+        idx = axis - 1
+        channel = self.channels[idx]
+        return channel.amplitude.get_value_name()
+    
+    def setAmplitude(self, axis, value):
+        idx = axis - 1
+        channel = self.channels[idx]
+        
+        klass = BaseValue
+        if value.startswith("tango://"):
+            klass = TangoValue
+        channel.amplitude = klass(value) 
+        
+    def getIntegrationTime(self, axis):
+        return self.integ_time
+    
+    def setIntegrationTime(self, axis, value):
+        self.integ_time = value
+        
\ No newline at end of file
diff --git a/src/sardana/release.py b/src/sardana/release.py
index ca7549d..19bf599 100644
--- a/src/sardana/release.py
+++ b/src/sardana/release.py
@@ -49,7 +49,7 @@ name = 'sardana'
 #: the new substring. We have to avoid using either dashes or underscores,
 #: because bdist_rpm does not accept dashes (an RPM) convention, and
 #: bdist_deb does not accept underscores (a Debian convention).
-version_info = (1, 3, 0, 'rc', 0)
+version_info = (1, 3, 1, 'rc', 0)
 version = '.'.join(map(str, version_info[:3]))
 revision = str(version_info[4])
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sardana.git



More information about the debian-science-commits mailing list