Skip to content

Commit eae2370

Browse files
author
sprenger
committed
automatic array_annotation value conversion to numpy arrays
1 parent dad968d commit eae2370

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

neo/io/proxyobjects.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,17 @@ def __init__(self, array_annotations=None, **annotations):
3333
# used to be str so raw bytes
3434
annotations['file_origin'] = str(self._rawio.source_name())
3535

36-
# clean annotations that are not 1D
36+
if array_annotations is None:
37+
array_annotations = {}
38+
for k, v in array_annotations.items():
39+
array_annotations[k] = np.asarray(k)
40+
41+
# clean array annotations that are not 1D
3742
# TODO remove this once multi-dimensional array_annotations are possible
3843
array_annotations = {k: v for k, v in array_annotations.items()
39-
if (not hasattr(v, 'ndim') or v.ndim == 1)}
44+
if v.ndim == 1}
4045

41-
# this mock the array annotaions to avoid inherits DataObject
46+
# this mock the array annotations to avoid inherits DataObject
4247
self.array_annotations = ArrayDict(self.shape[-1])
4348
if array_annotations is not None:
4449
self.array_annotations.update(array_annotations)

0 commit comments

Comments
 (0)