{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/comments/80003744","id":80003744,"diff_hunk":"@@ -0,0 +1,286 @@\n+\"\"\" Scattering transform code licensed under\n+    BSD license.\n+    Original author: Sira Ferradans, based on a code developed by\n+    Ivan Dokmanic and Michael Eickenberg\n+\"\"\"\n+import numpy as np\n+from skimage._shared.utils import assert_nD\n+from skimage.filters.filter_bank import multiresolution_filter_bank_morlet2d\n+import warnings\n+\n+\n+def _apply_fourier_mult(signals, filters):\n+    \"\"\"Spatial subsampling on the last two dimensions of X at a\n+    rate that depends on 2**j.\n+        Parameters\n+        ----------\n+        signals: ndarray (3D)\n+            Signals in the Fourier domain stacked as (num_signals, N,N).\n+            Note that color images can be stacked as 'num_signals'.\n+        filters: ndarray (3D)\n+            Filters in the Fourier domain, stacked as (L,N,N) where\n+            L is the num. of filters to apply\n+        Returns\n+        -------\n+        filtered_signals : ndarray\n+            Filtered signals in the Fourier domain,\n+            stacked as (num_signals,L,N,N)\n+        \"\"\"\n+    filtered_s = signals[:, np.newaxis, :, :]*filters[np.newaxis, :, :, :]","path":"skimage/feature/scattering.py","position":33,"original_position":29,"commit_id":"00ee0354f7b2c634a8984dc0a8adb3bd36aa26a0","original_commit_id":"fa43f94c78199718cf24a5833143d9006e8a47c2","user":{"login":"eickenberg","id":1306635,"avatar_url":"https://avatars.githubusercontent.com/u/1306635?v=3","gravatar_id":"","url":"https://api.github.com/users/eickenberg","html_url":"https://github.com/eickenberg","followers_url":"https://api.github.com/users/eickenberg/followers","following_url":"https://api.github.com/users/eickenberg/following{/other_user}","gists_url":"https://api.github.com/users/eickenberg/gists{/gist_id}","starred_url":"https://api.github.com/users/eickenberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eickenberg/subscriptions","organizations_url":"https://api.github.com/users/eickenberg/orgs","repos_url":"https://api.github.com/users/eickenberg/repos","events_url":"https://api.github.com/users/eickenberg/events{/privacy}","received_events_url":"https://api.github.com/users/eickenberg/received_events","type":"User","site_admin":false},"body":"OK, good. Can you put spaces around the multiplication operator?","created_at":"2016-09-22T09:26:47Z","updated_at":"2016-09-22T09:26:47Z","html_url":"https://github.com/scikit-image/scikit-image/pull/2300#discussion_r80003744","pull_request_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/2300","_links":{"self":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/comments/80003744"},"html":{"href":"https://github.com/scikit-image/scikit-image/pull/2300#discussion_r80003744"},"pull_request":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/2300"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/2300","id":84874034,"html_url":"https://github.com/scikit-image/scikit-image/pull/2300","diff_url":"https://github.com/scikit-image/scikit-image/pull/2300.diff","patch_url":"https://github.com/scikit-image/scikit-image/pull/2300.patch","issue_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/2300","number":2300,"state":"open","locked":false,"title":"Add scattering transform","user":{"login":"siraferradans","id":6280654,"avatar_url":"https://avatars.githubusercontent.com/u/6280654?v=3","gravatar_id":"","url":"https://api.github.com/users/siraferradans","html_url":"https://github.com/siraferradans","followers_url":"https://api.github.com/users/siraferradans/followers","following_url":"https://api.github.com/users/siraferradans/following{/other_user}","gists_url":"https://api.github.com/users/siraferradans/gists{/gist_id}","starred_url":"https://api.github.com/users/siraferradans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siraferradans/subscriptions","organizations_url":"https://api.github.com/users/siraferradans/orgs","repos_url":"https://api.github.com/users/siraferradans/repos","events_url":"https://api.github.com/users/siraferradans/events{/privacy}","received_events_url":"https://api.github.com/users/siraferradans/received_events","type":"User","site_admin":false},"body":"## Description\r\nThis is a re-pull request for the scattering transform, that I did 4 days ago (#2295). Following the indications of @sciunto (as far as I could), I am re-summiting the code with just the new files (scattering.py, filter_bank.py) and its examples (plot_scattering_classification.py, plot_scattering.py, plot_multiresolution_filterbank.py). For completeness, I am copying the text I put in the previous pull request:  \r\n\r\nI have implemented the scattering transform to be applied to images. This scattering transform needs a multiresolution wavelet filter, thus you can also find this new functionality. There are three new examples that show how to use the scattering transform (how to create it and access it), how to use it for classification, and how to use the multiresolution filters implemented.\r\n\r\n\r\n## Checklist\r\n[It's fine to submit PRs which are a work in progress! But before they are merged, all PRs should provide:]\r\n- [X] Clean style in [the spirit of PEP8](https://www.python.org/dev/peps/pep-0008/)\r\n- [X] [Docstrings for all functions](https://github.com/numpy/numpy/blob/master/doc/example.py)\r\n- [X] Gallery example in `./doc/examples` (new features only)\r\n- [ ] Unit tests\r\n\r\nI am not sure how to provide unitary tests for the proposed code, since there are no mathematical constraints on the output scattering features. Any suggestions here are appreciated. \r\n\r\n@eickenberg\r\n\r\n## References\r\nThis pull-request is 'improving' the #2295 pull request.\r\n\r\nFor an explanation on the scattering transform, you can check the examples:\r\n\r\n - plot_scattering\r\n - plot_scattering_classification\r\n - papers:\r\n\r\n[1] Bruna, J., Mallat, S. 'Invariant Scattering Convolutional Networks'.IEEE TPAMI, 2012.\r\n[2] Oyallon, E. et Mallat, S. 'Deep Roto-translation Scattering for Object Classification'. CVPR 2015\r\n\r\n","created_at":"2016-09-12T13:47:36Z","updated_at":"2016-09-22T09:26:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ea122a9184ed770d6897bdf8520eaddaccf47e3a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/2300/commits","review_comments_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/2300/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/2300/comments","statuses_url":"https://api.github.com/repos/scikit-image/scikit-image/statuses/00ee0354f7b2c634a8984dc0a8adb3bd36aa26a0","head":{"label":"siraferradans:add_scattering_again","ref":"add_scattering_again","sha":"00ee0354f7b2c634a8984dc0a8adb3bd36aa26a0","user":{"login":"siraferradans","id":6280654,"avatar_url":"https://avatars.githubusercontent.com/u/6280654?v=3","gravatar_id":"","url":"https://api.github.com/users/siraferradans","html_url":"https://github.com/siraferradans","followers_url":"https://api.github.com/users/siraferradans/followers","following_url":"https://api.github.com/users/siraferradans/following{/other_user}","gists_url":"https://api.github.com/users/siraferradans/gists{/gist_id}","starred_url":"https://api.github.com/users/siraferradans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siraferradans/subscriptions","organizations_url":"https://api.github.com/users/siraferradans/orgs","repos_url":"https://api.github.com/users/siraferradans/repos","events_url":"https://api.github.com/users/siraferradans/events{/privacy}","received_events_url":"https://api.github.com/users/siraferradans/received_events","type":"User","site_admin":false},"repo":{"id":60183594,"name":"scikit-image","full_name":"siraferradans/scikit-image","owner":{"login":"siraferradans","id":6280654,"avatar_url":"https://avatars.githubusercontent.com/u/6280654?v=3","gravatar_id":"","url":"https://api.github.com/users/siraferradans","html_url":"https://github.com/siraferradans","followers_url":"https://api.github.com/users/siraferradans/followers","following_url":"https://api.github.com/users/siraferradans/following{/other_user}","gists_url":"https://api.github.com/users/siraferradans/gists{/gist_id}","starred_url":"https://api.github.com/users/siraferradans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siraferradans/subscriptions","organizations_url":"https://api.github.com/users/siraferradans/orgs","repos_url":"https://api.github.com/users/siraferradans/repos","events_url":"https://api.github.com/users/siraferradans/events{/privacy}","received_events_url":"https://api.github.com/users/siraferradans/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/siraferradans/scikit-image","description":"Image Processing SciKit (Toolbox for SciPy)","fork":true,"url":"https://api.github.com/repos/siraferradans/scikit-image","forks_url":"https://api.github.com/repos/siraferradans/scikit-image/forks","keys_url":"https://api.github.com/repos/siraferradans/scikit-image/keys{/key_id}","collaborators_url":"https://api.github.com/repos/siraferradans/scikit-image/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/siraferradans/scikit-image/teams","hooks_url":"https://api.github.com/repos/siraferradans/scikit-image/hooks","issue_events_url":"https://api.github.com/repos/siraferradans/scikit-image/issues/events{/number}","events_url":"https://api.github.com/repos/siraferradans/scikit-image/events","assignees_url":"https://api.github.com/repos/siraferradans/scikit-image/assignees{/user}","branches_url":"https://api.github.com/repos/siraferradans/scikit-image/branches{/branch}","tags_url":"https://api.github.com/repos/siraferradans/scikit-image/tags","blobs_url":"https://api.github.com/repos/siraferradans/scikit-image/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/siraferradans/scikit-image/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/siraferradans/scikit-image/git/refs{/sha}","trees_url":"https://api.github.com/repos/siraferradans/scikit-image/git/trees{/sha}","statuses_url":"https://api.github.com/repos/siraferradans/scikit-image/statuses/{sha}","languages_url":"https://api.github.com/repos/siraferradans/scikit-image/languages","stargazers_url":"https://api.github.com/repos/siraferradans/scikit-image/stargazers","contributors_url":"https://api.github.com/repos/siraferradans/scikit-image/contributors","subscribers_url":"https://api.github.com/repos/siraferradans/scikit-image/subscribers","subscription_url":"https://api.github.com/repos/siraferradans/scikit-image/subscription","commits_url":"https://api.github.com/repos/siraferradans/scikit-image/commits{/sha}","git_commits_url":"https://api.github.com/repos/siraferradans/scikit-image/git/commits{/sha}","comments_url":"https://api.github.com/repos/siraferradans/scikit-image/comments{/number}","issue_comment_url":"https://api.github.com/repos/siraferradans/scikit-image/issues/comments{/number}","contents_url":"https://api.github.com/repos/siraferradans/scikit-image/contents/{+path}","compare_url":"https://api.github.com/repos/siraferradans/scikit-image/compare/{base}...{head}","merges_url":"https://api.github.com/repos/siraferradans/scikit-image/merges","archive_url":"https://api.github.com/repos/siraferradans/scikit-image/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/siraferradans/scikit-image/downloads","issues_url":"https://api.github.com/repos/siraferradans/scikit-image/issues{/number}","pulls_url":"https://api.github.com/repos/siraferradans/scikit-image/pulls{/number}","milestones_url":"https://api.github.com/repos/siraferradans/scikit-image/milestones{/number}","notifications_url":"https://api.github.com/repos/siraferradans/scikit-image/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/siraferradans/scikit-image/labels{/name}","releases_url":"https://api.github.com/repos/siraferradans/scikit-image/releases{/id}","deployments_url":"https://api.github.com/repos/siraferradans/scikit-image/deployments","created_at":"2016-06-01T14:22:56Z","updated_at":"2016-06-01T14:22:59Z","pushed_at":"2016-09-21T14:23:25Z","git_url":"git://github.com/siraferradans/scikit-image.git","ssh_url":"git@github.com:siraferradans/scikit-image.git","clone_url":"https://github.com/siraferradans/scikit-image.git","svn_url":"https://github.com/siraferradans/scikit-image","homepage":"http://scikit-image.org","size":41426,"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":"2f71b5787662ce7589bb878c55359cd076f84c83","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}","deployments_url":"https://api.github.com/repos/scikit-image/scikit-image/deployments","created_at":"2011-07-07T22:07:20Z","updated_at":"2016-09-22T06:10:13Z","pushed_at":"2016-09-22T08:32:26Z","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":75345,"stargazers_count":1251,"watchers_count":1251,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":637,"mirror_url":null,"open_issues_count":318,"forks":637,"open_issues":318,"watchers":1251,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/2300"},"html":{"href":"https://github.com/scikit-image/scikit-image/pull/2300"},"issue":{"href":"https://api.github.com/repos/scikit-image/scikit-image/issues/2300"},"comments":{"href":"https://api.github.com/repos/scikit-image/scikit-image/issues/2300/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/2300/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/2300/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-image/scikit-image/statuses/00ee0354f7b2c634a8984dc0a8adb3bd36aa26a0"}}}}
{"actor":{"display_login":"eickenberg"}}