{"action":"created","comment":{"url":"https://api.github.com/repos/NeuroVault/NeuroVault/pulls/comments/66417479","id":66417479,"diff_hunk":"@@ -0,0 +1,104 @@\n+from django.core.management.base import BaseCommand, CommandError\n+from neurovault.apps.statmaps.tests.utils import clearDB\n+from neurovault.apps.statmaps.models import Comparison, Similarity, User, Collection, Image\n+from neurovault.apps.statmaps.utils import get_existing_comparisons\n+from neurovault.apps.statmaps.tests.utils import  save_statmap_form\n+\n+import os\n+import gc\n+import timeit\n+import numpy as np\n+\n+class Timer:\n+    def __init__(self, timer=None, disable_gc=False, verbose=True):\n+        if timer is None:\n+            timer = timeit.default_timer\n+        self.timer = timer\n+        self.disable_gc = disable_gc\n+        self.verbose = verbose\n+        self.start = self.end = self.interval = None\n+    def __enter__(self):\n+        if self.disable_gc:\n+            self.gc_state = gc.isenabled()\n+            gc.disable()\n+        self.start = self.timer()\n+        return self\n+    def __exit__(self, *args):\n+        self.end = self.timer()\n+        if self.disable_gc and self.gc_state:\n+            gc.enable()\n+        self.interval = self.end - self.start\n+        if self.verbose:\n+            print('time taken: %f seconds' % self.interval)\n+\n+class Command(BaseCommand):\n+    args = '<times_to_run>'\n+    help = 'bench'\n+\n+    def handle(self, *args, **options):\n+        # TODO: check if /bench folder exists. If not, donwload the full dataset.","path":"neurovault/apps/statmaps/management/commands/benchmark.py","position":39,"original_position":39,"commit_id":"6465933bf16cff0d45dd02d67876a3cc8e4efedf","original_commit_id":"6465933bf16cff0d45dd02d67876a3cc8e4efedf","user":{"login":"chrisfilo","id":238759,"avatar_url":"https://avatars.githubusercontent.com/u/238759?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisfilo","html_url":"https://github.com/chrisfilo","followers_url":"https://api.github.com/users/chrisfilo/followers","following_url":"https://api.github.com/users/chrisfilo/following{/other_user}","gists_url":"https://api.github.com/users/chrisfilo/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisfilo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisfilo/subscriptions","organizations_url":"https://api.github.com/users/chrisfilo/orgs","repos_url":"https://api.github.com/users/chrisfilo/repos","events_url":"https://api.github.com/users/chrisfilo/events{/privacy}","received_events_url":"https://api.github.com/users/chrisfilo/received_events","type":"User","site_admin":false},"body":"You can also consider uploading a tarball with benchmark maps on figshare\nOn Jun 9, 2016 12:29 PM, \"Asier Erramuzpe\" <notifications@github.com> wrote:\n\n> In neurovault/apps/statmaps/management/commands/benchmark.py\n> <https://github.com/NeuroVault/NeuroVault/pull/517#discussion_r66417216>:\n>\n> > +        self.start = self.timer()\n> > +        return self\n> > +    def __exit__(self, *args):\n> > +        self.end = self.timer()\n> > +        if self.disable_gc and self.gc_state:\n> > +            gc.enable()\n> > +        self.interval = self.end - self.start\n> > +        if self.verbose:\n> > +            print('time taken: %f seconds' % self.interval)\n> > +\n> > +class Command(BaseCommand):\n> > +    args = '<times_to_run>'\n> > +    help = 'bench'\n> > +\n> > +    def handle(self, *args, **options):\n> > +        # TODO: check if /bench folder exists. If not, donwload the full dataset.\n>\n> Ok, I will take a look into it and see how to manage.\n>\n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/NeuroVault/NeuroVault/pull/517/files/6465933bf16cff0d45dd02d67876a3cc8e4efedf#r66417216>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe/AAOkp-8-ttHbnyYxDqw8bFhhN1Rf6l49ks5qJ-r3gaJpZM4IqvB2>\n> .\n>\n","created_at":"2016-06-09T10:31:33Z","updated_at":"2016-06-09T10:31:33Z","html_url":"https://github.com/NeuroVault/NeuroVault/pull/517#discussion_r66417479","pull_request_url":"https://api.github.com/repos/NeuroVault/NeuroVault/pulls/517","_links":{"self":{"href":"https://api.github.com/repos/NeuroVault/NeuroVault/pulls/comments/66417479"},"html":{"href":"https://github.com/NeuroVault/NeuroVault/pull/517#discussion_r66417479"},"pull_request":{"href":"https://api.github.com/repos/NeuroVault/NeuroVault/pulls/517"}}},"pull_request":{"url":"https://api.github.com/repos/NeuroVault/NeuroVault/pulls/517","id":72049231,"html_url":"https://github.com/NeuroVault/NeuroVault/pull/517","diff_url":"https://github.com/NeuroVault/NeuroVault/pull/517.diff","patch_url":"https://github.com/NeuroVault/NeuroVault/pull/517.patch","issue_url":"https://api.github.com/repos/NeuroVault/NeuroVault/issues/517","number":517,"state":"open","locked":false,"title":"[WIP] Benchmark commands","user":{"login":"erramuzpe","id":6176948,"avatar_url":"https://avatars.githubusercontent.com/u/6176948?v=3","gravatar_id":"","url":"https://api.github.com/users/erramuzpe","html_url":"https://github.com/erramuzpe","followers_url":"https://api.github.com/users/erramuzpe/followers","following_url":"https://api.github.com/users/erramuzpe/following{/other_user}","gists_url":"https://api.github.com/users/erramuzpe/gists{/gist_id}","starred_url":"https://api.github.com/users/erramuzpe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erramuzpe/subscriptions","organizations_url":"https://api.github.com/users/erramuzpe/orgs","repos_url":"https://api.github.com/users/erramuzpe/repos","events_url":"https://api.github.com/users/erramuzpe/events{/privacy}","received_events_url":"https://api.github.com/users/erramuzpe/received_events","type":"User","site_admin":false},"body":"Some benchmark commands. I will merge all them together and allow different functionality using arguments. I will start doing this tomorrow.","created_at":"2016-05-31T16:49:56Z","updated_at":"2016-06-09T10:31:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"408c447b28fca830530c8908ca85667f78279d6c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/NeuroVault/NeuroVault/pulls/517/commits","review_comments_url":"https://api.github.com/repos/NeuroVault/NeuroVault/pulls/517/comments","review_comment_url":"https://api.github.com/repos/NeuroVault/NeuroVault/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NeuroVault/NeuroVault/issues/517/comments","statuses_url":"https://api.github.com/repos/NeuroVault/NeuroVault/statuses/6465933bf16cff0d45dd02d67876a3cc8e4efedf","head":{"label":"erramuzpe:benchmark_test","ref":"benchmark_test","sha":"6465933bf16cff0d45dd02d67876a3cc8e4efedf","user":{"login":"erramuzpe","id":6176948,"avatar_url":"https://avatars.githubusercontent.com/u/6176948?v=3","gravatar_id":"","url":"https://api.github.com/users/erramuzpe","html_url":"https://github.com/erramuzpe","followers_url":"https://api.github.com/users/erramuzpe/followers","following_url":"https://api.github.com/users/erramuzpe/following{/other_user}","gists_url":"https://api.github.com/users/erramuzpe/gists{/gist_id}","starred_url":"https://api.github.com/users/erramuzpe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erramuzpe/subscriptions","organizations_url":"https://api.github.com/users/erramuzpe/orgs","repos_url":"https://api.github.com/users/erramuzpe/repos","events_url":"https://api.github.com/users/erramuzpe/events{/privacy}","received_events_url":"https://api.github.com/users/erramuzpe/received_events","type":"User","site_admin":false},"repo":{"id":53396585,"name":"NeuroVault","full_name":"erramuzpe/NeuroVault","owner":{"login":"erramuzpe","id":6176948,"avatar_url":"https://avatars.githubusercontent.com/u/6176948?v=3","gravatar_id":"","url":"https://api.github.com/users/erramuzpe","html_url":"https://github.com/erramuzpe","followers_url":"https://api.github.com/users/erramuzpe/followers","following_url":"https://api.github.com/users/erramuzpe/following{/other_user}","gists_url":"https://api.github.com/users/erramuzpe/gists{/gist_id}","starred_url":"https://api.github.com/users/erramuzpe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erramuzpe/subscriptions","organizations_url":"https://api.github.com/users/erramuzpe/orgs","repos_url":"https://api.github.com/users/erramuzpe/repos","events_url":"https://api.github.com/users/erramuzpe/events{/privacy}","received_events_url":"https://api.github.com/users/erramuzpe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/erramuzpe/NeuroVault","description":"Easy to use web database for statistical maps.","fork":true,"url":"https://api.github.com/repos/erramuzpe/NeuroVault","forks_url":"https://api.github.com/repos/erramuzpe/NeuroVault/forks","keys_url":"https://api.github.com/repos/erramuzpe/NeuroVault/keys{/key_id}","collaborators_url":"https://api.github.com/repos/erramuzpe/NeuroVault/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/erramuzpe/NeuroVault/teams","hooks_url":"https://api.github.com/repos/erramuzpe/NeuroVault/hooks","issue_events_url":"https://api.github.com/repos/erramuzpe/NeuroVault/issues/events{/number}","events_url":"https://api.github.com/repos/erramuzpe/NeuroVault/events","assignees_url":"https://api.github.com/repos/erramuzpe/NeuroVault/assignees{/user}","branches_url":"https://api.github.com/repos/erramuzpe/NeuroVault/branches{/branch}","tags_url":"https://api.github.com/repos/erramuzpe/NeuroVault/tags","blobs_url":"https://api.github.com/repos/erramuzpe/NeuroVault/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/erramuzpe/NeuroVault/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/erramuzpe/NeuroVault/git/refs{/sha}","trees_url":"https://api.github.com/repos/erramuzpe/NeuroVault/git/trees{/sha}","statuses_url":"https://api.github.com/repos/erramuzpe/NeuroVault/statuses/{sha}","languages_url":"https://api.github.com/repos/erramuzpe/NeuroVault/languages","stargazers_url":"https://api.github.com/repos/erramuzpe/NeuroVault/stargazers","contributors_url":"https://api.github.com/repos/erramuzpe/NeuroVault/contributors","subscribers_url":"https://api.github.com/repos/erramuzpe/NeuroVault/subscribers","subscription_url":"https://api.github.com/repos/erramuzpe/NeuroVault/subscription","commits_url":"https://api.github.com/repos/erramuzpe/NeuroVault/commits{/sha}","git_commits_url":"https://api.github.com/repos/erramuzpe/NeuroVault/git/commits{/sha}","comments_url":"https://api.github.com/repos/erramuzpe/NeuroVault/comments{/number}","issue_comment_url":"https://api.github.com/repos/erramuzpe/NeuroVault/issues/comments{/number}","contents_url":"https://api.github.com/repos/erramuzpe/NeuroVault/contents/{+path}","compare_url":"https://api.github.com/repos/erramuzpe/NeuroVault/compare/{base}...{head}","merges_url":"https://api.github.com/repos/erramuzpe/NeuroVault/merges","archive_url":"https://api.github.com/repos/erramuzpe/NeuroVault/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/erramuzpe/NeuroVault/downloads","issues_url":"https://api.github.com/repos/erramuzpe/NeuroVault/issues{/number}","pulls_url":"https://api.github.com/repos/erramuzpe/NeuroVault/pulls{/number}","milestones_url":"https://api.github.com/repos/erramuzpe/NeuroVault/milestones{/number}","notifications_url":"https://api.github.com/repos/erramuzpe/NeuroVault/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/erramuzpe/NeuroVault/labels{/name}","releases_url":"https://api.github.com/repos/erramuzpe/NeuroVault/releases{/id}","deployments_url":"https://api.github.com/repos/erramuzpe/NeuroVault/deployments","created_at":"2016-03-08T08:44:23Z","updated_at":"2016-03-08T08:44:25Z","pushed_at":"2016-06-09T09:46:58Z","git_url":"git://github.com/erramuzpe/NeuroVault.git","ssh_url":"git@github.com:erramuzpe/NeuroVault.git","clone_url":"https://github.com/erramuzpe/NeuroVault.git","svn_url":"https://github.com/erramuzpe/NeuroVault","homepage":"neurovault.org","size":82793,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"NeuroVault:master","ref":"master","sha":"aa359a4b4cb768c7378c529853fc9b74a9a49166","user":{"login":"NeuroVault","id":9168649,"avatar_url":"https://avatars.githubusercontent.com/u/9168649?v=3","gravatar_id":"","url":"https://api.github.com/users/NeuroVault","html_url":"https://github.com/NeuroVault","followers_url":"https://api.github.com/users/NeuroVault/followers","following_url":"https://api.github.com/users/NeuroVault/following{/other_user}","gists_url":"https://api.github.com/users/NeuroVault/gists{/gist_id}","starred_url":"https://api.github.com/users/NeuroVault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NeuroVault/subscriptions","organizations_url":"https://api.github.com/users/NeuroVault/orgs","repos_url":"https://api.github.com/users/NeuroVault/repos","events_url":"https://api.github.com/users/NeuroVault/events{/privacy}","received_events_url":"https://api.github.com/users/NeuroVault/received_events","type":"Organization","site_admin":false},"repo":{"id":7963570,"name":"NeuroVault","full_name":"NeuroVault/NeuroVault","owner":{"login":"NeuroVault","id":9168649,"avatar_url":"https://avatars.githubusercontent.com/u/9168649?v=3","gravatar_id":"","url":"https://api.github.com/users/NeuroVault","html_url":"https://github.com/NeuroVault","followers_url":"https://api.github.com/users/NeuroVault/followers","following_url":"https://api.github.com/users/NeuroVault/following{/other_user}","gists_url":"https://api.github.com/users/NeuroVault/gists{/gist_id}","starred_url":"https://api.github.com/users/NeuroVault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NeuroVault/subscriptions","organizations_url":"https://api.github.com/users/NeuroVault/orgs","repos_url":"https://api.github.com/users/NeuroVault/repos","events_url":"https://api.github.com/users/NeuroVault/events{/privacy}","received_events_url":"https://api.github.com/users/NeuroVault/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NeuroVault/NeuroVault","description":"Easy to use web database for statistical maps.","fork":false,"url":"https://api.github.com/repos/NeuroVault/NeuroVault","forks_url":"https://api.github.com/repos/NeuroVault/NeuroVault/forks","keys_url":"https://api.github.com/repos/NeuroVault/NeuroVault/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NeuroVault/NeuroVault/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NeuroVault/NeuroVault/teams","hooks_url":"https://api.github.com/repos/NeuroVault/NeuroVault/hooks","issue_events_url":"https://api.github.com/repos/NeuroVault/NeuroVault/issues/events{/number}","events_url":"https://api.github.com/repos/NeuroVault/NeuroVault/events","assignees_url":"https://api.github.com/repos/NeuroVault/NeuroVault/assignees{/user}","branches_url":"https://api.github.com/repos/NeuroVault/NeuroVault/branches{/branch}","tags_url":"https://api.github.com/repos/NeuroVault/NeuroVault/tags","blobs_url":"https://api.github.com/repos/NeuroVault/NeuroVault/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NeuroVault/NeuroVault/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NeuroVault/NeuroVault/git/refs{/sha}","trees_url":"https://api.github.com/repos/NeuroVault/NeuroVault/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NeuroVault/NeuroVault/statuses/{sha}","languages_url":"https://api.github.com/repos/NeuroVault/NeuroVault/languages","stargazers_url":"https://api.github.com/repos/NeuroVault/NeuroVault/stargazers","contributors_url":"https://api.github.com/repos/NeuroVault/NeuroVault/contributors","subscribers_url":"https://api.github.com/repos/NeuroVault/NeuroVault/subscribers","subscription_url":"https://api.github.com/repos/NeuroVault/NeuroVault/subscription","commits_url":"https://api.github.com/repos/NeuroVault/NeuroVault/commits{/sha}","git_commits_url":"https://api.github.com/repos/NeuroVault/NeuroVault/git/commits{/sha}","comments_url":"https://api.github.com/repos/NeuroVault/NeuroVault/comments{/number}","issue_comment_url":"https://api.github.com/repos/NeuroVault/NeuroVault/issues/comments{/number}","contents_url":"https://api.github.com/repos/NeuroVault/NeuroVault/contents/{+path}","compare_url":"https://api.github.com/repos/NeuroVault/NeuroVault/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NeuroVault/NeuroVault/merges","archive_url":"https://api.github.com/repos/NeuroVault/NeuroVault/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NeuroVault/NeuroVault/downloads","issues_url":"https://api.github.com/repos/NeuroVault/NeuroVault/issues{/number}","pulls_url":"https://api.github.com/repos/NeuroVault/NeuroVault/pulls{/number}","milestones_url":"https://api.github.com/repos/NeuroVault/NeuroVault/milestones{/number}","notifications_url":"https://api.github.com/repos/NeuroVault/NeuroVault/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NeuroVault/NeuroVault/labels{/name}","releases_url":"https://api.github.com/repos/NeuroVault/NeuroVault/releases{/id}","deployments_url":"https://api.github.com/repos/NeuroVault/NeuroVault/deployments","created_at":"2013-02-01T18:25:43Z","updated_at":"2016-05-02T15:26:44Z","pushed_at":"2016-06-09T10:11:28Z","git_url":"git://github.com/NeuroVault/NeuroVault.git","ssh_url":"git@github.com:NeuroVault/NeuroVault.git","clone_url":"https://github.com/NeuroVault/NeuroVault.git","svn_url":"https://github.com/NeuroVault/NeuroVault","homepage":"neurovault.org","size":148397,"stargazers_count":38,"watchers_count":38,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":38,"mirror_url":null,"open_issues_count":70,"forks":38,"open_issues":70,"watchers":38,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NeuroVault/NeuroVault/pulls/517"},"html":{"href":"https://github.com/NeuroVault/NeuroVault/pull/517"},"issue":{"href":"https://api.github.com/repos/NeuroVault/NeuroVault/issues/517"},"comments":{"href":"https://api.github.com/repos/NeuroVault/NeuroVault/issues/517/comments"},"review_comments":{"href":"https://api.github.com/repos/NeuroVault/NeuroVault/pulls/517/comments"},"review_comment":{"href":"https://api.github.com/repos/NeuroVault/NeuroVault/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NeuroVault/NeuroVault/pulls/517/commits"},"statuses":{"href":"https://api.github.com/repos/NeuroVault/NeuroVault/statuses/6465933bf16cff0d45dd02d67876a3cc8e4efedf"}}}}
{"actor":{"display_login":"chrisfilo"}}