test_stimuli.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:pulse2percept 作者: uwescience 项目源码 文件源码
def test_Movie2Pulsetrain():
    fps = 30.0
    amplitude_transform = 'linear'
    amp_max = 90
    freq = 20
    pulse_dur = .075 / 1000.
    interphase_dur = .075 / 1000.
    tsample = .005 / 1000.
    pulsetype = 'cathodicfirst'
    stimtype = 'pulsetrain'
    rflum = np.zeros(100)
    rflum[50] = 1
    m2pt = stimuli.Movie2Pulsetrain(rflum,
                                    fps=fps,
                                    amp_transform=amplitude_transform,
                                    amp_max=amp_max,
                                    freq=freq,
                                    pulse_dur=pulse_dur,
                                    interphase_dur=interphase_dur,
                                    tsample=tsample,
                                    pulsetype=pulsetype,
                                    stimtype=stimtype)
    npt.assert_equal(m2pt.shape[0], round((rflum.shape[-1] / fps) / tsample))
    npt.assert_(m2pt.data.max() < amp_max)

    with pytest.raises(ValueError):
        stimuli.Movie2Pulsetrain(np.zeros(10), -0.1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号