Require 2-dimensional array in insert_function

This commit is contained in:
Jim Paris 2013-03-30 22:51:20 -04:00
parent 533892e624
commit 9078a014ae

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())