brian-team / brian

Brian is a simulator for spiking neural networks available on almost all platforms. This is the legacy version that is no longer developed, for new projects consider using Brian2 instead.
http://briansimulator.org
Other
60 stars 22 forks source link

Allow simple saving/loading of synaptic variables via Synapses.save_connectivity/load_connectivity #2

Open ghost opened 10 years ago

ghost commented 10 years ago

Added optional argument synaptic_vars to Synapses.save_connectivity that may contain a list of strings of synaptic variables that are then saved to the file along with the synaptic indices. Variables saved in this way are automatically restored by load_connectivity.

mstimberg commented 10 years ago

Hi Felix, thanks for your contribution! I'll add some comments directly to the source code. Could you also add a test for your feature or rather adapt the existing test for the save functionality ( https://github.com/brian-team/brian/blob/master/brian/tests/testutils/test_savesynapses.py )? Actually, the existing test seems to assume that synaptic variables are saved already but it only passes because it compares the state variable in the Synapses object before saving to itself... Weird. In general, it would be nice to have some more error checking in this function (non-existing variable names, etc) -- but let's leave this for the port to Brian 2 :)

Note that we don't really use github/git for the development in Brian1, I'll commit the changes to the subversion repository in the end and close this pull request. Therefore you don't have to bother with cleaning up the commit history or anything like that if you continue to make changes to this pull request.