Work around a Numpy deprecation warning

This commit is contained in:
Jim Paris 2019-08-13 16:07:57 -04:00
parent 5d9fc5500c
commit 3be904d158

View File

@ -25,7 +25,11 @@ def layout_to_dtype(layout):
atype = '<f' + str(int(ltype[5:]) // 8)
else:
raise ValueError("bad layout")
return numpy.dtype([('timestamp', '<i8'), ('data', atype, lcount)])
if lcount == 1:
dtype = [('timestamp', '<i8'), ('data', atype)]
else:
dtype = [('timestamp', '<i8'), ('data', atype, lcount)]
return numpy.dtype(dtype)
class NumpyClient(nilmdb.client.client.Client):
"""Subclass of nilmdb.client.Client that adds additional methods for