#'float128',
'float64',
'float32',
- 'float16',
+ # 'float16',
'int64',
'int16',
'int32',
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
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)
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')
data = f.read()
f.close()
return data
-
+
def read_stream_bin(self, file):
path = self.dir + os.sep + file
chunk_size = 0x1000
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()
f = open(path, "w")
f.write(xml.dom.minidom.Document.toprettyxml(doc))
f.close()
+
+
+class Accumulator(Processor):
+ pass
+