當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。