当前位置: 首页>>代码示例>>Python>>正文


Python StimulusModel.templateDoc方法代码示例

本文整理汇总了Python中sparkle.stim.stimulus_model.StimulusModel.templateDoc方法的典型用法代码示例。如果您正苦于以下问题:Python StimulusModel.templateDoc方法的具体用法?Python StimulusModel.templateDoc怎么用?Python StimulusModel.templateDoc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sparkle.stim.stimulus_model.StimulusModel的用法示例。


在下文中一共展示了StimulusModel.templateDoc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestStimModel

# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import templateDoc [as 别名]

#.........这里部分代码省略.........
        assert atten == 0
        print 'maxv', MAXV, 'signal max', np.amax(signal), 'overload', ovld
        assert round(np.amax(signal),2) == MAXV
        # do math to make this more accurate
        assert ovld > 0

    def test_square_wave_overload_voltage(self):
        component0 = SquareWave()
        component0.set('amplitude', 11.)
        self.model.insertComponent(component0, 0, 0)

        signal, atten, ovld = self.model.signal()
        assert atten == 0
        print 'maxv', DEVICE_MAXV, 'signal max', np.amax(signal), 'overload', ovld
        assert round(np.amax(signal),2) == DEVICE_MAXV
        # do math to make this more accurate
        assert ovld > 0

    def test_corrent_number_of_traces(self):
        self.model = self.stim_with_double_auto()
        n = self.model.traceCount()
        sig, doc, over = self.model.expandedStim()
        assert len(sig) == n

    def test_template_no_auto_params(self):
        self.model.setRepCount(7)
        component = PureTone()
        component.setIntensity(34)
        self.model.insertComponent(component, 0,0)
        vocal = Vocalization()
        vocal.setFile(sample.samplewav())
        self.model.insertComponent(vocal, 1,0)

        template = self.model.templateDoc()

        clone = StimulusModel.loadFromTemplate(template)
        clone.setReferenceVoltage(100, 0.1)

        signal0, atten0, ovld = clone.signal()
        signal1, atten1, ovld = self.model.signal()

        assert clone.stimid != self.model.stimid
        np.testing.assert_array_equal(signal0, signal1)
        assert atten0 == atten1
        assert clone.repCount() == self.model.repCount()

    def test_template_with_auto_params(self):
        self.model.setRepCount(7)
        component = PureTone()
        component.setIntensity(34)
        self.model.insertComponent(component, 0,0)
        nsteps = self.add_auto_param(self.model) 

        template = self.model.templateDoc()

        clone = StimulusModel.loadFromTemplate(template)
        clone.setReferenceVoltage(100, 0.1)

        signals0, docs0, ovld = self.model.expandedStim()
        signals1, docs1, ovld = clone.expandedStim()

        assert clone.stimid != self.model.stimid
        assert len(signals0) == len(signals1)
        for i in range(len(signals0)):
            signal0, atten0 = signals0[i]
            signal1, atten1 = signals1[i]
开发者ID:boylea,项目名称:sparkle,代码行数:70,代码来源:test_stim_model.py


注:本文中的sparkle.stim.stimulus_model.StimulusModel.templateDoc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。