{"action":"created","comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/278486153","pull_request_review_id":230563199,"id":278486153,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI3ODQ4NjE1Mw==","diff_hunk":"@@ -0,0 +1,93 @@\n+# preparing everything:\n+import mne\n+import numpy as np\n+import os.path as op\n+from scipy.io import savemat\n+\n+from mne.datasets import testing\n+from mne.beamformer import make_lcmv, apply_lcmv\n+from mne.beamformer.tests.test_lcmv import _get_data\n+\n+\n+data_path = testing.data_path(download=False)\n+fname_raw = op.join(data_path, 'MEG', 'sample', 'sample_audvis_trunc_raw.fif')\n+fname_cov = op.join(data_path, 'MEG', 'sample', 'sample_audvis_trunc-cov.fif')\n+fname_fwd = op.join(data_path, 'MEG', 'sample',\n+                    'sample_audvis_trunc-meg-eeg-oct-4-fwd.fif')\n+fname_fwd_vol = op.join(data_path, 'MEG', 'sample',\n+                        'sample_audvis_trunc-meg-vol-7-fwd.fif')\n+fname_event = op.join(data_path, 'MEG', 'sample',\n+                      'sample_audvis_trunc_raw-eve.fif')\n+fname_label = op.join(data_path, 'MEG', 'sample', 'labels', 'Aud-lh.label')\n+\n+reject = dict(grad=4000e-13, mag=4e-12)\n+\n+# where FieldTrip data should be saved to / imported from\n+ft_data_path = ' '\n+\n+\n+def _get_bf_data(save_fieldtrip=False):\n+    raw, epochs, evoked, data_cov, _, _, _, _, _, fwd = _get_data(proj=False)\n+\n+    if save_fieldtrip is True:\n+        # raw needs to be saved with all channels and picked in FieldTrip\n+        raw.save(op.join(ft_data_path, 'raw.fif'), overwrite=True)\n+\n+        # src (tris are not available in fwd['src'] once imported into MATLAB)\n+        src = fwd['src'].copy()\n+        mne.write_source_spaces(op.join(ft_data_path, 'src.fif'), src)\n+\n+    # pick gradiometers only:\n+    epochs.pick_types(meg='grad')\n+    evoked.pick_types(meg='grad')\n+\n+    # compute covariance matrix\n+    data_cov = mne.compute_covariance(epochs, tmin=0.04, tmax=0.145,\n+                                      method='empirical')\n+\n+    if save_fieldtrip is True:\n+        # if the covariance matrix and epochs need resaving:\n+        # data covariance:\n+        cov_savepath = op.join(ft_data_path, 'sample_cov')\n+        sample_cov = {'sample_cov': data_cov['data']}\n+        savemat(cov_savepath, sample_cov)\n+        # evoked data:\n+        ev_savepath = op.join(ft_data_path, 'sample_evoked')\n+        data_ev = {'sample_evoked': evoked.data}\n+        savemat(ev_savepath, data_ev)\n+\n+    return evoked, data_cov, fwd\n+\n+\n+def test_lcmv_fieldtrip():","path":"mne/beamformer/tests/test_external.py","position":62,"original_position":62,"commit_id":"407c6e2fd60dfa37dc7b375dbf75e88e4aae67ab","original_commit_id":"407c6e2fd60dfa37dc7b375dbf75e88e4aae67ab","user":{"login":"larsoner","id":2365790,"node_id":"MDQ6VXNlcjIzNjU3OTA=","avatar_url":"https://avatars1.githubusercontent.com/u/2365790?v=4","gravatar_id":"","url":"https://api.github.com/users/larsoner","html_url":"https://github.com/larsoner","followers_url":"https://api.github.com/users/larsoner/followers","following_url":"https://api.github.com/users/larsoner/following{/other_user}","gists_url":"https://api.github.com/users/larsoner/gists{/gist_id}","starred_url":"https://api.github.com/users/larsoner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larsoner/subscriptions","organizations_url":"https://api.github.com/users/larsoner/orgs","repos_url":"https://api.github.com/users/larsoner/repos","events_url":"https://api.github.com/users/larsoner/events{/privacy}","received_events_url":"https://api.github.com/users/larsoner/received_events","type":"User","site_admin":false},"body":"Yes","created_at":"2019-04-25T10:15:08Z","updated_at":"2019-04-25T10:15:08Z","html_url":"https://github.com/mne-tools/mne-python/pull/6213#discussion_r278486153","pull_request_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/6213","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/278486153"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/6213#discussion_r278486153"},"pull_request":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/6213"}},"in_reply_to_id":278466313},"pull_request":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/6213","id":273229645,"node_id":"MDExOlB1bGxSZXF1ZXN0MjczMjI5NjQ1","html_url":"https://github.com/mne-tools/mne-python/pull/6213","diff_url":"https://github.com/mne-tools/mne-python/pull/6213.diff","patch_url":"https://github.com/mne-tools/mne-python/pull/6213.patch","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/6213","number":6213,"state":"open","locked":false,"title":"WIP [FIX] Unit-gain LCMV beamformer","user":{"login":"britta-wstnr","id":20129119,"node_id":"MDQ6VXNlcjIwMTI5MTE5","avatar_url":"https://avatars0.githubusercontent.com/u/20129119?v=4","gravatar_id":"","url":"https://api.github.com/users/britta-wstnr","html_url":"https://github.com/britta-wstnr","followers_url":"https://api.github.com/users/britta-wstnr/followers","following_url":"https://api.github.com/users/britta-wstnr/following{/other_user}","gists_url":"https://api.github.com/users/britta-wstnr/gists{/gist_id}","starred_url":"https://api.github.com/users/britta-wstnr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/britta-wstnr/subscriptions","organizations_url":"https://api.github.com/users/britta-wstnr/orgs","repos_url":"https://api.github.com/users/britta-wstnr/repos","events_url":"https://api.github.com/users/britta-wstnr/events{/privacy}","received_events_url":"https://api.github.com/users/britta-wstnr/received_events","type":"User","site_admin":false},"body":"This fixes the pseudo-inversion in the filter computation.\r\nIn the old code, the ``pinv`` had an arbitray ``cond=0.1`` set. We already stumbled across this in the past several times (the code is from before we started the overhaul of the module). So far we kept it, since we had no good motivation to change it.\r\nNow, I ran our beamformer against FieldTrip, and if I get rid of this threshold ``cond=0.1``, the variance explained between the toolboxes for the beamformer output **jumps from 0% to 100%** and **the output gets much more plausible than before**.\r\n\r\nAfter investigating this, I would consider the old code a bug.\r\n\r\nOf course, we'd have to change the value ranges for the unit tests now ...\r\n\r\nThoughts? @larsoner @agramfort @wmvanvliet \r\n\r\n","created_at":"2019-04-24T17:30:41Z","updated_at":"2019-04-25T10:15:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f5080e9f6f7efd0756873b7d06a3527ec502ab2e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1251548786,"node_id":"MDU6TGFiZWwxMjUxNTQ4Nzg2","url":"https://api.github.com/repos/mne-tools/mne-python/labels/Beamformer","name":"Beamformer","color":"a7ef88","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/6213/commits","review_comments_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/6213/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/6213/comments","statuses_url":"https://api.github.com/repos/mne-tools/mne-python/statuses/407c6e2fd60dfa37dc7b375dbf75e88e4aae67ab","head":{"label":"britta-wstnr:fix_unitgain","ref":"fix_unitgain","sha":"407c6e2fd60dfa37dc7b375dbf75e88e4aae67ab","user":{"login":"britta-wstnr","id":20129119,"node_id":"MDQ6VXNlcjIwMTI5MTE5","avatar_url":"https://avatars0.githubusercontent.com/u/20129119?v=4","gravatar_id":"","url":"https://api.github.com/users/britta-wstnr","html_url":"https://github.com/britta-wstnr","followers_url":"https://api.github.com/users/britta-wstnr/followers","following_url":"https://api.github.com/users/britta-wstnr/following{/other_user}","gists_url":"https://api.github.com/users/britta-wstnr/gists{/gist_id}","starred_url":"https://api.github.com/users/britta-wstnr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/britta-wstnr/subscriptions","organizations_url":"https://api.github.com/users/britta-wstnr/orgs","repos_url":"https://api.github.com/users/britta-wstnr/repos","events_url":"https://api.github.com/users/britta-wstnr/events{/privacy}","received_events_url":"https://api.github.com/users/britta-wstnr/received_events","type":"User","site_admin":false},"repo":{"id":86345521,"node_id":"MDEwOlJlcG9zaXRvcnk4NjM0NTUyMQ==","name":"mne-python","full_name":"britta-wstnr/mne-python","private":false,"owner":{"login":"britta-wstnr","id":20129119,"node_id":"MDQ6VXNlcjIwMTI5MTE5","avatar_url":"https://avatars0.githubusercontent.com/u/20129119?v=4","gravatar_id":"","url":"https://api.github.com/users/britta-wstnr","html_url":"https://github.com/britta-wstnr","followers_url":"https://api.github.com/users/britta-wstnr/followers","following_url":"https://api.github.com/users/britta-wstnr/following{/other_user}","gists_url":"https://api.github.com/users/britta-wstnr/gists{/gist_id}","starred_url":"https://api.github.com/users/britta-wstnr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/britta-wstnr/subscriptions","organizations_url":"https://api.github.com/users/britta-wstnr/orgs","repos_url":"https://api.github.com/users/britta-wstnr/repos","events_url":"https://api.github.com/users/britta-wstnr/events{/privacy}","received_events_url":"https://api.github.com/users/britta-wstnr/received_events","type":"User","site_admin":false},"html_url":"https://github.com/britta-wstnr/mne-python","description":"MNE : Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python","fork":true,"url":"https://api.github.com/repos/britta-wstnr/mne-python","forks_url":"https://api.github.com/repos/britta-wstnr/mne-python/forks","keys_url":"https://api.github.com/repos/britta-wstnr/mne-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/britta-wstnr/mne-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/britta-wstnr/mne-python/teams","hooks_url":"https://api.github.com/repos/britta-wstnr/mne-python/hooks","issue_events_url":"https://api.github.com/repos/britta-wstnr/mne-python/issues/events{/number}","events_url":"https://api.github.com/repos/britta-wstnr/mne-python/events","assignees_url":"https://api.github.com/repos/britta-wstnr/mne-python/assignees{/user}","branches_url":"https://api.github.com/repos/britta-wstnr/mne-python/branches{/branch}","tags_url":"https://api.github.com/repos/britta-wstnr/mne-python/tags","blobs_url":"https://api.github.com/repos/britta-wstnr/mne-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/britta-wstnr/mne-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/britta-wstnr/mne-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/britta-wstnr/mne-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/britta-wstnr/mne-python/statuses/{sha}","languages_url":"https://api.github.com/repos/britta-wstnr/mne-python/languages","stargazers_url":"https://api.github.com/repos/britta-wstnr/mne-python/stargazers","contributors_url":"https://api.github.com/repos/britta-wstnr/mne-python/contributors","subscribers_url":"https://api.github.com/repos/britta-wstnr/mne-python/subscribers","subscription_url":"https://api.github.com/repos/britta-wstnr/mne-python/subscription","commits_url":"https://api.github.com/repos/britta-wstnr/mne-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/britta-wstnr/mne-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/britta-wstnr/mne-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/britta-wstnr/mne-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/britta-wstnr/mne-python/contents/{+path}","compare_url":"https://api.github.com/repos/britta-wstnr/mne-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/britta-wstnr/mne-python/merges","archive_url":"https://api.github.com/repos/britta-wstnr/mne-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/britta-wstnr/mne-python/downloads","issues_url":"https://api.github.com/repos/britta-wstnr/mne-python/issues{/number}","pulls_url":"https://api.github.com/repos/britta-wstnr/mne-python/pulls{/number}","milestones_url":"https://api.github.com/repos/britta-wstnr/mne-python/milestones{/number}","notifications_url":"https://api.github.com/repos/britta-wstnr/mne-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/britta-wstnr/mne-python/labels{/name}","releases_url":"https://api.github.com/repos/britta-wstnr/mne-python/releases{/id}","deployments_url":"https://api.github.com/repos/britta-wstnr/mne-python/deployments","created_at":"2017-03-27T14:29:06Z","updated_at":"2017-03-27T14:29:11Z","pushed_at":"2019-04-25T09:20:53Z","git_url":"git://github.com/britta-wstnr/mne-python.git","ssh_url":"git@github.com:britta-wstnr/mne-python.git","clone_url":"https://github.com/britta-wstnr/mne-python.git","svn_url":"https://github.com/britta-wstnr/mne-python","homepage":"http://martinos.org/mne/","size":105026,"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,"disabled":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":"7e0e09f4c2bdfc9d938fb709a6c07e055957ba4f","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":"2019-04-25T10:12:26Z","pushed_at":"2019-04-25T10:12:19Z","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":104998,"stargazers_count":824,"watchers_count":824,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":553,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":311,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":553,"open_issues":311,"watchers":824,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/6213"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/6213"},"issue":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/6213"},"comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/6213/comments"},"review_comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/6213/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/6213/commits"},"statuses":{"href":"https://api.github.com/repos/mne-tools/mne-python/statuses/407c6e2fd60dfa37dc7b375dbf75e88e4aae67ab"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"larsoner"}}