From 64b5515eee0fd7c8d4fcabcc3898b16c906097d2 Mon Sep 17 00:00:00 2001 From: Julia Sprenger Date: Mon, 29 Jul 2019 16:12:08 +0200 Subject: [PATCH] Add warning if annotations would shadow channelindex parameters --- neo/io/basefromrawio.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/neo/io/basefromrawio.py b/neo/io/basefromrawio.py index dae34ddaf..0d2c84ceb 100644 --- a/neo/io/basefromrawio.py +++ b/neo/io/basefromrawio.py @@ -147,11 +147,16 @@ def read_block(self, block_index=0, lazy=False, signal_group_mode=None, chidx_annotations = check_annotations(chidx_annotations) # this should be done with array_annotation soon: ch_names = all_channels[ind_abs]['name'].astype('S') - neo_channel_index = ChannelIndex(index=ind_within, - channel_names=ch_names, - channel_ids=all_channels[ind_abs]['id'], - name='Channel group {}'.format(i), - **chidx_annotations) + chidx_kwargs = dict(index=ind_within, + channel_names=ch_names, + channel_ids=all_channels[ind_abs]['id'], + name='Channel group {}'.format(i)) + for k, v in chidx_annotations.items(): + if k not in chidx_kwargs: + chidx_kwargs[k] = v + else: + warnings.warn('Name of annotation {} shadows parameter and is therefore dropped'.format(k)) + neo_channel_index = ChannelIndex(**chidx_kwargs) bl.channel_indexes.append(neo_channel_index)