]> git.parisson.com Git - timeside.git/commitdiff
analyzer.results should return numpy arrays aubio-g
authorGuillaume Pellerin <yomguy@parisson.com>
Mon, 15 Apr 2013 13:51:36 +0000 (15:51 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Mon, 15 Apr 2013 13:51:36 +0000 (15:51 +0200)
timeside/analyzer/core.py
timeside/tools/cache.py

index e43b28aa66e1f7e7da35a7bb5beae63db11c48a7..2c4bfa9d9789d3c4adae258b05c81b6f351697e8 100644 (file)
@@ -25,7 +25,7 @@ numpy_data_types = [
     #'float128',
     'float64',
     'float32',
-    'float16',
+    'float16',
     'int64',
     'int16',
     'int32',
@@ -56,7 +56,7 @@ class AnalyzerResult(dict):
             value = numpy.array(value)
         # serialize using numpy
         if type(value) in numpy_data_types:
-            value = value.tolist()
+            value = value
         if type(value) not in [list, str, int, long, float, complex, type(None)] + numpy_data_types:
             raise TypeError, 'AnalyzerResult can not accept type %s' % type(value)
         if name == 'value': self['value'] = value
@@ -91,7 +91,7 @@ class AnalyzerResultContainer(object):
             node = doc.createElement('data')
             for a in ['name', 'id', 'unit']:
                 node.setAttribute(a, str(data[a]) )
-            node.setAttribute('value', repr(data['value']) )
+            node.setAttribute('value', data['value'] )
             root.appendChild(node)
         return xml.dom.minidom.Document.toprettyxml(doc)
 
index 8decc97ce4b0fee0d7ad73526e7ec9cb8fdde7bd..18afd68cacf8d8fb04dcd9264b27b3239a88f6c5 100644 (file)
 import os
 import xml.dom.minidom
 
+from timeside.core import Processor, implements, interfacedoc
+
 
 class Cache(object):
-    
+
     def __init__(self, dir, params=None):
         self.dir = dir
         self.params = params
         self.files = self.get_files()
-        
+
     def get_files(self):
         list = []
         for root, dirs, files in os.walk(self.dir):
             for file in files:
                 list.append(file)
         return list
-    
+
     def exists(self, file):
         self.files = self.get_files()
         return file in self.files
-            
+
     def write_bin(self, data, file):
         path = self.dir + os.sep + file
         f = open(path, 'w')
@@ -70,7 +72,7 @@ class Cache(object):
         data = f.read()
         f.close()
         return data
-        
+
     def read_stream_bin(self, file):
         path = self.dir + os.sep + file
         chunk_size = 0x1000
@@ -96,7 +98,7 @@ class Cache(object):
             value = data.getAttribute('value')
             list.append({'name': name, 'id': id, 'unit': unit, 'value': value})
         return list
-        
+
     def write_analyzer_xml(self, data_list, file):
         path = self.dir + os.sep + file
         doc = xml.dom.minidom.Document()
@@ -116,3 +118,8 @@ class Cache(object):
         f = open(path, "w")
         f.write(xml.dom.minidom.Document.toprettyxml(doc))
         f.close()
+
+
+class Accumulator(Processor):
+    pass
+