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))
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)
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() # 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.warn( ('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, level=level + 1)
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))
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)
def before_run(self, run_namespace): if self._group.dt_ != self._stored_dt: raise NotImplementedError( f"The dt used for simulating {self.group.name} " f"changed after the PoissonInput source was " f"created.") CodeRunner.before_run(self, run_namespace=run_namespace)
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)
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)
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)