本文整理匯總了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)
示例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()