示例#1
0
 def extract(self, extractors, merge_events=True):
     timeline = Timeline()
     for ext in extractors:
         events = ext.apply(self)
         for ev in events:
             timeline.add_event(ev, merge=merge_events)
     return timeline
示例#2
0
 def extract(self, extractors, merge_events=True):
     timeline = Timeline()
     for ext in extractors:
         events = ext.apply(self)
         for ev in events:
             timeline.add_event(ev, merge=merge_events)
     return timeline
示例#3
0
 def extract(self, extractors, merge_events=True):
     timeline = Timeline()
     # Extractors can either take ComplexTextStim input, in which case we
     # pass the current instance, or TextStim input, in which case we loop
     # over all elements.
     for ext in extractors:
         if ext.target.__name__ == self.__class__.__name__:
             events = ext.apply(self)
             for ev in events:
                 timeline.add_event(ev, merge=merge_events)
         else:
             for elem in self.elements:
                 # If no onset is available, index with order
                 onset = elem.onset or elem.order
                 event = Event(onset=onset, values=[ext.apply(elem)])
                 timeline.add_event(event, merge=merge_events)
     return timeline
示例#4
0
 def extract(self, extractors, merge_events=True, **kwargs):
     period = 1. / self.fps
     timeline = Timeline(period=period)
     for ext in extractors:
         # For VideoExtractors, pass the entire stim
         if ext.target.__name__ == self.__class__.__name__:
             events = ext.apply(self, **kwargs)
             for ev in events:
                 timeline.add_event(ev, merge=merge_events)
         # Otherwise, for images, loop over frames
         else:
             c = 0
             for frame in self:
                 if frame.data is not None:
                     event = Event(onset=c * period)
                     event.add_value(ext.apply(frame))
                     timeline.add_event(event, merge=merge_events)
                     c += 1
     return timeline
示例#5
0
 def extract(self, extractors, merge_events=True, **kwargs):
     period = 1. / self.fps
     timeline = Timeline(period=period)
     for ext in extractors:
         # For VideoExtractors, pass the entire stim
         if ext.target.__name__ == self.__class__.__name__:
             events = ext.apply(self, **kwargs)
             for ev in events:
                 timeline.add_event(ev, merge=merge_events)
         # Otherwise, for images, loop over frames
         else:
             c = 0
             for frame in self:
                 if frame.data is not None:
                     event = Event(onset=c * period)
                     event.add_value(ext.apply(frame))
                     timeline.add_event(event, merge=merge_events)
                     c += 1
     return timeline