浏览代码

Adjusted example.py

Michael Denker 4 年之前
父节点
当前提交
58555a1d8b
共有 1 个文件被更改,包括 8 次插入8 次删除
  1. 8 8
      code/example.py

+ 8 - 8
code/example.py

@@ -50,7 +50,7 @@ from neo import Block, Segment
 from elephant.signal_processing import butter
 
 from reachgraspio import reachgraspio
-from neo_utils import add_epoch, cut_segment_by_epoch, get_events
+from neo.utils import add_epoch, cut_segment_by_epoch, get_events
 
 
 # =============================================================================
@@ -142,10 +142,9 @@ data_block.segments[0].analogsignals.extend(filtered_anasig)
 # annotations of the Event object).
 start_events = get_events(
     data_segment,
-    properties={
-        'name': 'TrialEvents',
-        'trial_event_labels': 'TS-ON',
-        'performance_in_trial': session.performance_codes['correct_trial']})
+    name='TrialEvents',
+    trial_event_labels='TS-ON',
+    performance_in_trial=session.performance_codes['correct_trial'])
 
 # Extract single Neo Event object containing all TS-ON triggers
 assert len(start_events) == 1
@@ -163,7 +162,8 @@ epoch = add_epoch(
     event1=start_event, event2=None,
     pre=pre, post=post,
     attach_result=False,
-    name='analysis_epochs')
+    name='analysis_epochs',
+    array_annotations=start_event.array_annotations)
 
 # Create new segments of data cut according to the analysis epochs of the
 # 'analysis_epochs' Neo Epoch object. The time axes of all segments are aligned
@@ -186,7 +186,7 @@ cut_trial_block.segments = cut_segment_by_epoch(
 # In this case this call should return one matching analysis epoch around TS-ON
 # belonging to behavioral trial ID i. For monkey N, this is trial ID 1, for
 # monkey L this is trial ID 2 since trial ID 1 is not a correct trial.
-trial_id = int(np.min(start_event.annotations['trial_id']))
+trial_id = int(np.min(start_event.array_annotations['trial_id']))
 trial_segments = cut_trial_block.filter(
     targdict={"trial_id": trial_id}, objects=Segment)
 assert len(trial_segments) == 1
@@ -238,7 +238,7 @@ for event in trial_segment.events:
                     alpha=0.2,
                     linewidth=3,
                     linestyle='dashed',
-                    label='event ' + event.annotations[
+                    label='event ' + event.array_annotations[
                         'trial_event_labels'][ev_id])
 
 # Finishing touches on the plot