-
Notifications
You must be signed in to change notification settings - Fork 43
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
Current sources #1076
Current sources #1076
Conversation
Conflicts: spynnaker/pyNN/models/neuron/population_machine_vertex.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good in general. The only issue I have is the repetition of code. A thought would be to have something like the full-neuron vs. components impl. This might have current_source_inst.h which defines a single current source instance (then with current_source_inst_noisy.h etc.) and then a current_source_impl.h to bring those things together. It may need a bit of thought though to get it right e.g. if there is a way to detect what sources are allowed etc. in some more automatic way.
Thinking about this a bit more, I think it is likely that the main thing that brings the current sources together needs to know about all possible sources anyway, as you have done with the IDs. This could then maybe do something with #define and #ifdef in the right places, then do different things depending on which sources end up being included. An example of this might be something like the following (note lots of copy and paste and totally untested!): current_source_dc_impl.h
current_sources.h
|
I was also just thinking how to avoid looping every neuron ID when trying the source. Another idea is below (again untested): current_sources.h
|
Both suggestions seem plausible - will investigate and return with either updated code or comments on the suggestions. |
This now has much less repetition in than previously - it's now an amalgamation between your first suggestion and what was originally on the branch. I couldn't get the various structs you'd suggested to work properly but I think it must be possible, and the second idea to avoid looping every neuron ID must also be possible but again I haven't yet got the memory structure working correctly in that instance. |
Conflicts: spynnaker8/__init__.py
I think I now have this running correctly to avoid the loop to check the neuron ID each time. I did this slightly differently to the suggestion in that I changed the array being written in from the Python side to have the current source IDs per neuron rather than the neuron IDs per current source as it previously was. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine now. I made one comment about a bit of code that looks a bit odd, but it isn't critical.
Resolves #1060
Allows the user to specify a CurrentSource and inject it into a Population or PopulationView (see e.g. http://neuralensemble.org/docs/PyNN/injecting_current.html).
Edit: This should now work for multiple CurrentSources into the same core and indeed into the same neuron.
Another unfinished piece of this is to deal with the case where the dt parameter in the NoisyCurrentSource is not the same as the (simulation) timestep value. For now the code throws an error if these two parameters are different.
An example is shown in SpiNNakerManchester/PyNNExamples#66; more detailed tests could possibly be written to check numerics etc. but not necessarily in this PR.
Merge with:
SpiNNakerManchester/sPyNNakerNewModelTemplate#76
SpiNNakerManchester/PyNNExamples#66 (which shows an example)
Tested by:
SpiNNakerManchester/IntegrationTests#51