{"action":"created","comment":{"url":"https://api.github.com/repos/mne-tools/mne-sandbox/pulls/comments/72355141","id":72355141,"diff_hunk":"@@ -121,17 +121,129 @@ def phase_amplitude_coupling(inst, f_phase, f_amp, ixs, pac_func='ozkurt',\n         return pac, freq_pac\n \n \n+class PAC(object):\n+    \"\"\"A PAC estimator with a sklearn-style API.\n+\n+    This will return the PAC of each trial. It expects Raw-style data, and uses\n+    event times to construct windows around each event onset.\n+\n+    Parameters\n+    ----------\n+    f_phase : array, dtype float, shape (n_bands_phase, 2,)\n+        The frequency ranges to use for the phase carrier. PAC will be\n+        calculated between n_bands_phase * n_bands_amp frequencies.\n+    f_amp : array, dtype float, shape (n_bands_amp, 2,)\n+        The frequency ranges to use for the phase-modulated amplitude.\n+        PAC will be calculated between n_bands_phase * n_bands_amp frequencies.\n+    ixs : array-like, shape (n_ch_pairs x 2)\n+        The indices for low/high frequency channels. PAC will be estimated\n+        between n_ch_pairs of channels. Indices correspond to rows of `data`.\n+    sfreq : float\n+        The sampling frequency of the data.\n+    events : array, shape (n_events, 3) | array, shape (n_events,) | None\n+        MNE events array. To be supplied if data is 2D and output should be\n+        split by events. In this case, `tmin` and `tmax` must be provided. If\n+        `ndim == 1`, it is assumed to be event indices, and all events will be\n+        grouped together.\n+    times : array, shape (n_times,) | None\n+        An array of times corresponding to the final axis of inputs. Will be\n+        used in conjunction with tmin/tmax if `events` is None.\n+    pac_func : {'plv', 'glm', 'mi_canolty', 'mi_tort', 'ozkurt'}\n+        The function for estimating PAC. Corresponds to functions in\n+        `pacpy.pac`. Defaults to 'ozkurt'. If multiple frequency bands are used\n+        then `plv` cannot be calculated.\n+    tmin : float | list of floats, shape (n_pac_windows,) | None\n+        If `events` is not provided, it is the start time to use in `inst`.\n+        If `events` is provided, it is the time (in seconds) to include before\n+        each event index. If a list of floats is given, then PAC is calculated\n+        for each pair of `tmin` and `tmax`. Defaults to `min(inst.times)`.\n+    tmax : float | list of floats, shape (n_pac_windows,) | None\n+        If `events` is not provided, it is the stop time to use in `inst`.\n+        If `events` is provided, it is the time (in seconds) to include after\n+        each event index. If a list of floats is given, then PAC is calculated\n+        for each pair of `tmin` and `tmax`. Defaults to `max(inst.n_times)`.\n+    n_cycles_ph : float, int | array of floats, shape (n_bands_phase,)\n+        The number of cycles to be included in the window for each band-pass\n+        filter for phase. Defaults to 3.\n+    n_cycles_am : float, int | array of floats, shape (n_bands_amp,)\n+        The number of cycles to be included in the window for each band-pass\n+        filter for amplitude. Defaults to 3.\n+    scale_amp_func : None | function\n+        If not None, will be called on each amplitude signal in order to scale\n+        the values. Function must accept an N-D input and will operate on the\n+        last dimension. E.g., `sklearn.preprocessing.scale`.\n+        Defaults to no scaling.\n+    n_jobs : int\n+        Number of jobs to run in parallel. Defaults to 1.\n+    \"\"\"\n+    def __init__(self, f_phase, f_amp, ixs, sfreq, events=None, times=None,\n+                 pac_func='ozkurt', tmin=0., tmax=1., n_cycles_ph=3,\n+                 n_cycles_am=3, scale_amp_func=None, n_jobs=1):\n+        if self.events is not None and self.times is not None:\n+            raise ValueError('Must supply one of events and times, not both')\n+        self.f_phase = f_phase\n+        self.f_amp = f_amp\n+        self.ixs = ixs\n+        self.sfreq = sfreq\n+        self.pac_func = pac_func\n+        self.events = events\n+        self.times = times\n+        self.tmin = tmin\n+        self.tmax = tmax\n+        self.n_cycles_ph = n_cycles_ph\n+        self.n_cycles_am = n_cycles_am\n+        self.scale_amp_func = scale_amp_func\n+        self.n_jobs = n_jobs","path":"mne_sandbox/connectivity/cfc.py","position":85,"original_position":85,"commit_id":"dbb55bcb00f9cd9670698b479675b93a266e9818","original_commit_id":"dbb55bcb00f9cd9670698b479675b93a266e9818","user":{"login":"choldgraf","id":1839645,"avatar_url":"https://avatars.githubusercontent.com/u/1839645?v=3","gravatar_id":"","url":"https://api.github.com/users/choldgraf","html_url":"https://github.com/choldgraf","followers_url":"https://api.github.com/users/choldgraf/followers","following_url":"https://api.github.com/users/choldgraf/following{/other_user}","gists_url":"https://api.github.com/users/choldgraf/gists{/gist_id}","starred_url":"https://api.github.com/users/choldgraf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choldgraf/subscriptions","organizations_url":"https://api.github.com/users/choldgraf/orgs","repos_url":"https://api.github.com/users/choldgraf/repos","events_url":"https://api.github.com/users/choldgraf/events{/privacy}","received_events_url":"https://api.github.com/users/choldgraf/received_events","type":"User","site_admin":false},"body":"isn't that going to duplicate all the checks that are inside `_phase_amplitude_coupling` though? ","created_at":"2016-07-26T23:12:36Z","updated_at":"2016-07-26T23:12:36Z","html_url":"https://github.com/mne-tools/mne-sandbox/pull/16#discussion_r72355141","pull_request_url":"https://api.github.com/repos/mne-tools/mne-sandbox/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-sandbox/pulls/comments/72355141"},"html":{"href":"https://github.com/mne-tools/mne-sandbox/pull/16#discussion_r72355141"},"pull_request":{"href":"https://api.github.com/repos/mne-tools/mne-sandbox/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/mne-tools/mne-sandbox/pulls/16","id":78933191,"html_url":"https://github.com/mne-tools/mne-sandbox/pull/16","diff_url":"https://github.com/mne-tools/mne-sandbox/pull/16.diff","patch_url":"https://github.com/mne-tools/mne-sandbox/pull/16.patch","issue_url":"https://api.github.com/repos/mne-tools/mne-sandbox/issues/16","number":16,"state":"open","locked":false,"title":"adding sklearn-style PAC estimator","user":{"login":"choldgraf","id":1839645,"avatar_url":"https://avatars.githubusercontent.com/u/1839645?v=3","gravatar_id":"","url":"https://api.github.com/users/choldgraf","html_url":"https://github.com/choldgraf","followers_url":"https://api.github.com/users/choldgraf/followers","following_url":"https://api.github.com/users/choldgraf/following{/other_user}","gists_url":"https://api.github.com/users/choldgraf/gists{/gist_id}","starred_url":"https://api.github.com/users/choldgraf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choldgraf/subscriptions","organizations_url":"https://api.github.com/users/choldgraf/orgs","repos_url":"https://api.github.com/users/choldgraf/repos","events_url":"https://api.github.com/users/choldgraf/events{/privacy}","received_events_url":"https://api.github.com/users/choldgraf/received_events","type":"User","site_admin":false},"body":"Is this what you had in mind @kingjr? LMKWYT and I can make edits. If it looks good I can add tests.","created_at":"2016-07-26T21:59:57Z","updated_at":"2016-07-26T23:12:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b44e3e5dcae9e898caa01ca8375ffe50cd668212","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mne-tools/mne-sandbox/pulls/16/commits","review_comments_url":"https://api.github.com/repos/mne-tools/mne-sandbox/pulls/16/comments","review_comment_url":"https://api.github.com/repos/mne-tools/mne-sandbox/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mne-tools/mne-sandbox/issues/16/comments","statuses_url":"https://api.github.com/repos/mne-tools/mne-sandbox/statuses/dbb55bcb00f9cd9670698b479675b93a266e9818","head":{"label":"choldgraf:cfc_sklearn","ref":"cfc_sklearn","sha":"dbb55bcb00f9cd9670698b479675b93a266e9818","user":{"login":"choldgraf","id":1839645,"avatar_url":"https://avatars.githubusercontent.com/u/1839645?v=3","gravatar_id":"","url":"https://api.github.com/users/choldgraf","html_url":"https://github.com/choldgraf","followers_url":"https://api.github.com/users/choldgraf/followers","following_url":"https://api.github.com/users/choldgraf/following{/other_user}","gists_url":"https://api.github.com/users/choldgraf/gists{/gist_id}","starred_url":"https://api.github.com/users/choldgraf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choldgraf/subscriptions","organizations_url":"https://api.github.com/users/choldgraf/orgs","repos_url":"https://api.github.com/users/choldgraf/repos","events_url":"https://api.github.com/users/choldgraf/events{/privacy}","received_events_url":"https://api.github.com/users/choldgraf/received_events","type":"User","site_admin":false},"repo":{"id":56100249,"name":"mne-sandbox","full_name":"choldgraf/mne-sandbox","owner":{"login":"choldgraf","id":1839645,"avatar_url":"https://avatars.githubusercontent.com/u/1839645?v=3","gravatar_id":"","url":"https://api.github.com/users/choldgraf","html_url":"https://github.com/choldgraf","followers_url":"https://api.github.com/users/choldgraf/followers","following_url":"https://api.github.com/users/choldgraf/following{/other_user}","gists_url":"https://api.github.com/users/choldgraf/gists{/gist_id}","starred_url":"https://api.github.com/users/choldgraf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choldgraf/subscriptions","organizations_url":"https://api.github.com/users/choldgraf/orgs","repos_url":"https://api.github.com/users/choldgraf/repos","events_url":"https://api.github.com/users/choldgraf/events{/privacy}","received_events_url":"https://api.github.com/users/choldgraf/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/choldgraf/mne-sandbox","description":"experimental mne-python code","fork":true,"url":"https://api.github.com/repos/choldgraf/mne-sandbox","forks_url":"https://api.github.com/repos/choldgraf/mne-sandbox/forks","keys_url":"https://api.github.com/repos/choldgraf/mne-sandbox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/choldgraf/mne-sandbox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/choldgraf/mne-sandbox/teams","hooks_url":"https://api.github.com/repos/choldgraf/mne-sandbox/hooks","issue_events_url":"https://api.github.com/repos/choldgraf/mne-sandbox/issues/events{/number}","events_url":"https://api.github.com/repos/choldgraf/mne-sandbox/events","assignees_url":"https://api.github.com/repos/choldgraf/mne-sandbox/assignees{/user}","branches_url":"https://api.github.com/repos/choldgraf/mne-sandbox/branches{/branch}","tags_url":"https://api.github.com/repos/choldgraf/mne-sandbox/tags","blobs_url":"https://api.github.com/repos/choldgraf/mne-sandbox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/choldgraf/mne-sandbox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/choldgraf/mne-sandbox/git/refs{/sha}","trees_url":"https://api.github.com/repos/choldgraf/mne-sandbox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/choldgraf/mne-sandbox/statuses/{sha}","languages_url":"https://api.github.com/repos/choldgraf/mne-sandbox/languages","stargazers_url":"https://api.github.com/repos/choldgraf/mne-sandbox/stargazers","contributors_url":"https://api.github.com/repos/choldgraf/mne-sandbox/contributors","subscribers_url":"https://api.github.com/repos/choldgraf/mne-sandbox/subscribers","subscription_url":"https://api.github.com/repos/choldgraf/mne-sandbox/subscription","commits_url":"https://api.github.com/repos/choldgraf/mne-sandbox/commits{/sha}","git_commits_url":"https://api.github.com/repos/choldgraf/mne-sandbox/git/commits{/sha}","comments_url":"https://api.github.com/repos/choldgraf/mne-sandbox/comments{/number}","issue_comment_url":"https://api.github.com/repos/choldgraf/mne-sandbox/issues/comments{/number}","contents_url":"https://api.github.com/repos/choldgraf/mne-sandbox/contents/{+path}","compare_url":"https://api.github.com/repos/choldgraf/mne-sandbox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/choldgraf/mne-sandbox/merges","archive_url":"https://api.github.com/repos/choldgraf/mne-sandbox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/choldgraf/mne-sandbox/downloads","issues_url":"https://api.github.com/repos/choldgraf/mne-sandbox/issues{/number}","pulls_url":"https://api.github.com/repos/choldgraf/mne-sandbox/pulls{/number}","milestones_url":"https://api.github.com/repos/choldgraf/mne-sandbox/milestones{/number}","notifications_url":"https://api.github.com/repos/choldgraf/mne-sandbox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/choldgraf/mne-sandbox/labels{/name}","releases_url":"https://api.github.com/repos/choldgraf/mne-sandbox/releases{/id}","deployments_url":"https://api.github.com/repos/choldgraf/mne-sandbox/deployments","created_at":"2016-04-12T21:48:53Z","updated_at":"2016-04-12T21:48:54Z","pushed_at":"2016-07-26T22:28:58Z","git_url":"git://github.com/choldgraf/mne-sandbox.git","ssh_url":"git@github.com:choldgraf/mne-sandbox.git","clone_url":"https://github.com/choldgraf/mne-sandbox.git","svn_url":"https://github.com/choldgraf/mne-sandbox","homepage":null,"size":90,"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":"bd559e37bbcb08a0bae3ca229b5e8a893e5afb92","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":53668965,"name":"mne-sandbox","full_name":"mne-tools/mne-sandbox","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-sandbox","description":"experimental mne-python code","fork":false,"url":"https://api.github.com/repos/mne-tools/mne-sandbox","forks_url":"https://api.github.com/repos/mne-tools/mne-sandbox/forks","keys_url":"https://api.github.com/repos/mne-tools/mne-sandbox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mne-tools/mne-sandbox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mne-tools/mne-sandbox/teams","hooks_url":"https://api.github.com/repos/mne-tools/mne-sandbox/hooks","issue_events_url":"https://api.github.com/repos/mne-tools/mne-sandbox/issues/events{/number}","events_url":"https://api.github.com/repos/mne-tools/mne-sandbox/events","assignees_url":"https://api.github.com/repos/mne-tools/mne-sandbox/assignees{/user}","branches_url":"https://api.github.com/repos/mne-tools/mne-sandbox/branches{/branch}","tags_url":"https://api.github.com/repos/mne-tools/mne-sandbox/tags","blobs_url":"https://api.github.com/repos/mne-tools/mne-sandbox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mne-tools/mne-sandbox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mne-tools/mne-sandbox/git/refs{/sha}","trees_url":"https://api.github.com/repos/mne-tools/mne-sandbox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mne-tools/mne-sandbox/statuses/{sha}","languages_url":"https://api.github.com/repos/mne-tools/mne-sandbox/languages","stargazers_url":"https://api.github.com/repos/mne-tools/mne-sandbox/stargazers","contributors_url":"https://api.github.com/repos/mne-tools/mne-sandbox/contributors","subscribers_url":"https://api.github.com/repos/mne-tools/mne-sandbox/subscribers","subscription_url":"https://api.github.com/repos/mne-tools/mne-sandbox/subscription","commits_url":"https://api.github.com/repos/mne-tools/mne-sandbox/commits{/sha}","git_commits_url":"https://api.github.com/repos/mne-tools/mne-sandbox/git/commits{/sha}","comments_url":"https://api.github.com/repos/mne-tools/mne-sandbox/comments{/number}","issue_comment_url":"https://api.github.com/repos/mne-tools/mne-sandbox/issues/comments{/number}","contents_url":"https://api.github.com/repos/mne-tools/mne-sandbox/contents/{+path}","compare_url":"https://api.github.com/repos/mne-tools/mne-sandbox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mne-tools/mne-sandbox/merges","archive_url":"https://api.github.com/repos/mne-tools/mne-sandbox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mne-tools/mne-sandbox/downloads","issues_url":"https://api.github.com/repos/mne-tools/mne-sandbox/issues{/number}","pulls_url":"https://api.github.com/repos/mne-tools/mne-sandbox/pulls{/number}","milestones_url":"https://api.github.com/repos/mne-tools/mne-sandbox/milestones{/number}","notifications_url":"https://api.github.com/repos/mne-tools/mne-sandbox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mne-tools/mne-sandbox/labels{/name}","releases_url":"https://api.github.com/repos/mne-tools/mne-sandbox/releases{/id}","deployments_url":"https://api.github.com/repos/mne-tools/mne-sandbox/deployments","created_at":"2016-03-11T13:30:09Z","updated_at":"2016-07-25T02:01:49Z","pushed_at":"2016-07-26T22:28:58Z","git_url":"git://github.com/mne-tools/mne-sandbox.git","ssh_url":"git@github.com:mne-tools/mne-sandbox.git","clone_url":"https://github.com/mne-tools/mne-sandbox.git","svn_url":"https://github.com/mne-tools/mne-sandbox","homepage":null,"size":166,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":6,"forks":12,"open_issues":6,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-sandbox/pulls/16"},"html":{"href":"https://github.com/mne-tools/mne-sandbox/pull/16"},"issue":{"href":"https://api.github.com/repos/mne-tools/mne-sandbox/issues/16"},"comments":{"href":"https://api.github.com/repos/mne-tools/mne-sandbox/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/mne-tools/mne-sandbox/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/mne-tools/mne-sandbox/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mne-tools/mne-sandbox/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/mne-tools/mne-sandbox/statuses/dbb55bcb00f9cd9670698b479675b93a266e9818"}}}}
{"actor":{"display_login":"choldgraf"}}