{"action":"created","issue":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/4000","repository_url":"https://api.github.com/repos/mne-tools/mne-python","labels_url":"https://api.github.com/repos/mne-tools/mne-python/issues/4000/labels{/name}","comments_url":"https://api.github.com/repos/mne-tools/mne-python/issues/4000/comments","events_url":"https://api.github.com/repos/mne-tools/mne-python/issues/4000/events","html_url":"https://github.com/mne-tools/mne-python/pull/4000","id":208446873,"number":4000,"title":"ENH: add reduction keyword to pwelch","user":{"login":"mmagnuski","id":8452354,"avatar_url":"https://avatars3.githubusercontent.com/u/8452354?v=3","gravatar_id":"","url":"https://api.github.com/users/mmagnuski","html_url":"https://github.com/mmagnuski","followers_url":"https://api.github.com/users/mmagnuski/followers","following_url":"https://api.github.com/users/mmagnuski/following{/other_user}","gists_url":"https://api.github.com/users/mmagnuski/gists{/gist_id}","starred_url":"https://api.github.com/users/mmagnuski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmagnuski/subscriptions","organizations_url":"https://api.github.com/users/mmagnuski/orgs","repos_url":"https://api.github.com/users/mmagnuski/repos","events_url":"https://api.github.com/users/mmagnuski/events{/privacy}","received_events_url":"https://api.github.com/users/mmagnuski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":22,"created_at":"2017-02-17T13:48:43Z","updated_at":"2017-06-25T22:43:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/4000","html_url":"https://github.com/mne-tools/mne-python/pull/4000","diff_url":"https://github.com/mne-tools/mne-python/pull/4000.diff","patch_url":"https://github.com/mne-tools/mne-python/pull/4000.patch"},"body":"This PR adds ability to specify reduction to apply to welch windows (#3336)\r\nIt's actually part of #3820 with some tests added.\r\n@Eric89GXL I was looking for a branch/stash fixing #3621 and found this instead. But I'll push PR adressing n_fft issue today.\r\n\r\nThis adds `reduction` keyword argument for reduction across windows, where that can be either `'mean'`, `'median'`, callable or `None`:\r\n* `'mean'` and `'median'` perform mean or median respectively\r\n* callable is called on the windows (may additionally ensure that window dimension was reduced)\r\n* `None` omit the reduction so `psd_welch` returns an array of shape `windows x channels x freqs` for raw and `windows x epochs x channels x freqs` for epochs.\r\n* @kingjr proposed using float values < 0.5 for trimmed mean - I've implemented it here too (using `scipy.stats.trim_mean`)\r\n\r\nI've added it as `get_reduction` to mne.utils. It can also be private if you prefer.\r\nI've also added a few tests to `test_psd` - they pass locally, but I'll see what CIs have to say. \r\n❗️ the windows are the last dimension if a reduction is applied (so if custom function is used it has to reduce across axis=-1), but when reduction is `None` they are moved to the -3 dimension. This means that raw output is of diemnsions `windows x channels x freqs` and epochs are of `epochs x windows x channels x freqs` ❗️ \r\n\r\nTODOs:\r\n- [ ] I'll modify existing tutorial/example that shows how to use reduction\r\n- [ ] I'll add a whats new entry once all is cool (CIs green, comments adressed etc.)\r\n\r\nCloses #3336"},"comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/comments/310933527","html_url":"https://github.com/mne-tools/mne-python/pull/4000#issuecomment-310933527","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/4000","id":310933527,"user":{"login":"agramfort","id":161052,"avatar_url":"https://avatars1.githubusercontent.com/u/161052?v=3","gravatar_id":"","url":"https://api.github.com/users/agramfort","html_url":"https://github.com/agramfort","followers_url":"https://api.github.com/users/agramfort/followers","following_url":"https://api.github.com/users/agramfort/following{/other_user}","gists_url":"https://api.github.com/users/agramfort/gists{/gist_id}","starred_url":"https://api.github.com/users/agramfort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agramfort/subscriptions","organizations_url":"https://api.github.com/users/agramfort/orgs","repos_url":"https://api.github.com/users/agramfort/repos","events_url":"https://api.github.com/users/agramfort/events{/privacy}","received_events_url":"https://api.github.com/users/agramfort/received_events","type":"User","site_admin":false},"created_at":"2017-06-25T22:43:51Z","updated_at":"2017-06-25T22:43:51Z","body":"@mmagnuski you'll need to rebase"}}
{"actor":{"display_login":"agramfort"}}