Browse Source

Work around a Numpy deprecation warning

tags/nilmdb-2.0.0
Jim Paris 4 years ago
parent
commit
3be904d158
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      nilmdb/client/numpyclient.py

+ 5
- 1
nilmdb/client/numpyclient.py 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


Loading…
Cancel
Save