{"action":"created","comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/28625568","id":28625568,"diff_hunk":"@@ -87,6 +91,127 @@ def _compute_mapping_matrix(fmd, info):\n     return mapping_mat\n \n \n+def compute_virtual_evoked(evoked, from_type='mag', to_type='grad',\n+                           copy=True, baseline=None, n_jobs=1):\n+    \"\"\"Compute virtual evoked using interpolated fields in mag/grad channels.\n+\n+    Parameters\n+    ----------\n+    evoked : instance of mne.Evoked\n+        The evoked object.\n+    from_type : str\n+        The original channel type. It can be 'mag' or 'grad'.\n+    to_type : str\n+        The destination channel type. It can be 'mag' or 'grad'.\n+    copy : bool\n+        If False evoked is modified in place.\n+    n_jobs : int\n+        Number of jobs to run in parallel.\n+\n+    Returns\n+    -------\n+    evoked : instance of mne.Evoked\n+        The transformed evoked object containing only virtual channels.\n+    \"\"\"\n+    if from_type not in ['mag', 'grad']:\n+        raise ValueError('from_type must be \"mag\" or \"grad\", not \"%s\"'\n+                         % from_type)\n+    if to_type not in ['mag', 'grad']:\n+        raise ValueError('to_type must be \"mag\" or \"grad\", not \"%s\"'\n+                         % to_type)\n+    if from_type == to_type:\n+        raise ValueError('from_type and to_type cannot be the same.')\n+\n+    # get surface in head coordinates\n+    surf_virt = get_meg_helmet_surf(evoked.info)\n+\n+    # pick the original and destination channels\n+    pick_from = pick_types(evoked.info, meg=from_type, eeg=False,\n+                           ref_meg=False)\n+    pick_to = pick_types(evoked.info, meg=to_type, eeg=False,","path":"mne/forward/_field_interpolation.py","position":81,"original_position":61,"commit_id":"8f60f0345e5c4d95f815cb5ff41672f2d486d1bb","original_commit_id":"22ebc0ebe952c8c44d75a904db2632943006e96c","user":{"login":"agramfort","id":161052,"avatar_url":"https://avatars.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},"body":"a big use case is also to \"repair\" bad MEG channels with proper\ninterpolation.\n","created_at":"2015-04-17T20:02:02Z","updated_at":"2015-04-17T20:02:02Z","html_url":"https://github.com/mne-tools/mne-python/pull/1943#discussion_r28625568","pull_request_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/1943","_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/28625568"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/1943#discussion_r28625568"},"pull_request":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/1943"}}},"pull_request":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/1943","id":33069689,"html_url":"https://github.com/mne-tools/mne-python/pull/1943","diff_url":"https://github.com/mne-tools/mne-python/pull/1943.diff","patch_url":"https://github.com/mne-tools/mne-python/pull/1943.patch","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/1943","number":1943,"state":"open","locked":false,"title":"WIP: Virtual sensors / remap sensors","user":{"login":"mainakjas","id":3817535,"avatar_url":"https://avatars.githubusercontent.com/u/3817535?v=3","gravatar_id":"","url":"https://api.github.com/users/mainakjas","html_url":"https://github.com/mainakjas","followers_url":"https://api.github.com/users/mainakjas/followers","following_url":"https://api.github.com/users/mainakjas/following{/other_user}","gists_url":"https://api.github.com/users/mainakjas/gists{/gist_id}","starred_url":"https://api.github.com/users/mainakjas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mainakjas/subscriptions","organizations_url":"https://api.github.com/users/mainakjas/orgs","repos_url":"https://api.github.com/users/mainakjas/repos","events_url":"https://api.github.com/users/mainakjas/events{/privacy}","received_events_url":"https://api.github.com/users/mainakjas/received_events","type":"User","site_admin":false},"body":"Closes https://github.com/mne-tools/mne-python/issues/1080. Here's what you get when you remap mag to grad for sample.\r\n\r\n![virtual_channels](https://cloud.githubusercontent.com/assets/3817535/7093819/c7c7d004-dfbc-11e4-978a-1ed71c0f6289.png)\r\nStill needs to be made nicer with tests and better options in API.\r\n\r\ncc @Anevar @agramfort ","created_at":"2015-04-10T18:08:53Z","updated_at":"2015-04-17T20:02:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f5d2ac2fc15e11c5428df039ef8d48311deb1e9","assignee":null,"milestone":{"url":"https://api.github.com/repos/mne-tools/mne-python/milestones/5","html_url":"https://github.com/mne-tools/mne-python/milestones/0.9","labels_url":"https://api.github.com/repos/mne-tools/mne-python/milestones/5/labels","id":1011721,"number":5,"title":"0.9","description":null,"creator":{"login":"Eric89GXL","id":2365790,"avatar_url":"https://avatars.githubusercontent.com/u/2365790?v=3","gravatar_id":"","url":"https://api.github.com/users/Eric89GXL","html_url":"https://github.com/Eric89GXL","followers_url":"https://api.github.com/users/Eric89GXL/followers","following_url":"https://api.github.com/users/Eric89GXL/following{/other_user}","gists_url":"https://api.github.com/users/Eric89GXL/gists{/gist_id}","starred_url":"https://api.github.com/users/Eric89GXL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eric89GXL/subscriptions","organizations_url":"https://api.github.com/users/Eric89GXL/orgs","repos_url":"https://api.github.com/users/Eric89GXL/repos","events_url":"https://api.github.com/users/Eric89GXL/events{/privacy}","received_events_url":"https://api.github.com/users/Eric89GXL/received_events","type":"User","site_admin":false},"open_issues":22,"closed_issues":59,"state":"open","created_at":"2015-03-09T03:10:39Z","updated_at":"2015-04-17T17:42:56Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/1943/commits","review_comments_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/1943/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/1943/comments","statuses_url":"https://api.github.com/repos/mne-tools/mne-python/statuses/8f60f0345e5c4d95f815cb5ff41672f2d486d1bb","head":{"label":"mainakjas:virtual_sensors","ref":"virtual_sensors","sha":"8f60f0345e5c4d95f815cb5ff41672f2d486d1bb","user":{"login":"mainakjas","id":3817535,"avatar_url":"https://avatars.githubusercontent.com/u/3817535?v=3","gravatar_id":"","url":"https://api.github.com/users/mainakjas","html_url":"https://github.com/mainakjas","followers_url":"https://api.github.com/users/mainakjas/followers","following_url":"https://api.github.com/users/mainakjas/following{/other_user}","gists_url":"https://api.github.com/users/mainakjas/gists{/gist_id}","starred_url":"https://api.github.com/users/mainakjas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mainakjas/subscriptions","organizations_url":"https://api.github.com/users/mainakjas/orgs","repos_url":"https://api.github.com/users/mainakjas/repos","events_url":"https://api.github.com/users/mainakjas/events{/privacy}","received_events_url":"https://api.github.com/users/mainakjas/received_events","type":"User","site_admin":false},"repo":{"id":8892606,"name":"mne-python","full_name":"mainakjas/mne-python","owner":{"login":"mainakjas","id":3817535,"avatar_url":"https://avatars.githubusercontent.com/u/3817535?v=3","gravatar_id":"","url":"https://api.github.com/users/mainakjas","html_url":"https://github.com/mainakjas","followers_url":"https://api.github.com/users/mainakjas/followers","following_url":"https://api.github.com/users/mainakjas/following{/other_user}","gists_url":"https://api.github.com/users/mainakjas/gists{/gist_id}","starred_url":"https://api.github.com/users/mainakjas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mainakjas/subscriptions","organizations_url":"https://api.github.com/users/mainakjas/orgs","repos_url":"https://api.github.com/users/mainakjas/repos","events_url":"https://api.github.com/users/mainakjas/events{/privacy}","received_events_url":"https://api.github.com/users/mainakjas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mainakjas/mne-python","description":"MNE : Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python","fork":true,"url":"https://api.github.com/repos/mainakjas/mne-python","forks_url":"https://api.github.com/repos/mainakjas/mne-python/forks","keys_url":"https://api.github.com/repos/mainakjas/mne-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mainakjas/mne-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mainakjas/mne-python/teams","hooks_url":"https://api.github.com/repos/mainakjas/mne-python/hooks","issue_events_url":"https://api.github.com/repos/mainakjas/mne-python/issues/events{/number}","events_url":"https://api.github.com/repos/mainakjas/mne-python/events","assignees_url":"https://api.github.com/repos/mainakjas/mne-python/assignees{/user}","branches_url":"https://api.github.com/repos/mainakjas/mne-python/branches{/branch}","tags_url":"https://api.github.com/repos/mainakjas/mne-python/tags","blobs_url":"https://api.github.com/repos/mainakjas/mne-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mainakjas/mne-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mainakjas/mne-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/mainakjas/mne-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mainakjas/mne-python/statuses/{sha}","languages_url":"https://api.github.com/repos/mainakjas/mne-python/languages","stargazers_url":"https://api.github.com/repos/mainakjas/mne-python/stargazers","contributors_url":"https://api.github.com/repos/mainakjas/mne-python/contributors","subscribers_url":"https://api.github.com/repos/mainakjas/mne-python/subscribers","subscription_url":"https://api.github.com/repos/mainakjas/mne-python/subscription","commits_url":"https://api.github.com/repos/mainakjas/mne-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/mainakjas/mne-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/mainakjas/mne-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/mainakjas/mne-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/mainakjas/mne-python/contents/{+path}","compare_url":"https://api.github.com/repos/mainakjas/mne-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mainakjas/mne-python/merges","archive_url":"https://api.github.com/repos/mainakjas/mne-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mainakjas/mne-python/downloads","issues_url":"https://api.github.com/repos/mainakjas/mne-python/issues{/number}","pulls_url":"https://api.github.com/repos/mainakjas/mne-python/pulls{/number}","milestones_url":"https://api.github.com/repos/mainakjas/mne-python/milestones{/number}","notifications_url":"https://api.github.com/repos/mainakjas/mne-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mainakjas/mne-python/labels{/name}","releases_url":"https://api.github.com/repos/mainakjas/mne-python/releases{/id}","created_at":"2013-03-20T00:17:33Z","updated_at":"2014-12-06T15:03:01Z","pushed_at":"2015-04-17T19:25:06Z","git_url":"git://github.com/mainakjas/mne-python.git","ssh_url":"git@github.com:mainakjas/mne-python.git","clone_url":"https://github.com/mainakjas/mne-python.git","svn_url":"https://github.com/mainakjas/mne-python","homepage":"http://martinos.org/mne/","size":76901,"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":"mne-tools:master","ref":"master","sha":"5bf9be320acc78586a0a2b0ef9f8ae8a1c2a3ebd","user":{"login":"mne-tools","id":583875,"avatar_url":"https://avatars.githubusercontent.com/u/583875?v=3","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,"name":"mne-python","full_name":"mne-tools/mne-python","owner":{"login":"mne-tools","id":583875,"avatar_url":"https://avatars.githubusercontent.com/u/583875?v=3","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},"private":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}","created_at":"2011-01-28T03:31:13Z","updated_at":"2015-04-17T17:31:23Z","pushed_at":"2015-04-17T19:47:34Z","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":166146,"stargazers_count":126,"watchers_count":126,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":110,"mirror_url":null,"open_issues_count":141,"forks":110,"open_issues":141,"watchers":126,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/1943"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/1943"},"issue":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/1943"},"comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/1943/comments"},"review_comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/1943/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/1943/commits"},"statuses":{"href":"https://api.github.com/repos/mne-tools/mne-python/statuses/8f60f0345e5c4d95f815cb5ff41672f2d486d1bb"}}}}