{"action":"created","comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/240049841","pull_request_review_id":182991265,"id":240049841,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MDA0OTg0MQ==","diff_hunk":"@@ -473,4 +474,41 @@ def test_add_reference():\n     pytest.raises(ValueError, add_reference_channels, raw, 1)\n \n \n+def test_bipolar_combinations():\n+    \"\"\"Test bipolar channel generation.\"\"\"\n+    channels = ['CH' + str(ni + 1) for ni in range(10)]\n+    info = create_info(\n+        ch_names=channels, sfreq=1000., ch_types=['eeg'] * len(channels))\n+    raw_data = np.random.randn(len(channels), 1000)\n+    raw = RawArray(raw_data, info)\n+\n+    def _check_bipolar(raw_test, ch_a, ch_b):\n+        assert_array_equal(\n+            raw_test.get_data(\n+                picks=[raw_test.ch_names.index(ch_a + '-' + ch_b)])[0, :],\n+            raw_data[channels.index(ch_a), :] -\n+            raw_data[channels.index(ch_b), :])\n+\n+    # test classic EOG/ECG bipolar reference (only two channels per pair).\n+    raw_test = set_bipolar_reference(raw, ['CH2'], ['CH1'], copy=True)\n+    _check_bipolar(raw_test, 'CH2', 'CH1')\n+\n+    # test all combinations.\n+    bipolars = list(itertools.combinations(channels, 2))\n+    a_channels, b_channels = [], []\n+    for ch_a, ch_b in bipolars:\n+        a_channels.append(ch_a)\n+        b_channels.append(ch_b)","path":"mne/io/tests/test_reference.py","position":48,"original_position":48,"commit_id":"7231aa8d704bb5fe3d8d58ee88d019d83b955d23","original_commit_id":"7231aa8d704bb5fe3d8d58ee88d019d83b955d23","user":{"login":"cmmoenne","id":13858269,"node_id":"MDQ6VXNlcjEzODU4MjY5","avatar_url":"https://avatars1.githubusercontent.com/u/13858269?v=4","gravatar_id":"","url":"https://api.github.com/users/cmmoenne","html_url":"https://github.com/cmmoenne","followers_url":"https://api.github.com/users/cmmoenne/followers","following_url":"https://api.github.com/users/cmmoenne/following{/other_user}","gists_url":"https://api.github.com/users/cmmoenne/gists{/gist_id}","starred_url":"https://api.github.com/users/cmmoenne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmmoenne/subscriptions","organizations_url":"https://api.github.com/users/cmmoenne/orgs","repos_url":"https://api.github.com/users/cmmoenne/repos","events_url":"https://api.github.com/users/cmmoenne/events{/privacy}","received_events_url":"https://api.github.com/users/cmmoenne/received_events","type":"User","site_admin":false},"body":"As we need the channels to compare the results after `set_bipolar_reference`, the other alternative is unroll the for (otherwise the generator code should be repeated): \r\n```\r\na_channels, b_channels = zip(*itertools.combinations(channels, 2))\r\na_channels = list(a_channels)\r\nb_channels = list(b_channels)\r\n```\r\nI think this would be the best.","created_at":"2018-12-09T19:32:01Z","updated_at":"2018-12-09T19:32:01Z","html_url":"https://github.com/mne-tools/mne-python/pull/5780#discussion_r240049841","pull_request_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/5780","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/240049841"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/5780#discussion_r240049841"},"pull_request":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/5780"}},"in_reply_to_id":239938911},"pull_request":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/5780","id":236950862,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM2OTUwODYy","html_url":"https://github.com/mne-tools/mne-python/pull/5780","diff_url":"https://github.com/mne-tools/mne-python/pull/5780.diff","patch_url":"https://github.com/mne-tools/mne-python/pull/5780.patch","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/5780","number":5780,"state":"open","locked":false,"title":"MRG: fix for set_bipolar_reference","user":{"login":"cmmoenne","id":13858269,"node_id":"MDQ6VXNlcjEzODU4MjY5","avatar_url":"https://avatars1.githubusercontent.com/u/13858269?v=4","gravatar_id":"","url":"https://api.github.com/users/cmmoenne","html_url":"https://github.com/cmmoenne","followers_url":"https://api.github.com/users/cmmoenne/followers","following_url":"https://api.github.com/users/cmmoenne/following{/other_user}","gists_url":"https://api.github.com/users/cmmoenne/gists{/gist_id}","starred_url":"https://api.github.com/users/cmmoenne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmmoenne/subscriptions","organizations_url":"https://api.github.com/users/cmmoenne/orgs","repos_url":"https://api.github.com/users/cmmoenne/repos","events_url":"https://api.github.com/users/cmmoenne/events{/privacy}","received_events_url":"https://api.github.com/users/cmmoenne/received_events","type":"User","site_admin":false},"body":"I messed up the original pull request while trying to squash the commits (sorry!) :'(\r\n\r\nShort description of the bug: `set_bipolar reference` try to remove a list of repeated channels when producing all the bipolar references of a dataset. Also, does not take into account channels of cathode list when performing in-place operations.\r\n\r\nIn this new pull, I added the requested changes, including a test, and also I updated whats new file.\r\n\r\nNote that the current implementation of set_bipolar_reference fail in both, generating all the bipolar combinations and with repeated channels in the anode and cathode lists.\r\n","created_at":"2018-12-07T18:11:43Z","updated_at":"2018-12-09T19:32:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"27491e7c10e25b28590eef62589f42582b5a3d9c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/5780/commits","review_comments_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/5780/comments","review_comment_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mne-tools/mne-python/issues/5780/comments","statuses_url":"https://api.github.com/repos/mne-tools/mne-python/statuses/7231aa8d704bb5fe3d8d58ee88d019d83b955d23","head":{"label":"cmmoenne:bipolar-ref-fix","ref":"bipolar-ref-fix","sha":"7231aa8d704bb5fe3d8d58ee88d019d83b955d23","user":{"login":"cmmoenne","id":13858269,"node_id":"MDQ6VXNlcjEzODU4MjY5","avatar_url":"https://avatars1.githubusercontent.com/u/13858269?v=4","gravatar_id":"","url":"https://api.github.com/users/cmmoenne","html_url":"https://github.com/cmmoenne","followers_url":"https://api.github.com/users/cmmoenne/followers","following_url":"https://api.github.com/users/cmmoenne/following{/other_user}","gists_url":"https://api.github.com/users/cmmoenne/gists{/gist_id}","starred_url":"https://api.github.com/users/cmmoenne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmmoenne/subscriptions","organizations_url":"https://api.github.com/users/cmmoenne/orgs","repos_url":"https://api.github.com/users/cmmoenne/repos","events_url":"https://api.github.com/users/cmmoenne/events{/privacy}","received_events_url":"https://api.github.com/users/cmmoenne/received_events","type":"User","site_admin":false},"repo":{"id":81021150,"node_id":"MDEwOlJlcG9zaXRvcnk4MTAyMTE1MA==","name":"mne-python","full_name":"cmmoenne/mne-python","private":false,"owner":{"login":"cmmoenne","id":13858269,"node_id":"MDQ6VXNlcjEzODU4MjY5","avatar_url":"https://avatars1.githubusercontent.com/u/13858269?v=4","gravatar_id":"","url":"https://api.github.com/users/cmmoenne","html_url":"https://github.com/cmmoenne","followers_url":"https://api.github.com/users/cmmoenne/followers","following_url":"https://api.github.com/users/cmmoenne/following{/other_user}","gists_url":"https://api.github.com/users/cmmoenne/gists{/gist_id}","starred_url":"https://api.github.com/users/cmmoenne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmmoenne/subscriptions","organizations_url":"https://api.github.com/users/cmmoenne/orgs","repos_url":"https://api.github.com/users/cmmoenne/repos","events_url":"https://api.github.com/users/cmmoenne/events{/privacy}","received_events_url":"https://api.github.com/users/cmmoenne/received_events","type":"User","site_admin":false},"html_url":"https://github.com/cmmoenne/mne-python","description":"MNE : Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python","fork":true,"url":"https://api.github.com/repos/cmmoenne/mne-python","forks_url":"https://api.github.com/repos/cmmoenne/mne-python/forks","keys_url":"https://api.github.com/repos/cmmoenne/mne-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cmmoenne/mne-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cmmoenne/mne-python/teams","hooks_url":"https://api.github.com/repos/cmmoenne/mne-python/hooks","issue_events_url":"https://api.github.com/repos/cmmoenne/mne-python/issues/events{/number}","events_url":"https://api.github.com/repos/cmmoenne/mne-python/events","assignees_url":"https://api.github.com/repos/cmmoenne/mne-python/assignees{/user}","branches_url":"https://api.github.com/repos/cmmoenne/mne-python/branches{/branch}","tags_url":"https://api.github.com/repos/cmmoenne/mne-python/tags","blobs_url":"https://api.github.com/repos/cmmoenne/mne-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cmmoenne/mne-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cmmoenne/mne-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/cmmoenne/mne-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cmmoenne/mne-python/statuses/{sha}","languages_url":"https://api.github.com/repos/cmmoenne/mne-python/languages","stargazers_url":"https://api.github.com/repos/cmmoenne/mne-python/stargazers","contributors_url":"https://api.github.com/repos/cmmoenne/mne-python/contributors","subscribers_url":"https://api.github.com/repos/cmmoenne/mne-python/subscribers","subscription_url":"https://api.github.com/repos/cmmoenne/mne-python/subscription","commits_url":"https://api.github.com/repos/cmmoenne/mne-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/cmmoenne/mne-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/cmmoenne/mne-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/cmmoenne/mne-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/cmmoenne/mne-python/contents/{+path}","compare_url":"https://api.github.com/repos/cmmoenne/mne-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cmmoenne/mne-python/merges","archive_url":"https://api.github.com/repos/cmmoenne/mne-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cmmoenne/mne-python/downloads","issues_url":"https://api.github.com/repos/cmmoenne/mne-python/issues{/number}","pulls_url":"https://api.github.com/repos/cmmoenne/mne-python/pulls{/number}","milestones_url":"https://api.github.com/repos/cmmoenne/mne-python/milestones{/number}","notifications_url":"https://api.github.com/repos/cmmoenne/mne-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cmmoenne/mne-python/labels{/name}","releases_url":"https://api.github.com/repos/cmmoenne/mne-python/releases{/id}","deployments_url":"https://api.github.com/repos/cmmoenne/mne-python/deployments","created_at":"2017-02-05T20:49:07Z","updated_at":"2018-12-07T18:42:06Z","pushed_at":"2018-12-07T19:04:32Z","git_url":"git://github.com/cmmoenne/mne-python.git","ssh_url":"git@github.com:cmmoenne/mne-python.git","clone_url":"https://github.com/cmmoenne/mne-python.git","svn_url":"https://github.com/cmmoenne/mne-python","homepage":"http://martinos.org/mne/","size":103411,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mne-tools:master","ref":"master","sha":"f830351301282f2e350ae600046a2f6169a96927","user":{"login":"mne-tools","id":583875,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU4Mzg3NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/583875?v=4","gravatar_id":"","url":"https://api.github.com/users/mne-tools","html_url":"https://github.com/mne-tools","followers_url":"https://api.github.com/users/mne-tools/followers","following_url":"https://api.github.com/users/mne-tools/following{/other_user}","gists_url":"https://api.github.com/users/mne-tools/gists{/gist_id}","starred_url":"https://api.github.com/users/mne-tools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mne-tools/subscriptions","organizations_url":"https://api.github.com/users/mne-tools/orgs","repos_url":"https://api.github.com/users/mne-tools/repos","events_url":"https://api.github.com/users/mne-tools/events{/privacy}","received_events_url":"https://api.github.com/users/mne-tools/received_events","type":"Organization","site_admin":false},"repo":{"id":1301584,"node_id":"MDEwOlJlcG9zaXRvcnkxMzAxNTg0","name":"mne-python","full_name":"mne-tools/mne-python","private":false,"owner":{"login":"mne-tools","id":583875,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU4Mzg3NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/583875?v=4","gravatar_id":"","url":"https://api.github.com/users/mne-tools","html_url":"https://github.com/mne-tools","followers_url":"https://api.github.com/users/mne-tools/followers","following_url":"https://api.github.com/users/mne-tools/following{/other_user}","gists_url":"https://api.github.com/users/mne-tools/gists{/gist_id}","starred_url":"https://api.github.com/users/mne-tools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mne-tools/subscriptions","organizations_url":"https://api.github.com/users/mne-tools/orgs","repos_url":"https://api.github.com/users/mne-tools/repos","events_url":"https://api.github.com/users/mne-tools/events{/privacy}","received_events_url":"https://api.github.com/users/mne-tools/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mne-tools/mne-python","description":"MNE : Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python","fork":false,"url":"https://api.github.com/repos/mne-tools/mne-python","forks_url":"https://api.github.com/repos/mne-tools/mne-python/forks","keys_url":"https://api.github.com/repos/mne-tools/mne-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mne-tools/mne-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mne-tools/mne-python/teams","hooks_url":"https://api.github.com/repos/mne-tools/mne-python/hooks","issue_events_url":"https://api.github.com/repos/mne-tools/mne-python/issues/events{/number}","events_url":"https://api.github.com/repos/mne-tools/mne-python/events","assignees_url":"https://api.github.com/repos/mne-tools/mne-python/assignees{/user}","branches_url":"https://api.github.com/repos/mne-tools/mne-python/branches{/branch}","tags_url":"https://api.github.com/repos/mne-tools/mne-python/tags","blobs_url":"https://api.github.com/repos/mne-tools/mne-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mne-tools/mne-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mne-tools/mne-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/mne-tools/mne-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mne-tools/mne-python/statuses/{sha}","languages_url":"https://api.github.com/repos/mne-tools/mne-python/languages","stargazers_url":"https://api.github.com/repos/mne-tools/mne-python/stargazers","contributors_url":"https://api.github.com/repos/mne-tools/mne-python/contributors","subscribers_url":"https://api.github.com/repos/mne-tools/mne-python/subscribers","subscription_url":"https://api.github.com/repos/mne-tools/mne-python/subscription","commits_url":"https://api.github.com/repos/mne-tools/mne-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/mne-tools/mne-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/mne-tools/mne-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/mne-tools/mne-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/mne-tools/mne-python/contents/{+path}","compare_url":"https://api.github.com/repos/mne-tools/mne-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mne-tools/mne-python/merges","archive_url":"https://api.github.com/repos/mne-tools/mne-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mne-tools/mne-python/downloads","issues_url":"https://api.github.com/repos/mne-tools/mne-python/issues{/number}","pulls_url":"https://api.github.com/repos/mne-tools/mne-python/pulls{/number}","milestones_url":"https://api.github.com/repos/mne-tools/mne-python/milestones{/number}","notifications_url":"https://api.github.com/repos/mne-tools/mne-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mne-tools/mne-python/labels{/name}","releases_url":"https://api.github.com/repos/mne-tools/mne-python/releases{/id}","deployments_url":"https://api.github.com/repos/mne-tools/mne-python/deployments","created_at":"2011-01-28T03:31:13Z","updated_at":"2018-12-07T21:04:09Z","pushed_at":"2018-12-09T16:39:09Z","git_url":"git://github.com/mne-tools/mne-python.git","ssh_url":"git@github.com:mne-tools/mne-python.git","clone_url":"https://github.com/mne-tools/mne-python.git","svn_url":"https://github.com/mne-tools/mne-python","homepage":"http://martinos.org/mne/","size":103411,"stargazers_count":676,"watchers_count":676,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":475,"mirror_url":null,"archived":false,"open_issues_count":281,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":475,"open_issues":281,"watchers":676,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/5780"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/5780"},"issue":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/5780"},"comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/5780/comments"},"review_comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/5780/comments"},"review_comment":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/5780/commits"},"statuses":{"href":"https://api.github.com/repos/mne-tools/mne-python/statuses/7231aa8d704bb5fe3d8d58ee88d019d83b955d23"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"cmmoenne"}}