{"action":"created","issue":{"url":"https://api.github.com/repos/nest/nest-simulator/issues/497","repository_url":"https://api.github.com/repos/nest/nest-simulator","labels_url":"https://api.github.com/repos/nest/nest-simulator/issues/497/labels{/name}","comments_url":"https://api.github.com/repos/nest/nest-simulator/issues/497/comments","events_url":"https://api.github.com/repos/nest/nest-simulator/issues/497/events","html_url":"https://github.com/nest/nest-simulator/pull/497","id":179798425,"number":497,"title":"Device for recording weights of plastic synapses","user":{"login":"weidel-p","id":12795254,"avatar_url":"https://avatars.githubusercontent.com/u/12795254?v=3","gravatar_id":"","url":"https://api.github.com/users/weidel-p","html_url":"https://github.com/weidel-p","followers_url":"https://api.github.com/users/weidel-p/followers","following_url":"https://api.github.com/users/weidel-p/following{/other_user}","gists_url":"https://api.github.com/users/weidel-p/gists{/gist_id}","starred_url":"https://api.github.com/users/weidel-p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weidel-p/subscriptions","organizations_url":"https://api.github.com/users/weidel-p/orgs","repos_url":"https://api.github.com/users/weidel-p/repos","events_url":"https://api.github.com/users/weidel-p/events{/privacy}","received_events_url":"https://api.github.com/users/weidel-p/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-28T14:59:43Z","updated_at":"2016-09-29T08:07:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nest/nest-simulator/pulls/497","html_url":"https://github.com/nest/nest-simulator/pull/497","diff_url":"https://github.com/nest/nest-simulator/pull/497.diff","patch_url":"https://github.com/nest/nest-simulator/pull/497.patch"},"body":"Hi,\r\n\r\nwith this PR I'd like to add a device (`weight_recorder`)  to NEST allowing the user to record the weight-changes of plastic synapses during the simulation.\r\n\r\nUntil now, it was necessary to stop the simulation, read the synaptic weights using `GetConnections` and `GetStatus` and resume the simulation  in order to record the changes of the synaptic strengths during a simulation. With the `weight_recorder` the changes of synaptic strengths are recorded on the fly and without the need to stop the simulation.\r\n\r\nTo achieve a consistent user experience and for minimizing the memory overhead, the usage of the `weight_recorder` is based on the `volume_transmitter`; the `weight_recorder` is registered to a synapse in the `CommonSynapsePorperties` using `SetDefaults` or `CopyModel`.\r\n\r\nHere is an example pyNEST script using the `weight_recorder` with the `stdp_synapse`:\r\n\r\n```\r\nimport nest\r\n\r\nwr = nest.Create('weight_recorder', 1, {\"to_file\": True})\r\nnest.CopyModel(\"stdp_synapse\", \"stdp_synapse_rec\", {\"weight_recorder\": wr[0]})\r\n\r\nsg = nest.Create(\"spike_generator\", params={\"spike_times\": [10., 15., 55., 70.]})\r\npre = nest.Create(\"parrot_neuron\", 1)\r\npost = nest.Create(\"parrot_neuron\", 1)\r\n\r\nnest.Connect(pre, post, syn_spec=\"stdp_synapse_rec\")\r\nnest.Connect(sg, pre)\r\n\r\nnest.Simulate(100)\r\n```\r\n\r\nInternally, the `weight_recorder` is based on the `spike_detector` but handles `WeightRecorderEvent` instead of `SpikeEvent` and can not be used as a global receiver. \r\nAs a synapse has no `id` in NEST,  the `WeightRecorderEvent` has an additional field `receiver_gid` containing the gid of the postynaptic neuron, which allows the user to identify a synapse by the gid of the pre- and postsynaptic neuron. (This, of course, can not work for multapses)\r\n\r\nHere is the output of the `weight_recorder` running the example script above:\r\nThe columns containing the `sender_gid`, `receiver_gid`, `time`, `weight` in this order.\r\n```\r\n3       4       11.000  1.000   \r\n3       4       16.000  1.879   \r\n3       4       56.000  3.450   \r\n3       4       71.000  4.504\r\n```\r\n\r\nAs mentioned above, the `weight_recorder` is registered to a synapse in the `CommonSynapseProperties`.  Also worth mentioning is that the `WeightRecorderEvent` is sent to the `weight_recorder` in `connector_base.h`. This implementation leads to an easy and general solution: every existing and future synapse can make use of the `weight_recorder` without changing the implementation or caring about it. The drawback of this solution is one additional `if` statement in the send function, which might slow down the simulation.\r\n\r\nThis PR also contains a pyNEST unittest, testing for consistent results of the weights recorded by the `weight_recorder` using a single and multiple threads."},"comment":{"url":"https://api.github.com/repos/nest/nest-simulator/issues/comments/250399048","html_url":"https://github.com/nest/nest-simulator/pull/497#issuecomment-250399048","issue_url":"https://api.github.com/repos/nest/nest-simulator/issues/497","id":250399048,"user":{"login":"abigailm","id":10513829,"avatar_url":"https://avatars.githubusercontent.com/u/10513829?v=3","gravatar_id":"","url":"https://api.github.com/users/abigailm","html_url":"https://github.com/abigailm","followers_url":"https://api.github.com/users/abigailm/followers","following_url":"https://api.github.com/users/abigailm/following{/other_user}","gists_url":"https://api.github.com/users/abigailm/gists{/gist_id}","starred_url":"https://api.github.com/users/abigailm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abigailm/subscriptions","organizations_url":"https://api.github.com/users/abigailm/orgs","repos_url":"https://api.github.com/users/abigailm/repos","events_url":"https://api.github.com/users/abigailm/events{/privacy}","received_events_url":"https://api.github.com/users/abigailm/received_events","type":"User","site_admin":false},"created_at":"2016-09-29T08:07:24Z","updated_at":"2016-09-29T08:07:24Z","body":"yes, I can. I think it's not necessary now, as we have no plasticity models that do this, and we would have to think carefully before adding them as the minimum synaptic delay is kind of important. I would recommend letting this PR through without this change, and adapted the device later, if such models are added."}}
{"actor":{"display_login":"abigailm"}}