Browse Source

Require 2-dimensional array in insert_function

tags/nilmtools-1.0
Jim Paris 8 years ago
parent
commit
9078a014ae
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      src/filter.py

+ 3
- 0
src/filter.py View File

@@ -309,6 +309,7 @@ class Filter(object):
'args': opaque arguments passed to process_numpy

'insert_func': function to call in order to insert array of data.
Should be passed a 2-dimensional array of data to insert.
Data timestamps must be within the provided interval.

'final': True if this is the last bit of data for this
@@ -337,6 +338,8 @@ class Filter(object):
interval.start, interval.end) as insert_ctx:
def insert_function(array):
s = cStringIO.StringIO()
if len(np.shape(array)) != 2:
raise Exception("array must be 2-dimensional")
np.savetxt(s, array)
insert_ctx.insert(s.getvalue())



Loading…
Cancel
Save