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


Python CodeRunner.before_run方法代码示例

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


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

示例1: before_run

# 需要导入模块: from brian2.groups.group import CodeRunner [as 别名]
# 或者: from brian2.groups.group.CodeRunner import before_run [as 别名]
    def before_run(self, run_namespace=None, level=0):
        # execute code to initalize the spike queue
        if self._initialise_queue_codeobj is None:
            self._initialise_queue_codeobj = create_runner_codeobj(self,
                                                                   '', # no code,
                                                                   'synapses_initialise_queue',
                                                                   name=self.name+'_initialise_queue',
                                                                   check_units=False,
                                                                   additional_variables=self.variables,
                                                                   run_namespace=run_namespace,
                                                                   level=level+1)
        self._initialise_queue_codeobj()
        CodeRunner.before_run(self, run_namespace, level=level+1)

        # we insert rather than replace because CodeRunner puts a CodeObject in updaters already
        if self._pushspikes_codeobj is None:
            self._pushspikes_codeobj = create_runner_codeobj(self,
                                                             '', # no code
                                                             'synapses_push_spikes',
                                                             name=self.name+'_push_spikes',
                                                             check_units=False,
                                                             additional_variables=self.variables,
                                                             run_namespace=run_namespace,
                                                             level=level+1)

        self._code_objects.insert(0, weakref.proxy(self._pushspikes_codeobj))
开发者ID:francesconero,项目名称:brian2,代码行数:28,代码来源:synapses.py

示例2: before_run

# 需要导入模块: from brian2.groups.group import CodeRunner [as 别名]
# 或者: from brian2.groups.group.CodeRunner import before_run [as 别名]
 def before_run(self, run_namespace):
     # execute code to initalize the data structures
     if self._prepare_codeobj is None:
         self._prepare_codeobj = create_runner_codeobj(self.group,
                                                       '', # no code,
                                                       'spatialneuron_prepare',
                                                       name=self.name+'_spatialneuron_prepare',
                                                       check_units=False,
                                                       additional_variables=self.variables,
                                                       run_namespace=run_namespace)
     self._prepare_codeobj()
     # Raise a warning if the slow pure numpy version is used
     # For simplicity, we check which CodeObject class the _prepare_codeobj
     # is using, this will be the same as the main state updater
     from brian2.codegen.runtime.numpy_rt.numpy_rt import NumpyCodeObject
     if isinstance(self._prepare_codeobj, NumpyCodeObject):
         # If numpy is used, raise a warning if scipy is not present
         try:
             import scipy
         except ImportError:
             logger.info(('SpatialNeuron will use numpy to do the numerical '
                          'integration -- this will be very slow. Either '
                          'switch to a different code generation target '
                          '(e.g. weave or cython) or install scipy.'),
                         once=True)
     CodeRunner.before_run(self, run_namespace)
开发者ID:brian-team,项目名称:brian2numba,代码行数:28,代码来源:spatialneuron.py

示例3: before_run

# 需要导入模块: from brian2.groups.group import CodeRunner [as 别名]
# 或者: from brian2.groups.group.CodeRunner import before_run [as 别名]
 def before_run(self, run_namespace=None, level=0):
     if self._group.dt != self._stored_dt:
         raise NotImplementedError('The dt used for simulating %s changed '
                                   'after the PoissonInput source was '
                                   'created.' % self.group.name)
     CodeRunner.before_run(self, run_namespace=run_namespace,
                           level=level+1)
开发者ID:SudShekhar,项目名称:brian2,代码行数:9,代码来源:poissoninput.py

示例4: before_run

# 需要导入模块: from brian2.groups.group import CodeRunner [as 别名]
# 或者: from brian2.groups.group.CodeRunner import before_run [as 别名]
 def before_run(self, run_namespace=None, level=0):
     # execute code to initalize the data structures
     if self._prepare_codeobj is None:
         self._prepare_codeobj = create_runner_codeobj(self.group,
                                                       '', # no code,
                                                       'spatialneuron_prepare',
                                                       name=self.name+'_spatialneuron_prepare',
                                                       check_units=False,
                                                       additional_variables=self.variables,
                                                       run_namespace=run_namespace,
                                                       level=level+1)
     self._prepare_codeobj()
     CodeRunner.before_run(self, run_namespace, level=level + 1)
开发者ID:Kwartke,项目名称:brian2,代码行数:15,代码来源:spatialneuron.py

示例5: before_run

# 需要导入模块: from brian2.groups.group import CodeRunner [as 别名]
# 或者: from brian2.groups.group.CodeRunner import before_run [as 别名]
 def before_run(self, run_namespace=None, level=0):
     if not self._isprepared:  # this is done only once even if there are multiple runs
         self.prepare()
         self._isprepared = True
     CodeRunner.before_run(self, run_namespace, level=level + 1)
开发者ID:msGenDev,项目名称:brian2,代码行数:7,代码来源:spatialneuron.py


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