{"action":"created","comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/28557316","id":28557316,"diff_hunk":"@@ -967,6 +968,63 @@ def as_data_frame(self, index=None, scale_time=1e3, copy=True):\n \n         return df\n \n+    @verbose\n+    def estimate_snr(self, info, fwd, cov, verbose=None):\n+        \"\"\"Compute time-varying SNR\n+\n+        This function should only be used with source estimates with units\n+        nA (i.e., MNE-like solutions, *not* dSPM or sLORETA).\n+\n+        Reference:\n+        Goldenholz, D. M., Ahlfors, S. P., Hämäläinen, M. S., Sharon, D.,\n+        Ishitobi, M., Vaina, L. M., & Stufflebeam, S. M. (2009).\n+        Mapping the Signal-To-Noise-Ratios of Cortical Sources in\n+        Magnetoencephalography and Electroencephalography.\n+        Human Brain Mapping, 30(4), 1077–1086. doi:10.1002/hbm.20571\n+\n+        Parameters\n+        ----------\n+        info : instance of io.meas_info.Info\n+            The measurement info.\n+        fwd : instance of Forward\n+            The forward solution used to create the source estimate.\n+        cov : instance of Covariance\n+            The noise covariance used to estimate the resting cortical\n+            activations. Should be an evoked covariance, not empty room.\n+\n+        Returns\n+        -------\n+        snr_stc : instance of SourceEstimate\n+            The source estimate with the SNR computed.\n+\n+        Notes\n+        -----\n+        We define the SNR in decibels for each source location at each\n+        time point as:\n+\n+        .. math::\n+\n+            {\\\\rm SNR} = 10\\\\log_10[\\\\frac{a^2}{N}\\\\sum_k\\\\frac{b_k^2}{s_k^2}]\n+\n+        where :math:`\\\\b_k` is the signal on sensor :math:`k` provided by the\n+        forward model for a source with unit amplitude, :math:`a` is the\n+        source amplitude, :math:`N` is the number of sensors, and\n+        :math:`s_k^2` is the noise variance on sensor :math:`k`.\n+        \"\"\"\n+        from .forward import convert_forward_solution\n+        from .minimum_norm.inverse import _prepare_forward\n+        snr_stc = self.copy()","path":"mne/source_estimate.py","position":54,"original_position":54,"commit_id":"e9146a129c1840516f288c5ca6382b8dc570b5dd","original_commit_id":"e9146a129c1840516f288c5ca6382b8dc570b5dd","user":{"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},"body":"I have other fish to fry for the time being, feel free to take this over if you have time and need it","created_at":"2015-04-16T22:51:25Z","updated_at":"2015-04-16T22:51:25Z","html_url":"https://github.com/mne-tools/mne-python/pull/1958#discussion_r28557316","pull_request_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/1958","_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/28557316"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/1958#discussion_r28557316"},"pull_request":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/1958"}}},"pull_request":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/1958","id":33125895,"html_url":"https://github.com/mne-tools/mne-python/pull/1958","diff_url":"https://github.com/mne-tools/mne-python/pull/1958.diff","patch_url":"https://github.com/mne-tools/mne-python/pull/1958.patch","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/1958","number":1958,"state":"open","locked":false,"title":"WIP: Source space SNR","user":{"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},"body":"Closes #1453.\r\n\r\nWIP -- I'm not on Py2 here so I can't actually look at the results, but they should match the paper. Should probably figure out how to deal with free vs fixed orientation -- might be worth saying for a first pass that it only works for a forward solution in fixed orientation / forward that can be converted to fixed and surf ori.","created_at":"2015-04-12T20:29:07Z","updated_at":"2015-04-16T22:51:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d64f97511c70210fc52fea0430dd8165cb574ece","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/1958/commits","review_comments_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/1958/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/1958/comments","statuses_url":"https://api.github.com/repos/mne-tools/mne-python/statuses/e9146a129c1840516f288c5ca6382b8dc570b5dd","head":{"label":"Eric89GXL:source-snr","ref":"source-snr","sha":"e9146a129c1840516f288c5ca6382b8dc570b5dd","user":{"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},"repo":{"id":5848067,"name":"mne-python","full_name":"Eric89GXL/mne-python","owner":{"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},"private":false,"html_url":"https://github.com/Eric89GXL/mne-python","description":"MNE scripting with Python","fork":true,"url":"https://api.github.com/repos/Eric89GXL/mne-python","forks_url":"https://api.github.com/repos/Eric89GXL/mne-python/forks","keys_url":"https://api.github.com/repos/Eric89GXL/mne-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Eric89GXL/mne-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Eric89GXL/mne-python/teams","hooks_url":"https://api.github.com/repos/Eric89GXL/mne-python/hooks","issue_events_url":"https://api.github.com/repos/Eric89GXL/mne-python/issues/events{/number}","events_url":"https://api.github.com/repos/Eric89GXL/mne-python/events","assignees_url":"https://api.github.com/repos/Eric89GXL/mne-python/assignees{/user}","branches_url":"https://api.github.com/repos/Eric89GXL/mne-python/branches{/branch}","tags_url":"https://api.github.com/repos/Eric89GXL/mne-python/tags","blobs_url":"https://api.github.com/repos/Eric89GXL/mne-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Eric89GXL/mne-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Eric89GXL/mne-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/Eric89GXL/mne-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Eric89GXL/mne-python/statuses/{sha}","languages_url":"https://api.github.com/repos/Eric89GXL/mne-python/languages","stargazers_url":"https://api.github.com/repos/Eric89GXL/mne-python/stargazers","contributors_url":"https://api.github.com/repos/Eric89GXL/mne-python/contributors","subscribers_url":"https://api.github.com/repos/Eric89GXL/mne-python/subscribers","subscription_url":"https://api.github.com/repos/Eric89GXL/mne-python/subscription","commits_url":"https://api.github.com/repos/Eric89GXL/mne-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/Eric89GXL/mne-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/Eric89GXL/mne-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/Eric89GXL/mne-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/Eric89GXL/mne-python/contents/{+path}","compare_url":"https://api.github.com/repos/Eric89GXL/mne-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Eric89GXL/mne-python/merges","archive_url":"https://api.github.com/repos/Eric89GXL/mne-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Eric89GXL/mne-python/downloads","issues_url":"https://api.github.com/repos/Eric89GXL/mne-python/issues{/number}","pulls_url":"https://api.github.com/repos/Eric89GXL/mne-python/pulls{/number}","milestones_url":"https://api.github.com/repos/Eric89GXL/mne-python/milestones{/number}","notifications_url":"https://api.github.com/repos/Eric89GXL/mne-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Eric89GXL/mne-python/labels{/name}","releases_url":"https://api.github.com/repos/Eric89GXL/mne-python/releases{/id}","created_at":"2012-09-17T22:08:11Z","updated_at":"2015-04-14T17:25:01Z","pushed_at":"2015-04-16T19:02:12Z","git_url":"git://github.com/Eric89GXL/mne-python.git","ssh_url":"git@github.com:Eric89GXL/mne-python.git","clone_url":"https://github.com/Eric89GXL/mne-python.git","svn_url":"https://github.com/Eric89GXL/mne-python","homepage":"http://martinos.org/mne/","size":78863,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"mne-tools:master","ref":"master","sha":"f34ca35a519927596f8f4e1357c6d00b0e42145a","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-15T15:57:32Z","pushed_at":"2015-04-16T18:28:45Z","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":165853,"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":140,"forks":110,"open_issues":140,"watchers":126,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/1958"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/1958"},"issue":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/1958"},"comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/1958/comments"},"review_comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/1958/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/1958/commits"},"statuses":{"href":"https://api.github.com/repos/mne-tools/mne-python/statuses/e9146a129c1840516f288c5ca6382b8dc570b5dd"}}}}