Skip to content

Commit 4777217

Browse files
committed
Simplified block and segment annotation steps
1 parent 3015888 commit 4777217

File tree

1 file changed

+20
-25
lines changed

1 file changed

+20
-25
lines changed

neo/rawio/phyrawio.py

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -121,31 +121,26 @@ def _parse_header(self):
121121
annotation_lists = [self._parse_tsv_or_csv_to_list_of_dict(file)
122122
for file in csv_tsv_files]
123123

124-
for block_index in range(1):
125-
bl_ann = self.raw_annotations['blocks'][block_index]
126-
bl_ann['name'] = f'Block #{block_index}'
127-
bl_ann['block_extra_info'] = f'This is the block {block_index}'
128-
for seg_index in range([1][block_index]):
129-
seg_ann = bl_ann['segments'][seg_index]
130-
seg_ann['name'] = f'Seg #{seg_index} Block #{block_index}'
131-
seg_ann['seg_extra_info'] = f'This is the seg {seg_index} ' \
132-
f'of block {block_index}'
133-
for index, clust_id in enumerate(clust_ids):
134-
spiketrain_an = seg_ann['units'][index]
135-
136-
# Loop over list of list of dict and annotate each st
137-
for annotation_list in annotation_lists:
138-
clust_key, property_name = tuple(annotation_list[0].
139-
keys())
140-
if property_name == 'KSLabel':
141-
annotation_name = 'quality'
142-
else:
143-
annotation_name = property_name.lower()
144-
for annotation_dict in annotation_list:
145-
if int(annotation_dict[clust_key]) == clust_id:
146-
spiketrain_an[annotation_name] = \
147-
annotation_dict[property_name]
148-
break
124+
bl_ann = self.raw_annotations['blocks'][0]
125+
bl_ann['name'] = "Block #0"
126+
seg_ann = bl_ann['segments'][0]
127+
seg_ann['name'] = 'Seg #0 Block #0'
128+
for index, clust_id in enumerate(clust_ids):
129+
spiketrain_an = seg_ann['units'][index]
130+
131+
# Loop over list of list of dict and annotate each st
132+
for annotation_list in annotation_lists:
133+
clust_key, property_name = tuple(annotation_list[0].
134+
keys())
135+
if property_name == 'KSLabel':
136+
annotation_name = 'quality'
137+
else:
138+
annotation_name = property_name.lower()
139+
for annotation_dict in annotation_list:
140+
if int(annotation_dict[clust_key]) == clust_id:
141+
spiketrain_an[annotation_name] = \
142+
annotation_dict[property_name]
143+
break
149144

150145
def _segment_t_start(self, block_index, seg_index):
151146
assert block_index == 0

0 commit comments

Comments
 (0)