Skip to content

Commit f347e71

Browse files
committed
Merge branch 'openephys_binary' of github.com:samuelgarcia/python-neo into openephys_binary
2 parents 3881484 + 1e55da4 commit f347e71

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

neo/io/proxyobjects.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,19 @@ 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
37-
# TODO change array_annotations handling to avoid that
38-
array_annotations = {k: v for k, v in array_annotations.items() if v.ndim==1}
36+
if array_annotations is None:
37+
array_annotations = {}
38+
for k, v in array_annotations.items():
39+
array_annotations[k] = np.asarray(v)
3940

40-
# this mock the array annotaions to avoid inherits DataObject
41+
# clean array annotations that are not 1D
42+
# TODO remove this once multi-dimensional array_annotations are possible
43+
array_annotations = {k: v for k, v in array_annotations.items()
44+
if v.ndim == 1}
45+
46+
# this mock the array annotations to avoid inherits DataObject
4147
self.array_annotations = ArrayDict(self.shape[-1])
42-
if array_annotations is not None:
43-
self.array_annotations.update(array_annotations)
48+
self.array_annotations.update(array_annotations)
4449

4550
BaseNeo.__init__(self, **annotations)
4651

neo/rawio/openephysbinaryrawio.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,12 @@ def _parse_header(self):
214214
if k in ('timestamps', ):
215215
continue
216216
if k in d:
217-
ev_ann['__array_annotations__'][k] = d[k]
217+
# split custom dtypes into separate annotations
218+
if d[k].dtype.names:
219+
for name in d[k].dtype.names:
220+
ev_ann['__array_annotations__'][name] = d[k][name].flatten()
221+
else:
222+
ev_ann['__array_annotations__'][k] = d[k]
218223

219224
def _segment_t_start(self, block_index, seg_index):
220225
return self._t_start_segments[block_index][seg_index]

0 commit comments

Comments
 (0)