|
|
@@ -162,9 +162,12 @@ class StreamInserterNumpy(nilmdb.client.client.StreamInserter): |
|
|
|
elif array.ndim == 2: |
|
|
|
# Convert to structured array |
|
|
|
sarray = numpy.zeros(array.shape[0], dtype=self._dtype) |
|
|
|
sarray['timestamp'] = array[:,0] |
|
|
|
# Need the squeeze in case sarray['data'] is 1 dimensional |
|
|
|
sarray['data'] = numpy.squeeze(array[:,1:]) |
|
|
|
try: |
|
|
|
sarray['timestamp'] = array[:,0] |
|
|
|
# Need the squeeze in case sarray['data'] is 1 dimensional |
|
|
|
sarray['data'] = numpy.squeeze(array[:,1:]) |
|
|
|
except (IndexError, ValueError): |
|
|
|
raise ValueError("wrong number of fields for this data type") |
|
|
|
array = sarray |
|
|
|
else: |
|
|
|
raise ValueError("wrong number of dimensions in array") |
|
|
|