當前位置: 首頁>>代碼示例>>Python>>正文


Python StimulusModel.setReorderFunc方法代碼示例

本文整理匯總了Python中sparkle.stim.stimulus_model.StimulusModel.setReorderFunc方法的典型用法代碼示例。如果您正苦於以下問題:Python StimulusModel.setReorderFunc方法的具體用法?Python StimulusModel.setReorderFunc怎麽用?Python StimulusModel.setReorderFunc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sparkle.stim.stimulus_model.StimulusModel的用法示例。


在下文中一共展示了StimulusModel.setReorderFunc方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: TestStimModel

# 需要導入模塊: from sparkle.stim.stimulus_model import StimulusModel [as 別名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import setReorderFunc [as 別名]

#.........這裏部分代碼省略.........
            assert atten0 == atten1
            assert_equal(docs0[i], docs1[i])

        assert clone.repCount() == self.model.repCount()

    def test_template_with_auto_params_vocal(self):
        model = self.stim_with_double_auto()

        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)
        for i in range(len(signals0)):
            signal0, atten0 = signals0[i]
            signal1, atten1 = signals1[i]
            np.testing.assert_array_equal(signal0, signal1)
            assert atten0 == atten1
            assert_equal(docs0[i], docs1[i])

        assert clone.repCount() == model.repCount()

    def test_template_with_auto_params_randomized(self):
        self.model.setRepCount(7)
        component = PureTone()
        component.setIntensity(34)
        self.model.insertComponent(component, 0,0)
        nsteps = self.add_auto_param(self.model) 
        self.model.setReorderFunc(order_function('random'), 'random')

        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)
        assert clone.reorderName == self.model.reorderName
        # how to check if signal sets are the same?

        assert clone.repCount() == self.model.repCount()

    def test_template_tuning_curve(self):
        tcf = TCFactory()
        model = tcf.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)
開發者ID:boylea,項目名稱:sparkle,代碼行數:70,代碼來源:test_stim_model.py


注:本文中的sparkle.stim.stimulus_model.StimulusModel.setReorderFunc方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。