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


Python StimulusModel.setMaxVoltage方法代码示例

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


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

示例1: createView

# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import setMaxVoltage [as 别名]
 def createView(self):
     view = ProtocolView()
     tests = ProtocolTabelModel()
     tests.setReferenceVoltage(100, 0.1)
     model = QProtocolTabelModel(tests)
     view.setModel(model)
     stim = TCFactory.create()
     StimulusModel.setMaxVoltage(5.0, 5.0)
     model.insertTest(stim, 0)
     return view, stim
开发者ID:boylea,项目名称:sparkle,代码行数:12,代码来源:test_protocol_view.py

示例2: setUp

# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import setMaxVoltage [as 别名]
    def setUp(self):
        StimulusModel.setMaxVoltage(1.5, 10.0)
        StimulusModel.setMinVoltage(0.005)
        self.tempfolder = os.path.join(os.path.abspath(os.path.dirname(__file__)), u"tmp")
        self.done = True

        log = logging.getLogger('main')
        log.setLevel(logging.DEBUG)
        self.stream = StringIO.StringIO()
        self.handler = logging.StreamHandler(self.stream)
        log.addHandler(self.handler)
开发者ID:boylea,项目名称:sparkle,代码行数:13,代码来源:test_acq_manager.py

示例3: launchAdvancedDlg

# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import setMaxVoltage [as 别名]
 def launchAdvancedDlg(self):
     dlg = AdvancedOptionsDialog(self.advanced_options)
     if dlg.exec_():
         self.advanced_options = dlg.getValues()
         StimulusModel.setMaxVoltage(self.advanced_options['max_voltage'], self.advanced_options['device_max_voltage'])
         self.display.setAmpConversionFactor(self.advanced_options['volt_amp_conversion'])
         if self.advanced_options['use_attenuator']:
             # could check for return value here? It will try
             # to re-connect every time start is pressed anyway
             self.acqmodel.attenuator_connection(True)
         else:
             self.acqmodel.attenuator_connection(False)
         self.reset_device_channels()
     dlg.deleteLater()
开发者ID:boylea,项目名称:sparkle,代码行数:16,代码来源:main_control.py

示例4: setUp

# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import setMaxVoltage [as 别名]
 def setUp(self):
     self.tempfile = os.path.join(os.path.abspath(os.path.dirname(__file__)), u"tmp", 'testsave.json')
     model = StimulusModel()
     model.setMaxVoltage(1.5, 10.0)
     model.setReferenceVoltage(100, 0.1)
     model.setRepCount(7)
     # add tone, vocalization, and silence components
     component = PureTone()
     component.setIntensity(34)
     component.setDuration(0.2)
     model.insertComponent(component, 0,0)
     vocal = Vocalization()
     vocal.setFile(sample.samplewav())
     model.insertEmptyRow()
     model.insertComponent(vocal, 1,0)
     silence = Silence()
     # have gap between tone and vocal
     silence.setDuration(0.5)
     model.insertComponent(silence, 1,0)
     nsteps = self.add_auto_param(model)
     editor = StimulusEditor()
     editor.setModel(QStimulusModel(model))
     self.editor = editor
     self.stim = model
开发者ID:boylea,项目名称:sparkle,代码行数:26,代码来源:test_stim_editor.py

示例5: setup

# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import setMaxVoltage [as 别名]
 def setup(self):
     StimulusModel.setMaxVoltage(1.5, 10.0)
开发者ID:boylea,项目名称:sparkle,代码行数:4,代码来源:test_qstim.py

示例6: loadInputs

# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import setMaxVoltage [as 别名]
    def loadInputs(self, fname):
        """Load previsouly saved input values, and load them to GUI widgets

        :param fname: file path where stashed input values are stored
        :type fname: str
        """
        inputsfname = os.path.join(systools.get_appdir(), fname)
        try:
            with open(inputsfname, 'r') as jf:
                inputsdict = json.load(jf)
        except:
            logger = logging.getLogger('main')
            logger.warning("Unable to load app data from file: {}".format(inputsfname))
            inputsdict = {}

        # self.display.spiketracePlot.setThreshold(inputsdict.get('threshold', 0.5))
        self._thesholds = inputsdict.get('threshold', {})
        self.stashedAisr = inputsdict.get('aifs', 100000)
        self.ui.aifsSpnbx.setValue(self.stashedAisr)
        self.ui.windowszSpnbx.setValue(inputsdict.get('windowsz', 0.1))
        self.ui.binszSpnbx.setValue(inputsdict.get('binsz', 0.005))        
        self.saveformat = inputsdict.get('saveformat', 'hdf5')
        self.ui.exploreStimEditor.setReps((inputsdict.get('ex_nreps', 5)))
        self.ui.reprateSpnbx.setValue(inputsdict.get('reprate', 1))
        # self.display.spiketracePlot.setRasterBounds(inputsdict.get('raster_bounds', (0.5,1)))
        self.specArgs = inputsdict.get('specargs',{u'nfft':512, u'window':u'hanning', u'overlap':90, 'colormap':{'lut':None, 'state':None, 'levels':None}})
        # self.display.setSpecArgs(**self.specArgs)  
        SpecWidget.setSpecArgs(**self.specArgs)
        self.viewSettings = inputsdict.get('viewSettings', {'fontsz': 10, 'display_attributes':{}})
        self.ui.stimDetails.setDisplayAttributes(self.viewSettings['display_attributes'])
        font = QtGui.QFont()
        font.setPointSize(self.viewSettings['fontsz'])
        QtGui.QApplication.setFont(font)
        self.ui.calibrationWidget.ui.nrepsSpnbx.setValue(inputsdict.get('calreps', 5))
        self.calvals = inputsdict.get('calvals', {'calf':20000, 'caldb':100, 
                                      'calv':0.1, 'use_calfile':False, 
                                      'frange':(5000, 1e5), 'calname': ''})
        self.calvals['use_calfile'] = False
        self.calvals['calname'] = ''
        self.ui.refDbSpnbx.setValue(self.calvals['caldb'])
        self.ui.mphoneSensSpnbx.setValue(inputsdict.get('mphonesens', 0.004))
        self.ui.mphoneDBSpnbx.setValue(MPHONE_CALDB)
        # self.ui.mphoneDBSpnbx.setValue(inputsdict.get('mphonedb', 94))
        Vocalization.paths = inputsdict.get('vocalpaths', [])

        # load the previous sessions scaling
        self.tscale = inputsdict.get('tscale', SmartSpinBox.MilliSeconds)
        self.fscale = inputsdict.get('fscale', SmartSpinBox.kHz)
        try:
            self.updateUnitLabels(self.tscale, self.fscale)
        except:
            self.tscale = 'ms'
            self.fscale = 'kHz'
            self.updateUnitLabels(self.tscale, self.fscale)

        cal_template = inputsdict.get('calparams', None)
        if cal_template is not None:
            try:
                self.acqmodel.load_calibration_template(cal_template)
            except:
                logger = logging.getLogger('main')
                logger.exception("Unable to load previous calibration settings")
        else:
            logger = logging.getLogger('main')
            logger.debug('No saved calibration stimului inputs')

        if 'explorestims' in inputsdict:
            self.ui.exploreStimEditor.loadTemplate(inputsdict['explorestims'])
        else:
            logger = logging.getLogger('main')
            logger.debug('No saved explore stimului inputs')

        # load the previous session's Tuning Curve defaults
        TCFactory.defaultInputs.update(inputsdict.get('tuning_curve', TCFactory.defaultInputs))

        # set defaults then merge
        self.advanced_options = {'device_name':'', 
                                 'max_voltage':1.5,
                                 'device_max_voltage': 10.0,
                                 'volt_amp_conversion': 0.1,
                                 'use_attenuator': False }
        if 'advanced_options' in inputsdict:
            self.advanced_options.update(inputsdict['advanced_options'])
        StimulusModel.setMaxVoltage(self.advanced_options['max_voltage'], self.advanced_options['device_max_voltage'])
        self.display.setAmpConversionFactor(self.advanced_options['volt_amp_conversion'])
        if self.advanced_options['use_attenuator']:
            self.acqmodel.attenuator_connection(True)
        else:
            self.acqmodel.attenuator_connection(False)
        self._aichans = inputsdict.get('aichans', [])
        self._aichan_details = inputsdict.get('aichan_details', {})
        for name, deets in self._aichan_details.items():
            # make sure all field as present in details for each channel
            self._aichan_details[name]['threshold'] = deets.get('threshold', 5)
            self._aichan_details[name]['polarity'] = deets.get('polarity', 1)
            self._aichan_details[name]['raster_bounds'] = deets.get('raster_bounds', (0.5,0.9))
            self._aichan_details[name]['abs'] = deets.get('abs', True)

        self.reset_device_channels()

#.........这里部分代码省略.........
开发者ID:Joel-U,项目名称:sparkle,代码行数:103,代码来源:controlwindow.py

示例7: TestStimModel

# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import setMaxVoltage [as 别名]
class TestStimModel():
    def setup(self):
        self.model = StimulusModel()
        self.model.setReferenceVoltage(100, 0.1)
        self.model.setMaxVoltage(MAXV, DEVICE_MAXV)
        self.model.setMinVoltage(0.005)

    def test_insert_data(self):
        fake_component0 = 'ducks'
        fake_component1 = 'frogs'
        self.model.insertComponent(fake_component0, 0, 0)
        self.model.insertComponent(fake_component1, 0, 0)
        assert self.model.component(0,0) == fake_component1
        assert self.model.component(0,1) == fake_component0

    def test_remove_data(self):
        fake_component0 = 'ducks'
        self.model.insertComponent(fake_component0, 0, 0)
        self.model.removeComponent(0,0)
        assert self.model.component(0,0) == None

    def test_component_index(self):
        fake_component0 = 'ducks'
        # component will be added to the lowest index in row
        self.model.insertComponent(fake_component0, 0, 2)
        index = self.model.indexByComponent(fake_component0)
        assert index == (0,0)

    @raises(IndexError)
    def test_set_data(self):
        fake_component0 = 'ducks'
        self.model.overwriteComponent(fake_component0, 0, 0)

    def test_row_column_count(self):
        fake_component0 = 'ducks'
        self.model.insertComponent(fake_component0, 0, 0)
        assert self.model.columnCountForRow(0) == 1
        assert self.model.rowCount() == 1

    def test_trace_count_no_auto(self):
        component0 = PureTone()
        component1 = PureTone()
        self.model.insertComponent(component0, 0,0)
        self.model.insertComponent(component1, 0,0)

        assert self.model.traceCount() == 1

    def test_trace_count_no_components(self):
        self.add_auto_param(self.model)        

        assert self.model.traceCount() == 0

    def test_trace_count_with_auto(self):
        component = PureTone()
        self.model.insertComponent(component, 0,0)     

        nsteps = self.add_auto_param(self.model)        

        assert self.model.traceCount() == nsteps

    def test_model_contains(self):
        component = PureTone()
        self.model.insertComponent(component, 0,0)

        assert self.model.contains('PureTone')

    def test_expanded_stim_no_auto(self):
        """signal of a model without any auto parameters"""
        component = PureTone()
        self.model.insertComponent(component, 0,0)

        signals, doc, ovld = self.model.expandedStim()
        assert len(signals) == 1
        assert_equal(signals[0][0].shape[0], component.duration()*self.model.samplerate())
        assert len(doc) == 1
        assert doc[0]['samplerate_da'] == self.model.samplerate()

    def test_expanded_stim_with_auto(self):
        component = PureTone()
        self.model.insertComponent(component, 0,0)       
        nsteps = self.add_auto_param(self.model)        

        signals, doc, ovld = self.model.expandedStim()
        assert len(signals) == nsteps
        assert len(doc) == nsteps
        assert doc[0]['samplerate_da'] == self.model.samplerate()

    def test_expaned_stim_with_vocal_auto(self):
        component = Vocalization()
        component.setFile(sample.samplewav())
        self.model.insertComponent(component, 0,0)       
        nsteps = self.add_vocal_param(self.model)        

        signals, doc, ovld = self.model.expandedStim()
        assert len(signals) == nsteps
        assert len(doc) == nsteps
        assert doc[0]['samplerate_da'] == self.model.samplerate()

    def test_signal_eq_caldb(self):
        caldb = 100
#.........这里部分代码省略.........
开发者ID:boylea,项目名称:sparkle,代码行数:103,代码来源:test_stim_model.py

示例8: setUp

# 需要导入模块: from sparkle.stim.stimulus_model import StimulusModel [as 别名]
# 或者: from sparkle.stim.stimulus_model.StimulusModel import setMaxVoltage [as 别名]
 def setUp(self):
     if not os.path.exists(tempfolder):
         os.mkdir(tempfolder)
     StimulusModel.setMaxVoltage(5,5)
开发者ID:boylea,项目名称:sparkle,代码行数:6,代码来源:test_protocol_view.py


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