Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional string indexing of Synapses objects raises uninformative KeyError #1287

Open
denisalevi opened this issue Apr 6, 2021 · 1 comment

Comments

@denisalevi
Copy link
Member

denisalevi commented Apr 6, 2021

Hi there!

I just adapted the test_synapses_to_synapses.py test to find out if I need to take care of some form of subgroups when the targat of a SynapticPathway is a Synapses object. Here is the adapted test:

from brian2 import *
set_device('cpp_standalone')

source = SpikeGeneratorGroup(3, [0, 1, 2], [0, 0, 0]*ms, period=2*ms)
modulator = SpikeGeneratorGroup(3, [0, 2], [1, 3]*ms)
target = NeuronGroup(3, 'v : integer')
conn = Synapses(source, target, 'w : integer', on_pre='v += w')
conn.connect(j='i')
conn.w = 1
# XXX: I added the `['i > 0']` index
modulatory_conn = Synapses(modulator, conn['i > 0'], on_pre='w += 1')
modulatory_conn.connect(j='i')
run(5*ms)
# First group has its weight increased to 2 after the first spike
# Third group has its weight increased to 2 after the second spike
assert_array_equal(target.v, [5, 3, 4])

This fails with

KeyError: 'No template with name "group_get_indices" found.'

All I did compared to the original test is adding a ['i > 0'] index to the target Synapses object in the modulatory synapse:

modulatory_conn = Synapses(modulator, conn['i > 0'], on_pre='w += 1')
  1. Should this be possible at all? Creating a Synapses subgroup by string indexing? It seems like this could be implemented (something like a simple version of the synapses_create_generator template that checks the condition for each created synapse). But I don't think it is, right? If not, this should probably raise a better error message?
  2. While here with this test: Is there any other way that modulatory_conn could target a subgroup of conn in the line above. Or in other words, is it possible to create a subgroup of a Synapses object before running the network in standalone mode? If not, this would make the brian2cuda implementation much easier.
  3. And to make sure I didn't miss anything: SynapsesPahtway objects have to have a spiking NeuronGroup as their source and having Synapses as source of a SynapticPathway object is not possible since Synapses can't define spikes / events on which the pathway is activated. Correct?
@denisalevi
Copy link
Member Author

I just looked into the astrocyte examples and my question 3 is answered: Synapses object can be sources of SynapticPathways. OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant