old_contents: from __future__ import division
  from featurex.stimuli import Stim, CollectionStimMixin
  from featurex.stimuli.image import ImageStim
  from featurex.extractors import ExtractorResult, merge_results
  from moviepy.video.io.VideoFileClip import VideoFileClip
  import pandas as pd
  
  
  class VideoFrameStim(ImageStim):
  
      ''' A single frame of video. '''
  
      def __init__(self, video, frame_num, duration=None, filename=None, data=None):
          self.video = video
          if data is None:
              self.data = self.video.get_frame(index=frame_num)
          self.frame_num = frame_num
          spf = 1. / video.fps
          duration = spf if duration is None else duration
          onset = frame_num * spf
          super(VideoFrameStim, self).__init__(filename, onset, duration, data)
  
  
  class VideoStim(Stim, CollectionStimMixin):
  
      ''' A video. '''
  
      def __init__(self, filename, onset=None):
  
          self.clip = VideoFileClip(filename)
          self.fps = self.clip.fps
          self.width = self.clip.w
          self.height = self.clip.h
  
          self.n_frames = int(self.fps * self.clip.duration)
          duration = self.clip.duration
  
          super(VideoStim, self).__init__(filename, onset, duration)
  
      def __iter__(self):
          """ Frame iteration. """
          for i, f in enumerate(self.clip.iter_frames()):
              yield VideoFrameStim(self, i, data=f)
  
      @property
      def frames(self):
          return [f for f in self.clip.iter_frames()]
  
      def get_frame(self, index=None, onset=None):
          if index is not None:
              onset = float(index) / self.fps
          else:
              index = int(onset * self.fps)
          return VideoFrameStim(self, index, data=self.clip.get_frame(onset))
  
  
  class DerivedVideoStim(VideoStim):
      """
      VideoStim containing keyframes (for API calls). Each keyframe is associated
      with a duration reflecting the length of its "scene."
      """
      def __init__(self, filename, elements, frame_index=None, history=None):
          super(DerivedVideoStim, self).__init__(filename)
          self.elements = elements
          self.frame_index = frame_index
          self.history = history
          
      def __iter__(self):
          for elem in self.elements:
              yield elem
  
  
new_contents: from __future__ import division
  from featurex.stimuli import Stim, CollectionStimMixin
  from featurex.stimuli.image import ImageStim
  from featurex.extractors import ExtractorResult, merge_results
  from moviepy.video.io.VideoFileClip import VideoFileClip
  import pandas as pd
  
  
  class VideoFrameStim(ImageStim):
  
      ''' A single frame of video. '''
  
      def __init__(self, video, frame_num, duration=None, filename=None, data=None):
          self.video = video
          if data is None:
              self.data = self.video.get_frame(index=frame_num).data
          self.frame_num = frame_num
          spf = 1. / video.fps
          duration = spf if duration is None else duration
          onset = frame_num * spf
          super(VideoFrameStim, self).__init__(filename, onset, duration, data)
  
  
  class VideoStim(Stim, CollectionStimMixin):
  
      ''' A video. '''
  
      def __init__(self, filename, onset=None):
  
          self.clip = VideoFileClip(filename)
          self.fps = self.clip.fps
          self.width = self.clip.w
          self.height = self.clip.h
  
          self.n_frames = int(self.fps * self.clip.duration)
          duration = self.clip.duration
  
          super(VideoStim, self).__init__(filename, onset, duration)
  
      def __iter__(self):
          """ Frame iteration. """
          for i, f in enumerate(self.clip.iter_frames()):
              yield VideoFrameStim(self, i, data=f)
  
      @property
      def frames(self):
          return [f for f in self.clip.iter_frames()]
  
      def get_frame(self, index=None, onset=None):
          if index is not None:
              onset = float(index) / self.fps
          else:
              index = int(onset * self.fps)
          return VideoFrameStim(self, index, data=self.clip.get_frame(onset))
  
  
  class DerivedVideoStim(VideoStim):
      """
      VideoStim containing keyframes (for API calls). Each keyframe is associated
      with a duration reflecting the length of its "scene."
      """
      def __init__(self, filename, elements, frame_index=None, history=None):
          super(DerivedVideoStim, self).__init__(filename)
          self.elements = elements
          self.frame_index = frame_index
          self.history = history
          
      def __iter__(self):
          for elem in self.elements:
              yield elem
  
  
subject: fix data attribute in VideoFrameStim init