{"action":"opened","number":1792,"pull_request":{"url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1792","id":52218780,"html_url":"https://github.com/scikit-image/scikit-image/pull/1792","diff_url":"https://github.com/scikit-image/scikit-image/pull/1792.diff","patch_url":"https://github.com/scikit-image/scikit-image/pull/1792.patch","issue_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/1792","number":1792,"state":"open","locked":false,"title":"Uses fftconvolve instead of convolve2d for speedups","user":{"login":"scottsievert","id":1320475,"avatar_url":"https://avatars.githubusercontent.com/u/1320475?v=3","gravatar_id":"","url":"https://api.github.com/users/scottsievert","html_url":"https://github.com/scottsievert","followers_url":"https://api.github.com/users/scottsievert/followers","following_url":"https://api.github.com/users/scottsievert/following{/other_user}","gists_url":"https://api.github.com/users/scottsievert/gists{/gist_id}","starred_url":"https://api.github.com/users/scottsievert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottsievert/subscriptions","organizations_url":"https://api.github.com/users/scottsievert/orgs","repos_url":"https://api.github.com/users/scottsievert/repos","events_url":"https://api.github.com/users/scottsievert/events{/privacy}","received_events_url":"https://api.github.com/users/scottsievert/received_events","type":"User","site_admin":false},"body":"This pull request uses [`scipy.signal.fftconvolve`] instead of [`scipy.signal.convolve2d`] in skimage/restoration/deconvolution.py. These are equivalent functions, as noted in [this StackOverflow answer] but `fftconvolve` is much faster. Quoting the documentation page for fftconvolve,\r\n\r\n> This is generally much faster than convolve for large arrays (n > ~500)\r\n\r\nThis function change gives equivalent results (up a to a machine epsilon) as indicated by the test below:\r\n\r\n[this StackOverflow answer]:http://stackoverflow.com/a/1768140/1141256\r\n\r\n```python\r\nfrom scipy.signal import convolve2d, fftconvolve\r\nimport numpy as np\r\n\r\nN, m = 1e3, 10\r\nnp.random.seed(42)\r\nx = np.random.randn(int(N), int(N))\r\nh = np.ones((m, m)) / m**2\r\n\r\ny1 = convolve2d(x, h, mode='same')\r\ny2 = fftconvolve(x, h, mode='same')\r\n\r\nassert np.allclose(y1, y2)\r\n\r\nprint(\"{:0.4e}\".format(np.max(np.abs(y1 - y2)))) # prints 1.7876e-15\r\n```\r\n\r\nWhen I use `N = 1e3`, I see speedups of roughly 6x.\r\n\r\n[`scipy.signal.fftconvolve`]:http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.fftconvolve.html#scipy.signal.fftconvolve\r\n[`scipy.signal.convolve2d`]:http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.convolve2d.html#scipy.signal.convolve2d","created_at":"2015-12-01T05:47:39Z","updated_at":"2015-12-01T05:47:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1792/commits","review_comments_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1792/comments","review_comment_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/1792/comments","statuses_url":"https://api.github.com/repos/scikit-image/scikit-image/statuses/5aabc199aa1ad32147bf7a37122725bce7a821c0","head":{"label":"scottsievert:fftconvolve","ref":"fftconvolve","sha":"5aabc199aa1ad32147bf7a37122725bce7a821c0","user":{"login":"scottsievert","id":1320475,"avatar_url":"https://avatars.githubusercontent.com/u/1320475?v=3","gravatar_id":"","url":"https://api.github.com/users/scottsievert","html_url":"https://github.com/scottsievert","followers_url":"https://api.github.com/users/scottsievert/followers","following_url":"https://api.github.com/users/scottsievert/following{/other_user}","gists_url":"https://api.github.com/users/scottsievert/gists{/gist_id}","starred_url":"https://api.github.com/users/scottsievert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottsievert/subscriptions","organizations_url":"https://api.github.com/users/scottsievert/orgs","repos_url":"https://api.github.com/users/scottsievert/repos","events_url":"https://api.github.com/users/scottsievert/events{/privacy}","received_events_url":"https://api.github.com/users/scottsievert/received_events","type":"User","site_admin":false},"repo":{"id":47167158,"name":"scikit-image","full_name":"scottsievert/scikit-image","owner":{"login":"scottsievert","id":1320475,"avatar_url":"https://avatars.githubusercontent.com/u/1320475?v=3","gravatar_id":"","url":"https://api.github.com/users/scottsievert","html_url":"https://github.com/scottsievert","followers_url":"https://api.github.com/users/scottsievert/followers","following_url":"https://api.github.com/users/scottsievert/following{/other_user}","gists_url":"https://api.github.com/users/scottsievert/gists{/gist_id}","starred_url":"https://api.github.com/users/scottsievert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottsievert/subscriptions","organizations_url":"https://api.github.com/users/scottsievert/orgs","repos_url":"https://api.github.com/users/scottsievert/repos","events_url":"https://api.github.com/users/scottsievert/events{/privacy}","received_events_url":"https://api.github.com/users/scottsievert/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/scottsievert/scikit-image","description":"Image Processing SciKit (Toolbox for SciPy)","fork":true,"url":"https://api.github.com/repos/scottsievert/scikit-image","forks_url":"https://api.github.com/repos/scottsievert/scikit-image/forks","keys_url":"https://api.github.com/repos/scottsievert/scikit-image/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scottsievert/scikit-image/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scottsievert/scikit-image/teams","hooks_url":"https://api.github.com/repos/scottsievert/scikit-image/hooks","issue_events_url":"https://api.github.com/repos/scottsievert/scikit-image/issues/events{/number}","events_url":"https://api.github.com/repos/scottsievert/scikit-image/events","assignees_url":"https://api.github.com/repos/scottsievert/scikit-image/assignees{/user}","branches_url":"https://api.github.com/repos/scottsievert/scikit-image/branches{/branch}","tags_url":"https://api.github.com/repos/scottsievert/scikit-image/tags","blobs_url":"https://api.github.com/repos/scottsievert/scikit-image/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scottsievert/scikit-image/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scottsievert/scikit-image/git/refs{/sha}","trees_url":"https://api.github.com/repos/scottsievert/scikit-image/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scottsievert/scikit-image/statuses/{sha}","languages_url":"https://api.github.com/repos/scottsievert/scikit-image/languages","stargazers_url":"https://api.github.com/repos/scottsievert/scikit-image/stargazers","contributors_url":"https://api.github.com/repos/scottsievert/scikit-image/contributors","subscribers_url":"https://api.github.com/repos/scottsievert/scikit-image/subscribers","subscription_url":"https://api.github.com/repos/scottsievert/scikit-image/subscription","commits_url":"https://api.github.com/repos/scottsievert/scikit-image/commits{/sha}","git_commits_url":"https://api.github.com/repos/scottsievert/scikit-image/git/commits{/sha}","comments_url":"https://api.github.com/repos/scottsievert/scikit-image/comments{/number}","issue_comment_url":"https://api.github.com/repos/scottsievert/scikit-image/issues/comments{/number}","contents_url":"https://api.github.com/repos/scottsievert/scikit-image/contents/{+path}","compare_url":"https://api.github.com/repos/scottsievert/scikit-image/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scottsievert/scikit-image/merges","archive_url":"https://api.github.com/repos/scottsievert/scikit-image/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scottsievert/scikit-image/downloads","issues_url":"https://api.github.com/repos/scottsievert/scikit-image/issues{/number}","pulls_url":"https://api.github.com/repos/scottsievert/scikit-image/pulls{/number}","milestones_url":"https://api.github.com/repos/scottsievert/scikit-image/milestones{/number}","notifications_url":"https://api.github.com/repos/scottsievert/scikit-image/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scottsievert/scikit-image/labels{/name}","releases_url":"https://api.github.com/repos/scottsievert/scikit-image/releases{/id}","created_at":"2015-12-01T05:14:02Z","updated_at":"2015-12-01T05:14:06Z","pushed_at":"2015-12-01T05:25:56Z","git_url":"git://github.com/scottsievert/scikit-image.git","ssh_url":"git@github.com:scottsievert/scikit-image.git","clone_url":"https://github.com/scottsievert/scikit-image.git","svn_url":"https://github.com/scottsievert/scikit-image","homepage":"http://scikit-image.org","size":39763,"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":"scikit-image:master","ref":"master","sha":"3b525987f59ecf9ec6a91bed8cedde81a2af21e0","user":{"login":"scikit-image","id":897180,"avatar_url":"https://avatars.githubusercontent.com/u/897180?v=3","gravatar_id":"","url":"https://api.github.com/users/scikit-image","html_url":"https://github.com/scikit-image","followers_url":"https://api.github.com/users/scikit-image/followers","following_url":"https://api.github.com/users/scikit-image/following{/other_user}","gists_url":"https://api.github.com/users/scikit-image/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-image/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-image/subscriptions","organizations_url":"https://api.github.com/users/scikit-image/orgs","repos_url":"https://api.github.com/users/scikit-image/repos","events_url":"https://api.github.com/users/scikit-image/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-image/received_events","type":"Organization","site_admin":false},"repo":{"id":2014929,"name":"scikit-image","full_name":"scikit-image/scikit-image","owner":{"login":"scikit-image","id":897180,"avatar_url":"https://avatars.githubusercontent.com/u/897180?v=3","gravatar_id":"","url":"https://api.github.com/users/scikit-image","html_url":"https://github.com/scikit-image","followers_url":"https://api.github.com/users/scikit-image/followers","following_url":"https://api.github.com/users/scikit-image/following{/other_user}","gists_url":"https://api.github.com/users/scikit-image/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-image/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-image/subscriptions","organizations_url":"https://api.github.com/users/scikit-image/orgs","repos_url":"https://api.github.com/users/scikit-image/repos","events_url":"https://api.github.com/users/scikit-image/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-image/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scikit-image/scikit-image","description":"Image Processing SciKit (Toolbox for SciPy)","fork":false,"url":"https://api.github.com/repos/scikit-image/scikit-image","forks_url":"https://api.github.com/repos/scikit-image/scikit-image/forks","keys_url":"https://api.github.com/repos/scikit-image/scikit-image/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scikit-image/scikit-image/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scikit-image/scikit-image/teams","hooks_url":"https://api.github.com/repos/scikit-image/scikit-image/hooks","issue_events_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/events{/number}","events_url":"https://api.github.com/repos/scikit-image/scikit-image/events","assignees_url":"https://api.github.com/repos/scikit-image/scikit-image/assignees{/user}","branches_url":"https://api.github.com/repos/scikit-image/scikit-image/branches{/branch}","tags_url":"https://api.github.com/repos/scikit-image/scikit-image/tags","blobs_url":"https://api.github.com/repos/scikit-image/scikit-image/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scikit-image/scikit-image/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scikit-image/scikit-image/git/refs{/sha}","trees_url":"https://api.github.com/repos/scikit-image/scikit-image/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scikit-image/scikit-image/statuses/{sha}","languages_url":"https://api.github.com/repos/scikit-image/scikit-image/languages","stargazers_url":"https://api.github.com/repos/scikit-image/scikit-image/stargazers","contributors_url":"https://api.github.com/repos/scikit-image/scikit-image/contributors","subscribers_url":"https://api.github.com/repos/scikit-image/scikit-image/subscribers","subscription_url":"https://api.github.com/repos/scikit-image/scikit-image/subscription","commits_url":"https://api.github.com/repos/scikit-image/scikit-image/commits{/sha}","git_commits_url":"https://api.github.com/repos/scikit-image/scikit-image/git/commits{/sha}","comments_url":"https://api.github.com/repos/scikit-image/scikit-image/comments{/number}","issue_comment_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/comments{/number}","contents_url":"https://api.github.com/repos/scikit-image/scikit-image/contents/{+path}","compare_url":"https://api.github.com/repos/scikit-image/scikit-image/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scikit-image/scikit-image/merges","archive_url":"https://api.github.com/repos/scikit-image/scikit-image/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scikit-image/scikit-image/downloads","issues_url":"https://api.github.com/repos/scikit-image/scikit-image/issues{/number}","pulls_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls{/number}","milestones_url":"https://api.github.com/repos/scikit-image/scikit-image/milestones{/number}","notifications_url":"https://api.github.com/repos/scikit-image/scikit-image/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scikit-image/scikit-image/labels{/name}","releases_url":"https://api.github.com/repos/scikit-image/scikit-image/releases{/id}","created_at":"2011-07-07T22:07:20Z","updated_at":"2015-11-30T15:21:51Z","pushed_at":"2015-12-01T05:47:39Z","git_url":"git://github.com/scikit-image/scikit-image.git","ssh_url":"git@github.com:scikit-image/scikit-image.git","clone_url":"https://github.com/scikit-image/scikit-image.git","svn_url":"https://github.com/scikit-image/scikit-image","homepage":"http://scikit-image.org","size":65112,"stargazers_count":891,"watchers_count":891,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":451,"mirror_url":null,"open_issues_count":244,"forks":451,"open_issues":244,"watchers":891,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1792"},"html":{"href":"https://github.com/scikit-image/scikit-image/pull/1792"},"issue":{"href":"https://api.github.com/repos/scikit-image/scikit-image/issues/1792"},"comments":{"href":"https://api.github.com/repos/scikit-image/scikit-image/issues/1792/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1792/comments"},"review_comment":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1792/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-image/scikit-image/statuses/5aabc199aa1ad32147bf7a37122725bce7a821c0"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":3,"deletions":3,"changed_files":1}}