|
4 | 4 | The RawIO assumes all segments and all blocks have the same structure. |
5 | 5 | It supports all kinds of NEO objects. |
6 | 6 |
|
7 | | -Author: Chek Yin Choi |
| 7 | +Author: Chek Yin Choi, Julia Sprenger |
8 | 8 | """ |
9 | 9 |
|
10 | | -from .baserawio import (BaseRawIO, _signal_channel_dtype, _signal_stream_dtype, |
11 | | - _spike_channel_dtype, _event_channel_dtype) |
| 10 | +import os.path |
12 | 11 |
|
13 | | -from ..io.nixio import NixIO |
14 | | -from ..io.nixio import check_nix_version |
15 | 12 | import numpy as np |
| 13 | + |
| 14 | +from .baserawio import (BaseRawIO, _signal_channel_dtype, _signal_stream_dtype, |
| 15 | + _spike_channel_dtype, _event_channel_dtype) |
| 16 | +from ..io.nixio import check_nix_version |
| 17 | + |
16 | 18 | try: |
17 | 19 | import nixio as nix |
18 | 20 |
|
@@ -241,6 +243,31 @@ def _parse_header(self): |
241 | 243 | event_ann.update(self._filter_properties(props, 'event')) |
242 | 244 | ev_idx += 1 |
243 | 245 |
|
| 246 | + # adding array annotations to analogsignals |
| 247 | + annotated_anasigs = [] |
| 248 | + sig_ann = seg_ann['signals'] |
| 249 | + stream_id = 0 |
| 250 | + for da_idx, da in enumerate(group.data_arrays): |
| 251 | + if da.type != "neo.analogsignal": |
| 252 | + continue |
| 253 | + anasig_id = da.name.split('.')[-2] |
| 254 | + if anasig_id in annotated_anasigs: |
| 255 | + continue |
| 256 | + annotated_anasigs.append(anasig_id) |
| 257 | + |
| 258 | + array_anno_props = [] |
| 259 | + for prop in da.metadata.props: |
| 260 | + if prop.type == 'ARRAYANNOTATION': |
| 261 | + array_anno_props.append(prop) |
| 262 | + |
| 263 | + props_dict = self._filter_properties(array_anno_props, |
| 264 | + "analogsignal") |
| 265 | + |
| 266 | + sig_ann[stream_id]['__array_annotations__'].update( |
| 267 | + props_dict) |
| 268 | + |
| 269 | + stream_id += 1 |
| 270 | + |
244 | 271 | def _segment_t_start(self, block_index, seg_index): |
245 | 272 | t_start = 0 |
246 | 273 | for mt in self.file.blocks[block_index].groups[seg_index].multi_tags: |
|
0 commit comments