本文整理汇总了Python中sparkle.stim.stimulus_model.StimulusModel.autoParams方法的典型用法代码示例。如果您正苦于以下问题:Python StimulusModel.autoParams方法的具体用法?Python StimulusModel.autoParams怎么用?Python StimulusModel.autoParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sparkle.stim.stimulus_model.StimulusModel
的用法示例。
在下文中一共展示了StimulusModel.autoParams方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_tone_stim
# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import autoParams [as 别名]
def create_tone_stim(nreps):
component = PureTone()
stim_model = StimulusModel()
stim_model.insertComponent(component, 0,0)
stim_model.setRepCount(nreps)
auto_model = stim_model.autoParams()
auto_model.insertRow(0)
auto_model.toggleSelection(0,component)
# values = ['frequency', 0, 100, 10]
values = ['duration', 0.065, 0.165, 0.010] # had caused problem in past
auto_model.setParamValue(0, parameter=values[0], start=values[1],
stop=values[2], step=values[3])
return stim_model
示例2: create
# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import autoParams [as 别名]
def create():
stim = StimulusModel()
tone = PureTone()
tone.setDuration(0.1)
stim.insertComponent(tone)
tuning_curve = stim.autoParams()
tuning_curve.insertRow(0)
tuning_curve.toggleSelection(0, tone)
tuning_curve.setParamValue(0, parameter='frequency', start=1000, stop=100000, step=20000)
tuning_curve.insertRow(1)
tuning_curve.toggleSelection(1, tone)
tuning_curve.setParamValue(1, parameter='intensity', start=90, stop=100, step=10)
stim.setStimType(TuningCurveEditor.name)
return stim
示例3: create_tone_stim
# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import autoParams [as 别名]
def create_tone_stim(stepsize, dur):
component = PureTone()
component.setDuration(dur)
stim_model = StimulusModel()
stim_model.setReferenceVoltage(100,1.0)
stim_model.insertComponent(component, 0,0)
auto_model = stim_model.autoParams()
auto_model.insertRow(0)
auto_model.toggleSelection(0,component)
values = ['frequency', 0, 100, stepsize]
auto_model.setParamValue(0, parameter=values[0], start=values[1],
stop=values[2], step=values[3])
print 'Number of traces: {}, num samples: {}'.format(stim_model.traceCount(), stim_model.traceCount()*(dur*5e5))
return stim_model
示例4: create_vocal_stim
# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import autoParams [as 别名]
def create_vocal_stim(nreps):
component = Vocalization()
component.setFile(sample.samplewav())
delay = Silence()
stim_model = StimulusModel()
stim_model.insertComponent(delay, 0,0)
stim_model.insertComponent(component, 0,0)
stim_model.setRepCount(nreps)
auto_model = stim_model.autoParams()
auto_model.insertRow(0)
p = {'parameter' : 'filename',
'names' : [sample.samplewav(), sample.samplewav()],
'selection' : []
}
auto_model.overwriteParam(0,p)
auto_model.toggleSelection(0,component)
return stim_model
示例5: create
# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import autoParams [as 别名]
def create():
stim = StimulusModel()
tone = PureTone()
tone.setDuration(CCFactory.defaultInputs['duration'])
tone.setRisefall(CCFactory.defaultInputs['risefall'])
stim.insertComponent(tone)
tuning_curve = stim.autoParams()
tuning_curve.insertRow(0)
tuning_curve.toggleSelection(0, tone)
tuning_curve.setParamValue(0, parameter='frequency', start=CCFactory.defaultInputs['freqStart'], stop=CCFactory.defaultInputs['freqStop'], step=CCFactory.defaultInputs['freqStep'])
tuning_curve.insertRow(1)
tuning_curve.toggleSelection(1, tone)
tuning_curve.setParamValue(1, parameter='intensity', start=CCFactory.defaultInputs['intenStart'], stop=CCFactory.defaultInputs['intenStop'], step=CCFactory.defaultInputs['intenStep'])
stim.setRepCount(CCFactory.defaultInputs['reps'])
stim.setStimType(CCFactory.name)
return stim
示例6: TestStimModel
# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import autoParams [as 别名]
#.........这里部分代码省略.........
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()
component.setDuration(0.3)
self.model.insertComponent(component, 0,0)
assert self.model.verify(windowSize=0.2)
def test_verify_success(self):
component = PureTone()
self.model.insertComponent(component, 0,0)
assert self.model.verify() == 0
def test_verify_success_with_autoparameters(self):
component = PureTone()
component.setRisefall(0.003)
self.model.insertComponent(component, 0,0)
ap_model = self.model.autoParams()
ap_model.insertRow(0)
ap_model.toggleSelection(0, component)
# values are in seconds
values = ['duration', 0.020, 0.008, 0.001]
ap_model.setParamValue(0, parameter=values[0], start=values[1],
stop=values[2], step=values[3])
invalid = self.model.verify(windowSize=0.1)
print 'msg', invalid
assert invalid == 0
def test_verify_parameter_conflict(self):
"""When a combination of paramters in auto-parameters causes
a conflict"""
component = PureTone()
component.setRisefall(0.005)
self.model.insertComponent(component, 0,0)
ap_model = self.model.autoParams()
ap_model.insertRow(0)
ap_model.toggleSelection(0, component)
values = ['duration', 0.020, 0.004, 0.001]
ap_model.setParamValue(0, parameter=values[0], start=values[1],
stop=values[2], step=values[3])
invalid = self.model.verify()
print 'msg', invalid
assert invalid
def test_verify_with_long_auto_parameter(self):
示例7: PureTone
# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import autoParams [as 别名]
if __name__ == "__main__":
import sys
from sparkle.stim.auto_parameter_model import AutoParameterModel
from sparkle.stim.stimulus_model import StimulusModel
from sparkle.stim.types.stimuli_classes import *
app = QtGui.QApplication(sys.argv)
tone0 = PureTone()
tone0.setDuration(0.02)
stim = StimulusModel()
stim.insertComponent(tone0)
tuning_curve = stim.autoParams()
tuning_curve.insertRows(0,2)
selection_model = tuning_curve.data(tuning_curve.index(0,0), role=AutoParameterModel.SelectionModelRole)
selection_model.select(stim.index(0,0))
selection_model = tuning_curve.data(tuning_curve.index(1,0), role=AutoParameterModel.SelectionModelRole)
selection_model.select(stim.index(0,0))
tuning_curve.setData(tuning_curve.index(0,0), 'frequency', role=QtCore.Qt.EditRole)
tuning_curve.setData(tuning_curve.index(0,1), 0, role=QtCore.Qt.EditRole)
tuning_curve.setData(tuning_curve.index(0,2), 150, role=QtCore.Qt.EditRole)
tuning_curve.setData(tuning_curve.index(0,3), 10, role=QtCore.Qt.EditRole)
tuning_curve.setData(tuning_curve.index(1,0), 'intensity', role=QtCore.Qt.EditRole)
tuning_curve.setData(tuning_curve.index(1,1), 0, role=QtCore.Qt.EditRole)
tuning_curve.setData(tuning_curve.index(1,2), 100, role=QtCore.Qt.EditRole)
tuning_curve.setData(tuning_curve.index(1,3), 5, role=QtCore.Qt.EditRole)
示例8: QStimulusModel
# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import autoParams [as 别名]
# stim.insertComponent(tone0)
# stim.insertComponent(tone4, (1,0))
# stim.insertComponent(tone5, (1,0))
stim.insertEmptyRow()
stim.insertComponent(vocal0, 1,0)
stim.insertComponent(tone3, 1,0)
# stim.insertComponent(silence0, (2,0))
ptype = 'duration'
start = .1
step = .2
stop = 1.0
parameter_model = stim.autoParams()
parameter_model.insertRow(0)
# select first component
parameter_model.toggleSelection(0, stim.component(0,0))
# set values for autoparams
parameter_model.setParamValue(0, start=start, step=step,
stop=stop, parameter=ptype)
qstim = QStimulusModel(stim)
editor = StimulusEditor()
editor.setModel(qstim)
# editor.ui.trackview.setModel(stim)
editor.show()
app.exec_()