We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fe461a2 commit 04808ceCopy full SHA for 04808ce
datajoint/blob.py
@@ -152,10 +152,8 @@ def pack_blob(self, obj):
152
return self.pack_array(np.array(obj))
153
if isinstance(obj, (bool, np.bool, np.bool_)):
154
155
- if isinstance(obj, float):
156
- return self.pack_array(np.array(obj, dtype=np.float64))
157
- if isinstance(obj, int):
158
- return self.pack_array(np.array(obj, dtype=np.int64))
+ if isinstance(obj, (float, int, complex)):
+ return self.pack_array(np.array(obj))
159
if isinstance(obj, (datetime.datetime, datetime.date, datetime.time)):
160
return self.pack_datetime(obj)
161
if isinstance(obj, Decimal):
@@ -253,9 +251,6 @@ def pack_recarray(self, array):
253
251
def read_sparse_array(self):
254
252
raise DataJointError('datajoint-python does not yet support sparse arrays. Issue (#590)')
255
256
- def read_scalar(selfs):
257
-
258
259
def read_decimal(self):
260
return Decimal(self.read_string())
261
tests/test_blob.py
@@ -23,6 +23,9 @@ def test_pack():
23
x = np.random.randn(10)
24
assert_array_equal(x, unpack(pack(x)), "Arrays do not match!")
25
26
+ x = 7j
27
+ assert_equal(x, unpack(pack(x)), "Complex scalar does not match")
28
+
29
x = np.float32(np.random.randn(3, 4, 5))
30
31
0 commit comments