GitHub PullRequestReviewCommentEvent at 2014-11-21 16:14:15
Repository: mne-python
Actor: dengemann
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/20723701","id":20723701,"diff_hunk":"@@ -0,0 +1,409 @@\n+# Authors: Praveen Sripad <praveen.sripad@rwth-aachen.de>\n+#          Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>\n+#\n+# License: BSD (3-clause)\n+\n+import numpy as np\n+from numpy.random import shuffle\n+from scipy import stats\n+from scipy.signal import hilbert, gaussian\n+\n+from ..stats import fdr_correction\n+from ..time_frequency import morlet\n+from ..time_frequency.tfr import cwt\n+from ..preprocessing.peak_finder import peak_finder\n+from ..filter import band_pass_filter\n+from ..parallel import parallel_func\n+from ..utils import logger, check_random_state\n+\n+\n+def _abs_cwt(x, W):\n+    return np.abs(cwt(x, [W], use_fft=False).ravel()).astype(np.float32)\n+\n+\n+def make_surrogate_data(data):\n+    \"\"\"\n+    Returns a copy of the shuffled surrogate data.\n+\n+    Parameters\n+    ----------\n+    data : ndarray, shape (n_epochs, n_times)\n+        Data to be shuffled.\n+\n+    Returns\n+    -------\n+    shuffled_data : ndarray, shape (n_epochs, n_times)\n+        The shuffled data, with each epoch shuffled across n_times.\n+    \"\"\"\n+    shuffled_data = data.copy()\n+    map(shuffle, shuffled_data)\n+    return shuffled_data\n+\n+\n+def generate_pac_signal(sfreq, duration, n_epochs, f_phase, f_amplitude,\n+                        sigma=5, max_amp=1, random_state=None,\n+                        mean=0, std=0.2):\n+    \"\"\"\n+    Generate a phase amplitude coupled signal based on the given parameters.\n+\n+    A phase amplitude coupled signal of given duration and n_epochs with\n+    varying amounts of phase amplitude coupling based on a gaussian window\n+    is returned.\n+\n+    Parameters\n+    ----------\n+    sfreq : float\n+        Sampling frequency.\n+    duration : float\n+        Time in seconds.\n+    n_epochs : int\n+        Number of epochs to be generated.\n+    f_phase : float\n+        Phase modulating frequency in Hz (eg. 8.).\n+    f_amplitude : float\n+        Amplitude modulated frequency eg. gamma\n+    sigma : float\n+        Standard deviation of gaussian window used. The gaussian window\n+        determines various levels of modulation in the trials.\n+        Default value is 5.\n+    max_amp : float\n+        Constant that determines maximum amplitude of both signals.\n+        Default value is 1.\n+    random_state : None | int | instance of np.random.RandomState\n+        np.random.RandomState to initialize the noise estimation.\n+        Default value is None.\n+    mean : float\n+        Mean of the Gaussian distribution (np.random.normal)\n+        used to generate white noise. Default value is 0.","path":"mne/connectivity/cfc.py","position":77,"original_position":77,"commit_id":"7ad868c7f0998ba283c3c82ecb3f2ac303bb86b1","original_commit_id":"7ad868c7f0998ba283c3c82ecb3f2ac303bb86b1","user":{"login":"dengemann","id":1908618,"avatar_url":"https://avatars.githubusercontent.com/u/1908618?v=3","gravatar_id":"","url":"https://api.github.com/users/dengemann","html_url":"https://github.com/dengemann","followers_url":"https://api.github.com/users/dengemann/followers","following_url":"https://api.github.com/users/dengemann/following{/other_user}","gists_url":"https://api.github.com/users/dengemann/gists{/gist_id}","starred_url":"https://api.github.com/users/dengemann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dengemann/subscriptions","organizations_url":"https://api.github.com/users/dengemann/orgs","repos_url":"https://api.github.com/users/dengemann/repos","events_url":"https://api.github.com/users/dengemann/events{/privacy}","received_events_url":"https://api.github.com/users/dengemann/received_events","type":"User","site_admin":false},"body":"same here, default should be 0.0","created_at":"2014-11-21T16:14:15Z","updated_at":"2014-11-21T16:14:15Z","html_url":"https://github.com/mne-tools/mne-python/pull/1388#discussion_r20723701","pull_request_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/1388","_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/20723701"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/1388#discussion_r20723701"},"pull_request":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/1388"}}},"pull_request":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/1388","id":17546836,"html_url":"https://github.com/mne-tools/mne-python/pull/1388","diff_url":"https://github.com/mne-tools/mne-python/pull/1388.diff","patch_url":"https://github.com/mne-tools/mne-python/pull/1388.patch","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/1388","number":1388,"state":"open","locked":false,"title":"WIP: Implementation of cross frequency coupling. ","user":{"login":"pravsripad","id":4293133,"avatar_url":"https://avatars.githubusercontent.com/u/4293133?v=3","gravatar_id":"","url":"https://api.github.com/users/pravsripad","html_url":"https://github.com/pravsripad","followers_url":"https://api.github.com/users/pravsripad/followers","following_url":"https://api.github.com/users/pravsripad/following{/other_user}","gists_url":"https://api.github.com/users/pravsripad/gists{/gist_id}","starred_url":"https://api.github.com/users/pravsripad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pravsripad/subscriptions","organizations_url":"https://api.github.com/users/pravsripad/orgs","repos_url":"https://api.github.com/users/pravsripad/repos","events_url":"https://api.github.com/users/pravsripad/events{/privacy}","received_events_url":"https://api.github.com/users/pravsripad/received_events","type":"User","site_admin":false},"body":"Includes some functions to compute the cross frequency coupling and the modulation index as described in: - \r\n\r\n1. High gamma power is phase-locked to theta oscillations in human neocortex, Canolty 2006. (http://www.ncbi.nlm.nih.gov/pubmed/16973878)\r\n \r\n2. Measuring phase-amplitude coupling between neuronal oscillations of different frequencies, Tort, 2010.\r\n(http://www.ncbi.nlm.nih.gov/pubmed/20463205)\r\n\r\nThings to be done: - \r\n\r\n1. Extensive testing of implementation with reliable sample data. \r\n2. Improve API, make more mne (structure, documentation, logging etc.)\r\n3. Decide how to integrate / use with raw and epochs. \r\n\r\nAny suggestions/ideas on how best to do this? ","created_at":"2014-06-24T17:52:37Z","updated_at":"2014-11-21T16:14:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fdbb275663d506bd75b37f5883cd44822598047b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/1388/commits","review_comments_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/1388/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/1388/comments","statuses_url":"https://api.github.com/repos/mne-tools/mne-python/statuses/7ad868c7f0998ba283c3c82ecb3f2ac303bb86b1","head":{"label":"pravsripad:cross_freq_coupling","ref":"cross_freq_coupling","sha":"7ad868c7f0998ba283c3c82ecb3f2ac303bb86b1","user":{"login":"pravsripad","id":4293133,"avatar_url":"https://avatars.githubusercontent.com/u/4293133?v=3","gravatar_id":"","url":"https://api.github.com/users/pravsripad","html_url":"https://github.com/pravsripad","followers_url":"https://api.github.com/users/pravsripad/followers","following_url":"https://api.github.com/users/pravsripad/following{/other_user}","gists_url":"https://api.github.com/users/pravsripad/gists{/gist_id}","starred_url":"https://api.github.com/users/pravsripad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pravsripad/subscriptions","organizations_url":"https://api.github.com/users/pravsripad/orgs","repos_url":"https://api.github.com/users/pravsripad/repos","events_url":"https://api.github.com/users/pravsripad/events{/privacy}","received_events_url":"https://api.github.com/users/pravsripad/received_events","type":"User","site_admin":false},"repo":{"id":10476105,"name":"mne-python","full_name":"pravsripad/mne-python","owner":{"login":"pravsripad","id":4293133,"avatar_url":"https://avatars.githubusercontent.com/u/4293133?v=3","gravatar_id":"","url":"https://api.github.com/users/pravsripad","html_url":"https://github.com/pravsripad","followers_url":"https://api.github.com/users/pravsripad/followers","following_url":"https://api.github.com/users/pravsripad/following{/other_user}","gists_url":"https://api.github.com/users/pravsripad/gists{/gist_id}","starred_url":"https://api.github.com/users/pravsripad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pravsripad/subscriptions","organizations_url":"https://api.github.com/users/pravsripad/orgs","repos_url":"https://api.github.com/users/pravsripad/repos","events_url":"https://api.github.com/users/pravsripad/events{/privacy}","received_events_url":"https://api.github.com/users/pravsripad/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pravsripad/mne-python","description":"MNE : Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python","fork":true,"url":"https://api.github.com/repos/pravsripad/mne-python","forks_url":"https://api.github.com/repos/pravsripad/mne-python/forks","keys_url":"https://api.github.com/repos/pravsripad/mne-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pravsripad/mne-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pravsripad/mne-python/teams","hooks_url":"https://api.github.com/repos/pravsripad/mne-python/hooks","issue_events_url":"https://api.github.com/repos/pravsripad/mne-python/issues/events{/number}","events_url":"https://api.github.com/repos/pravsripad/mne-python/events","assignees_url":"https://api.github.com/repos/pravsripad/mne-python/assignees{/user}","branches_url":"https://api.github.com/repos/pravsripad/mne-python/branches{/branch}","tags_url":"https://api.github.com/repos/pravsripad/mne-python/tags","blobs_url":"https://api.github.com/repos/pravsripad/mne-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pravsripad/mne-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pravsripad/mne-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/pravsripad/mne-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pravsripad/mne-python/statuses/{sha}","languages_url":"https://api.github.com/repos/pravsripad/mne-python/languages","stargazers_url":"https://api.github.com/repos/pravsripad/mne-python/stargazers","contributors_url":"https://api.github.com/repos/pravsripad/mne-python/contributors","subscribers_url":"https://api.github.com/repos/pravsripad/mne-python/subscribers","subscription_url":"https://api.github.com/repos/pravsripad/mne-python/subscription","commits_url":"https://api.github.com/repos/pravsripad/mne-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/pravsripad/mne-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/pravsripad/mne-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/pravsripad/mne-python/issues/comments/{number}","contents_url":"https://api.github.com/repos/pravsripad/mne-python/contents/{+path}","compare_url":"https://api.github.com/repos/pravsripad/mne-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pravsripad/mne-python/merges","archive_url":"https://api.github.com/repos/pravsripad/mne-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pravsripad/mne-python/downloads","issues_url":"https://api.github.com/repos/pravsripad/mne-python/issues{/number}","pulls_url":"https://api.github.com/repos/pravsripad/mne-python/pulls{/number}","milestones_url":"https://api.github.com/repos/pravsripad/mne-python/milestones{/number}","notifications_url":"https://api.github.com/repos/pravsripad/mne-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pravsripad/mne-python/labels{/name}","releases_url":"https://api.github.com/repos/pravsripad/mne-python/releases{/id}","created_at":"2013-06-04T10:20:16Z","updated_at":"2014-11-21T15:29:45Z","pushed_at":"2014-11-21T15:29:45Z","git_url":"git://github.com/pravsripad/mne-python.git","ssh_url":"git@github.com:pravsripad/mne-python.git","clone_url":"https://github.com/pravsripad/mne-python.git","svn_url":"https://github.com/pravsripad/mne-python","homepage":"http://martinos.org/mne/","size":73484,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master_dev"}},"base":{"label":"mne-tools:master","ref":"master","sha":"0d0879b2395ecb302dd2bf4b4e14d5f25a87ccfe","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":"2014-11-21T13:07:03Z","pushed_at":"2014-11-21T07:06:58Z","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":166916,"stargazers_count":103,"watchers_count":103,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":94,"mirror_url":null,"open_issues_count":134,"forks":94,"open_issues":134,"watchers":103,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/1388"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/1388"},"issue":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/1388"},"comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/1388/comments"},"review_comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/1388/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/1388/commits"},"statuses":{"href":"https://api.github.com/repos/mne-tools/mne-python/statuses/7ad868c7f0998ba283c3c82ecb3f2ac303bb86b1"}}}}