Example #1
0
 def test_full_pipeline(self):
     ''' Smoke test of entire pipeline, from stimulus loading to
     event file export. '''
     stim = VideoStim(join(_get_test_data_path(), 'video', 'small.mp4'))
     extractors = [VibranceExtractor()]
     timeline = stim.extract(extractors, show=False)
     exp = FSLExporter()
     tmpdir = tempfile.mkdtemp()
     exp.export(timeline, tmpdir)
     from glob import glob
     files = glob(join(tmpdir, '*.txt'))
     self.assertEquals(len(files), 1)
     shutil.rmtree(tmpdir)
Example #2
0
 def test_full_pipeline(self):
     ''' Smoke test of entire pipeline, from stimulus loading to
     event file export. '''
     stim = VideoStim(join(_get_test_data_path(), 'video', 'small.mp4'))
     extractors = [FaceDetectionExtractor()]
     timeline = stim.extract(extractors, show=False)
     exp = FSLExporter()
     tmpdir = tempfile.mkdtemp()
     exp.export(timeline, tmpdir)
     from glob import glob
     files = glob(join(tmpdir, '*.txt'))
     self.assertEquals(len(files), 1)
     shutil.rmtree(tmpdir)
Example #3
0
def test_video_stim():
    ''' Test VideoStim functionality. '''
    filename = join(get_test_data_path(), 'video', 'small.mp4')
    video = VideoStim(filename)
    assert video.fps == 30
    assert video.n_frames in (167, 168)
    assert video.width == 560

    # Test frame iterator
    frames = [f for f in video]
    assert len(frames) == 168
    f1 = frames[100]
    assert isinstance(f1, VideoFrameStim)
    assert isinstance(f1.onset, float)
    f1.data.shape == (320, 560, 3)

    # Test getting of specific frame
    f2 = video.get_frame(index=100)
    assert isinstance(f2, VideoFrameStim)
    assert isinstance(f2.onset, float)
    f2.data.shape == (320, 560, 3)
Example #4
0
def test_video_stim():
    ''' Test VideoStim functionality. '''
    filename = join(_get_test_data_path(), 'video', 'small.mp4')
    video = VideoStim(filename)
    assert video.fps == 30
    assert video.n_frames == 168
    assert video.width == 560

    # Test frame iterator
    frames = [f for f in video]
    assert len(frames) == 168
    f = frames[100]
    assert isinstance(f, VideoFrameStim)
    assert isinstance(f.onset, float)
    f.data.shape == (320, 560, 3)
Example #5
0
    def test_video_stim(self):
        ''' Test VideoStim functionality. '''
        filename = join(_get_test_data_path(), 'video', 'small.mp4')
        video = VideoStim(filename)
        self.assertEquals(video.fps, 30)
        self.assertEquals(video.n_frames, 168)
        self.assertEquals(video.width, 560)

        # Test frame iterator
        frames = [f for f in video]
        self.assertEquals(len(frames), 168)
        f = frames[100]
        self.assertIsInstance(f, VideoFrameStim)
        self.assertIsInstance(f.onset, float)
        self.assertEquals(f.data.shape, (320, 560, 3))