GitHub PullRequestReviewCommentEvent at 2014-10-08 13:34:26
Repository: brian2
Actor: thesamovar
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/brian-team/brian2/pulls/comments/18581855","id":18581855,"diff_hunk":"@@ -1,39 +1,36 @@\n {% extends 'common.pyx' %}\r\n \r\n-{% block template_support_code %}\r\n-cdef int _start_idx = 0\r\n-cdef double _current_time = 0.0\r\n-{% endblock %}\r\n-\r\n {% block maincode %}\r\n \r\n-    {# USES_VARIABLES {_spikespace, N, t, dt, neuron_index, spike_time } #}\r\n-     \r\n-    global _start_idx, _current_time\r\n-    \r\n-    # Check if we have been reset, if so reset the cache\r\n-    if t<_current_time:\r\n-        _start_idx = 0\r\n-    \r\n-    _current_time = t\r\n+    {# USES_VARIABLES {_spikespace, N, t, dt, neuron_index, spike_time, period, _lastindex } #}\r\n \r\n     # TODO: We don't deal with more than one spike per neuron yet\r\n     cdef int _cpp_numspikes = 0\r\n+    cdef int padding        = 0\r\n+    cdef float epsilon      = 0.001*dt\r\n \r\n-    cdef char found = 0\r\n-    for _idx in range(_start_idx, _num{{spike_time}}):\r\n-        if {{spike_time}}[_idx]>t-dt:\r\n-            found = 1\r\n+    if (period > 0):\r\n+        padding = int(t / period)\r\n+\r\n+    # If there is a periodicity in the SpikeGenerator, we need to reset the lastindex \r\n+    # when all spikes have been played\r\n+    if ((period > 0) and (abs(t-period*padding) < epsilon)):\r\n+        {{_lastindex}}[0] = 0      \r","path":"brian2/codegen/runtime/cython_rt/templates/spikegenerator.pyx","position":36,"original_position":36,"commit_id":"0c7d029f0255d1ed77baabe7f700378462d968f5","original_commit_id":"0c7d029f0255d1ed77baabe7f700378462d968f5","user":{"login":"thesamovar","id":2903870,"avatar_url":"https://avatars.githubusercontent.com/u/2903870?v=2","gravatar_id":"","url":"https://api.github.com/users/thesamovar","html_url":"https://github.com/thesamovar","followers_url":"https://api.github.com/users/thesamovar/followers","following_url":"https://api.github.com/users/thesamovar/following{/other_user}","gists_url":"https://api.github.com/users/thesamovar/gists{/gist_id}","starred_url":"https://api.github.com/users/thesamovar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thesamovar/subscriptions","organizations_url":"https://api.github.com/users/thesamovar/orgs","repos_url":"https://api.github.com/users/thesamovar/repos","events_url":"https://api.github.com/users/thesamovar/events{/privacy}","received_events_url":"https://api.github.com/users/thesamovar/received_events","type":"User","site_admin":false},"body":"Is this potentially fragile? We only reset the count if the time is equal to the period. What if the period is not a multiple of ``dt`` - this condition will never be true. Right?","created_at":"2014-10-08T13:34:26Z","updated_at":"2014-10-08T13:34:26Z","html_url":"https://github.com/brian-team/brian2/pull/339#discussion_r18581855","pull_request_url":"https://api.github.com/repos/brian-team/brian2/pulls/339","_links":{"self":{"href":"https://api.github.com/repos/brian-team/brian2/pulls/comments/18581855"},"html":{"href":"https://github.com/brian-team/brian2/pull/339#discussion_r18581855"},"pull_request":{"href":"https://api.github.com/repos/brian-team/brian2/pulls/339"}}},"pull_request":{"url":"https://api.github.com/repos/brian-team/brian2/pulls/339","id":22348487,"html_url":"https://github.com/brian-team/brian2/pull/339","diff_url":"https://github.com/brian-team/brian2/pull/339.diff","patch_url":"https://github.com/brian-team/brian2/pull/339.patch","issue_url":"https://api.github.com/repos/brian-team/brian2/issues/339","number":339,"state":"open","locked":false,"title":"Spikegenerator","user":{"login":"yger","id":1672447,"avatar_url":"https://avatars.githubusercontent.com/u/1672447?v=2","gravatar_id":"","url":"https://api.github.com/users/yger","html_url":"https://github.com/yger","followers_url":"https://api.github.com/users/yger/followers","following_url":"https://api.github.com/users/yger/following{/other_user}","gists_url":"https://api.github.com/users/yger/gists{/gist_id}","starred_url":"https://api.github.com/users/yger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yger/subscriptions","organizations_url":"https://api.github.com/users/yger/orgs","repos_url":"https://api.github.com/users/yger/repos","events_url":"https://api.github.com/users/yger/events{/privacy}","received_events_url":"https://api.github.com/users/yger/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-10-07T12:23:28Z","updated_at":"2014-10-08T13:34:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7979ee20f57bba1d9b15a96cfd7512bbbafabb66","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/brian-team/brian2/pulls/339/commits","review_comments_url":"https://api.github.com/repos/brian-team/brian2/pulls/339/comments","review_comment_url":"https://api.github.com/repos/brian-team/brian2/pulls/comments/{number}","comments_url":"https://api.github.com/repos/brian-team/brian2/issues/339/comments","statuses_url":"https://api.github.com/repos/brian-team/brian2/statuses/0c7d029f0255d1ed77baabe7f700378462d968f5","head":{"label":"brian-team:spikegenerator","ref":"spikegenerator","sha":"0c7d029f0255d1ed77baabe7f700378462d968f5","user":{"login":"brian-team","id":2292949,"avatar_url":"https://avatars.githubusercontent.com/u/2292949?v=2","gravatar_id":"","url":"https://api.github.com/users/brian-team","html_url":"https://github.com/brian-team","followers_url":"https://api.github.com/users/brian-team/followers","following_url":"https://api.github.com/users/brian-team/following{/other_user}","gists_url":"https://api.github.com/users/brian-team/gists{/gist_id}","starred_url":"https://api.github.com/users/brian-team/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brian-team/subscriptions","organizations_url":"https://api.github.com/users/brian-team/orgs","repos_url":"https://api.github.com/users/brian-team/repos","events_url":"https://api.github.com/users/brian-team/events{/privacy}","received_events_url":"https://api.github.com/users/brian-team/received_events","type":"Organization","site_admin":false},"repo":{"id":6884056,"name":"brian2","full_name":"brian-team/brian2","owner":{"login":"brian-team","id":2292949,"avatar_url":"https://avatars.githubusercontent.com/u/2292949?v=2","gravatar_id":"","url":"https://api.github.com/users/brian-team","html_url":"https://github.com/brian-team","followers_url":"https://api.github.com/users/brian-team/followers","following_url":"https://api.github.com/users/brian-team/following{/other_user}","gists_url":"https://api.github.com/users/brian-team/gists{/gist_id}","starred_url":"https://api.github.com/users/brian-team/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brian-team/subscriptions","organizations_url":"https://api.github.com/users/brian-team/orgs","repos_url":"https://api.github.com/users/brian-team/repos","events_url":"https://api.github.com/users/brian-team/events{/privacy}","received_events_url":"https://api.github.com/users/brian-team/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/brian-team/brian2","description":"Brian2 is an improved and partly rewritten version of Brian, the spiking neural network simulator (see http://briansimulator.org). It is currently in an alpha state, ready for testing but not for \"production use\".","fork":false,"url":"https://api.github.com/repos/brian-team/brian2","forks_url":"https://api.github.com/repos/brian-team/brian2/forks","keys_url":"https://api.github.com/repos/brian-team/brian2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brian-team/brian2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brian-team/brian2/teams","hooks_url":"https://api.github.com/repos/brian-team/brian2/hooks","issue_events_url":"https://api.github.com/repos/brian-team/brian2/issues/events{/number}","events_url":"https://api.github.com/repos/brian-team/brian2/events","assignees_url":"https://api.github.com/repos/brian-team/brian2/assignees{/user}","branches_url":"https://api.github.com/repos/brian-team/brian2/branches{/branch}","tags_url":"https://api.github.com/repos/brian-team/brian2/tags","blobs_url":"https://api.github.com/repos/brian-team/brian2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brian-team/brian2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brian-team/brian2/git/refs{/sha}","trees_url":"https://api.github.com/repos/brian-team/brian2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brian-team/brian2/statuses/{sha}","languages_url":"https://api.github.com/repos/brian-team/brian2/languages","stargazers_url":"https://api.github.com/repos/brian-team/brian2/stargazers","contributors_url":"https://api.github.com/repos/brian-team/brian2/contributors","subscribers_url":"https://api.github.com/repos/brian-team/brian2/subscribers","subscription_url":"https://api.github.com/repos/brian-team/brian2/subscription","commits_url":"https://api.github.com/repos/brian-team/brian2/commits{/sha}","git_commits_url":"https://api.github.com/repos/brian-team/brian2/git/commits{/sha}","comments_url":"https://api.github.com/repos/brian-team/brian2/comments{/number}","issue_comment_url":"https://api.github.com/repos/brian-team/brian2/issues/comments/{number}","contents_url":"https://api.github.com/repos/brian-team/brian2/contents/{+path}","compare_url":"https://api.github.com/repos/brian-team/brian2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brian-team/brian2/merges","archive_url":"https://api.github.com/repos/brian-team/brian2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brian-team/brian2/downloads","issues_url":"https://api.github.com/repos/brian-team/brian2/issues{/number}","pulls_url":"https://api.github.com/repos/brian-team/brian2/pulls{/number}","milestones_url":"https://api.github.com/repos/brian-team/brian2/milestones{/number}","notifications_url":"https://api.github.com/repos/brian-team/brian2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brian-team/brian2/labels{/name}","releases_url":"https://api.github.com/repos/brian-team/brian2/releases{/id}","created_at":"2012-11-27T13:46:43Z","updated_at":"2014-09-28T20:39:31Z","pushed_at":"2014-10-08T13:21:23Z","git_url":"git://github.com/brian-team/brian2.git","ssh_url":"git@github.com:brian-team/brian2.git","clone_url":"https://github.com/brian-team/brian2.git","svn_url":"https://github.com/brian-team/brian2","homepage":"","size":17633,"stargazers_count":29,"watchers_count":29,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":86,"forks":13,"open_issues":86,"watchers":29,"default_branch":"master"}},"base":{"label":"brian-team:master","ref":"master","sha":"b7d72f1ee2a10813af057b22867f55bb3befdbc3","user":{"login":"brian-team","id":2292949,"avatar_url":"https://avatars.githubusercontent.com/u/2292949?v=2","gravatar_id":"","url":"https://api.github.com/users/brian-team","html_url":"https://github.com/brian-team","followers_url":"https://api.github.com/users/brian-team/followers","following_url":"https://api.github.com/users/brian-team/following{/other_user}","gists_url":"https://api.github.com/users/brian-team/gists{/gist_id}","starred_url":"https://api.github.com/users/brian-team/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brian-team/subscriptions","organizations_url":"https://api.github.com/users/brian-team/orgs","repos_url":"https://api.github.com/users/brian-team/repos","events_url":"https://api.github.com/users/brian-team/events{/privacy}","received_events_url":"https://api.github.com/users/brian-team/received_events","type":"Organization","site_admin":false},"repo":{"id":6884056,"name":"brian2","full_name":"brian-team/brian2","owner":{"login":"brian-team","id":2292949,"avatar_url":"https://avatars.githubusercontent.com/u/2292949?v=2","gravatar_id":"","url":"https://api.github.com/users/brian-team","html_url":"https://github.com/brian-team","followers_url":"https://api.github.com/users/brian-team/followers","following_url":"https://api.github.com/users/brian-team/following{/other_user}","gists_url":"https://api.github.com/users/brian-team/gists{/gist_id}","starred_url":"https://api.github.com/users/brian-team/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brian-team/subscriptions","organizations_url":"https://api.github.com/users/brian-team/orgs","repos_url":"https://api.github.com/users/brian-team/repos","events_url":"https://api.github.com/users/brian-team/events{/privacy}","received_events_url":"https://api.github.com/users/brian-team/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/brian-team/brian2","description":"Brian2 is an improved and partly rewritten version of Brian, the spiking neural network simulator (see http://briansimulator.org). It is currently in an alpha state, ready for testing but not for \"production use\".","fork":false,"url":"https://api.github.com/repos/brian-team/brian2","forks_url":"https://api.github.com/repos/brian-team/brian2/forks","keys_url":"https://api.github.com/repos/brian-team/brian2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brian-team/brian2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brian-team/brian2/teams","hooks_url":"https://api.github.com/repos/brian-team/brian2/hooks","issue_events_url":"https://api.github.com/repos/brian-team/brian2/issues/events{/number}","events_url":"https://api.github.com/repos/brian-team/brian2/events","assignees_url":"https://api.github.com/repos/brian-team/brian2/assignees{/user}","branches_url":"https://api.github.com/repos/brian-team/brian2/branches{/branch}","tags_url":"https://api.github.com/repos/brian-team/brian2/tags","blobs_url":"https://api.github.com/repos/brian-team/brian2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brian-team/brian2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brian-team/brian2/git/refs{/sha}","trees_url":"https://api.github.com/repos/brian-team/brian2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brian-team/brian2/statuses/{sha}","languages_url":"https://api.github.com/repos/brian-team/brian2/languages","stargazers_url":"https://api.github.com/repos/brian-team/brian2/stargazers","contributors_url":"https://api.github.com/repos/brian-team/brian2/contributors","subscribers_url":"https://api.github.com/repos/brian-team/brian2/subscribers","subscription_url":"https://api.github.com/repos/brian-team/brian2/subscription","commits_url":"https://api.github.com/repos/brian-team/brian2/commits{/sha}","git_commits_url":"https://api.github.com/repos/brian-team/brian2/git/commits{/sha}","comments_url":"https://api.github.com/repos/brian-team/brian2/comments{/number}","issue_comment_url":"https://api.github.com/repos/brian-team/brian2/issues/comments/{number}","contents_url":"https://api.github.com/repos/brian-team/brian2/contents/{+path}","compare_url":"https://api.github.com/repos/brian-team/brian2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brian-team/brian2/merges","archive_url":"https://api.github.com/repos/brian-team/brian2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brian-team/brian2/downloads","issues_url":"https://api.github.com/repos/brian-team/brian2/issues{/number}","pulls_url":"https://api.github.com/repos/brian-team/brian2/pulls{/number}","milestones_url":"https://api.github.com/repos/brian-team/brian2/milestones{/number}","notifications_url":"https://api.github.com/repos/brian-team/brian2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brian-team/brian2/labels{/name}","releases_url":"https://api.github.com/repos/brian-team/brian2/releases{/id}","created_at":"2012-11-27T13:46:43Z","updated_at":"2014-09-28T20:39:31Z","pushed_at":"2014-10-08T13:21:23Z","git_url":"git://github.com/brian-team/brian2.git","ssh_url":"git@github.com:brian-team/brian2.git","clone_url":"https://github.com/brian-team/brian2.git","svn_url":"https://github.com/brian-team/brian2","homepage":"","size":17633,"stargazers_count":29,"watchers_count":29,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":86,"forks":13,"open_issues":86,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/brian-team/brian2/pulls/339"},"html":{"href":"https://github.com/brian-team/brian2/pull/339"},"issue":{"href":"https://api.github.com/repos/brian-team/brian2/issues/339"},"comments":{"href":"https://api.github.com/repos/brian-team/brian2/issues/339/comments"},"review_comments":{"href":"https://api.github.com/repos/brian-team/brian2/pulls/339/comments"},"review_comment":{"href":"https://api.github.com/repos/brian-team/brian2/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/brian-team/brian2/pulls/339/commits"},"statuses":{"href":"https://api.github.com/repos/brian-team/brian2/statuses/0c7d029f0255d1ed77baabe7f700378462d968f5"}}}}