Skip to content

Commit

Permalink
Use the correct specifier for _synaptic_pre and _synaptic_post
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Stimberg committed Jul 10, 2013
1 parent d51042b commit 3f7a50e
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions brian2/synapses/synapses.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,16 +324,16 @@ def __init__(self, synapses):
self.j = IndexView(self, self.synaptic_post)
self.k = SynapseIndexView(self)

self.specifiers = self.specifiers = {'i': DynamicArrayVariable('i',
Unit(1),
self.synaptic_pre.dtype,
self.synaptic_pre,
'_neuron_idx'),
'j': DynamicArrayVariable('j',
Unit(1),
self.synaptic_post.dtype,
self.synaptic_post,
'_neuron_idx')}
self.specifiers = {'i': DynamicArrayVariable('i',
Unit(1),
self.synaptic_pre.dtype,
self.synaptic_pre,
'_neuron_idx'),
'j': DynamicArrayVariable('j',
Unit(1),
self.synaptic_post.dtype,
self.synaptic_post,
'_neuron_idx')}

self._registered_variables = []

Expand Down Expand Up @@ -413,6 +413,9 @@ def _add_synapses(self, sources, targets, n, p, condition=None,
np.int32, self.source_len),
'_num_target_neurons': ReadOnlyValue('_num_target_neurons', Unit(1),
np.int32, self.target_len),
# The template needs to have access to the DynamicArray here,
# having access to the underlying array (which would be much
# faster), is not enough
'_synaptic_pre': ReadOnlyValue('_synaptic_pre', Unit(1),
np.int32,
self.synaptic_pre),
Expand Down Expand Up @@ -836,19 +839,24 @@ def _create_specifiers(self):
'_num_neurons': AttributeValue('_num_neurons', Unit(1),
np.int, self, 'N',
constant=True),
# We don't need "proper" specifier for these -- they are not accessed in user code
'_num_source_neurons':ReadOnlyValue('_num_source_neurons', Unit(1),
np.int32,
len(self.source)),
'_num_target_neurons':ReadOnlyValue('_num_target_neurons', Unit(1),
np.int32,
len(self.target)),
'_synaptic_pre': ReadOnlyValue('_synaptic_pre', Unit(1),
np.int32,
self.indices.synaptic_pre),
'_synaptic_post': ReadOnlyValue('_synaptic_post', Unit(1),
np.int32,
self.indices.synaptic_post),
'_synaptic_pre': DynamicArrayVariable('_synaptic_pre',
Unit(1),
np.int32,
self.indices.synaptic_pre,
'_neuron_idx'),
'_synaptic_post': DynamicArrayVariable('_synaptic_pre',
Unit(1),
np.int32,
self.indices.synaptic_post,
'_neuron_idx'),
# We don't need "proper" specifier for these -- they go
# back to Python code currently
'_pre_synaptic': ReadOnlyValue('_pre_synaptic', Unit(1),
np.int32,
self.indices.pre_synaptic),
Expand Down Expand Up @@ -1017,4 +1025,4 @@ def smallest_inttype(N):
elif N<=2147483647:
return np.int32
else:
return np.int64
return np.int64

0 comments on commit 3f7a50e

Please sign in to comment.