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


Python StimulusModel.verify方法代码示例

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


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

示例1: test_verify_with_bad_frequency_auto_parameter_disallowed

# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import verify [as 别名]
    def test_verify_with_bad_frequency_auto_parameter_disallowed(self):
        component = PureTone()
        stim_model = StimulusModel()
        stim_model.setReferenceVoltage(100, 0.1)
        stim_model.insertComponent(component, 0,0)

        model = QStimulusModel(stim_model)

        ap_model = model.autoParams()
        ap_model.insertRows(0,1)
        ap_model.toggleSelection(ap_model.index(0,0), component)
        
        # setData always deals with base units
        values = ['frequency', 100000, 300000, 25000]
        for i, value in enumerate(values):
            ap_model.setData(ap_model.index(0,i), value, QtCore.Qt.EditRole)

        invalid = stim_model.verify(windowSize=0.1)
        print 'msg', invalid
        assert invalid == 0
        assert stim_model.containsPval('frequency', 75000)
开发者ID:boylea,项目名称:sparkle,代码行数:23,代码来源:test_qstim.py

示例2: TestStimModel

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

#.........这里部分代码省略.........
            print 'comparing signal', i
            signal0, atten0 = signals0[i]
            signal1, atten1 = signals1[i]
            np.testing.assert_array_equal(signal0, signal1)
            assert atten0 == atten1
            assert_equal(docs0[i], docs1[i])

    def test_calibration_template(self):
        ccf = CCFactory()
        model = ccf.create()
        model.setReferenceVoltage(100, 0.1)
        model.setRepCount(7)

        template = model.templateDoc()

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

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

        assert clone.stimid != model.stimid
        assert len(signals0) == len(signals1)
        assert clone.repCount() == model.repCount()
        for i in range(len(signals0)):
            print 'comparing signal', i
            signal0, atten0 = signals0[i]
            signal1, atten1 = signals1[i]
            np.testing.assert_array_equal(signal0, signal1)
            print 'atten0 {}, atten1 {}'.format(atten0, atten1)
            assert atten0 == atten1
            assert_equal(docs0[i], docs1[i])

    def test_verify_no_components(self):
        assert self.model.verify()

    def test_verify_no_ref_voltage(self):
        self.model.setReferenceVoltage(None, None)
        component = PureTone()
        self.model.insertComponent(component, 0,0)

        assert self.model.verify()

    def test_verify_conflicting_samplerates(self):
        component = Vocalization()
        component.setFile(sample.samplewav())
        self.model.insertComponent(component)
        component = Vocalization()
        component.setFile(sample.samplewav333())
        self.model.insertComponent(component)

        assert 'conflicting samplerate' in self.model.verify()

    def test_verify_short_duration(self):

        component = PureTone()
        component.setDuration(0.003)
        component.setRisefall(0.004)
        self.model.insertComponent(component, 0,0)
        
        invalid = self.model.verify()
        print 'msg', invalid
        assert invalid

    def test_verify_long_duration(self):
        component = PureTone()
开发者ID:boylea,项目名称:sparkle,代码行数:70,代码来源:test_stim_model.py


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