Skip to content

Commit b5f0c0e

Browse files
author
sprenger
committed
[utils] do not copy nix_name annotation to different object types
1 parent d38be87 commit b5f0c0e

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

neo/utils/misc.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
etc. of neo.core objects.
44
'''
55

6-
import neo
76
import copy
87
import warnings
8+
99
import numpy as np
1010
import quantities as pq
1111

12+
import neo
13+
14+
ignore_annotations = ['nix_name']
1215

1316
def get_events(container, **properties):
1417
"""
@@ -345,8 +348,12 @@ def add_epoch(
345348

346349
ep = neo.Epoch(times=times, durations=durations, **kwargs)
347350

348-
ep.annotate(**event1.annotations)
349-
ep.array_annotate(**event1.array_annotations)
351+
annos = {k: v for k, v in event1.annotations.items()
352+
if k not in ignore_annotations}
353+
array_annos = {k: v for k, v in event1.array_annotations.items()
354+
if k not in ignore_annotations}
355+
ep.annotate(**copy.copy(annos))
356+
ep.array_annotate(**copy.copy(array_annos))
350357

351358
if attach_result:
352359
segment.epochs.append(ep)
@@ -543,10 +550,14 @@ def cut_segment_by_epoch(seg, epoch, reset_time=False):
543550
epoch.times[ep_id] + epoch.durations[ep_id],
544551
reset_time=reset_time)
545552

546-
subseg.annotate(**copy.copy(epoch.annotations))
553+
annos = {k: v for k, v in epoch.annotations.items()
554+
if k not in ignore_annotations}
555+
subseg.annotate(**copy.copy(annos))
547556

548557
# Add array-annotations of Epoch
549558
for key, val in epoch.array_annotations.items():
559+
if key in ignore_annotations:
560+
continue
550561
if len(val):
551562
subseg.annotations[key] = copy.copy(val[ep_id])
552563

0 commit comments

Comments
 (0)