{"action":"created","comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/182450231","pull_request_review_id":113246330,"id":182450231,"diff_hunk":"@@ -0,0 +1,345 @@\n+# -*- coding: UTF-8 -*-\n+# Copyright (c) 2018, Thomas Hartmann & Dirk Gütlin\n+# Authors: Thomas Hartmann <thomas.hartmann@th-ht.de>\n+#          Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at>\n+#\n+# License: BSD (3-clause)\n+\n+import mne\n+import numpy as np\n+\n+def _check_pymatreader():\n+    \"\"\"Helper to check if pymatreader and h5py are installed\"\"\"\n+    try:\n+        from ..externals import pymatreader\n+    except ImportError:\n+        raise ImportError('The h5py module is required to use the FieldTrip '\n+                          'import functions.')\n+    return pymatreader\n+\n+def read_raw_fieldtrip(ft_structure_path, data_name='data'):\n+    \"\"\"Load continuous (i.e. raw) data from a FieldTrip preprocessing structure.\n+\n+    This function expects to find single trial raw data (FT_DATATYPE_RAW) in\n+    the structure data_name is pointing at.\n+\n+    Parameters\n+    ----------\n+    ft_structure_path: str\n+        Path and filename of the .mat file containing the data.\n+    data_name: str\n+        Name of heading dict/ variable name under which the data was originally\n+        saved in MATLAB.\n+\n+    Returns\n+    -------\n+    mne.io.RawArray\n+        A MNE RawArray structure consisting of the raw array and measurement\n+        info\n+\n+    \"\"\"\n+    pymatreader = _check_pymatreader()\n+\n+    ft_struct = pymatreader.read_mat(ft_structure_path,\n+                                     ignore_fields=['previous'],\n+                                     variable_names=[data_name])\n+\n+    # load data and set ft_struct to the heading dictionary\n+    ft_struct = ft_struct[data_name]\n+\n+    data = np.array(ft_struct['trial'])  # create the main data array\n+    info = _create_info(ft_struct)  # create info structure\n+\n+    custom_raw = mne.io.RawArray(data, info)  # create an MNE RawArray\n+    return custom_raw\n+\n+\n+def read_epochs_fieldtrip(ft_structure_path, data_name='data',\n+                         trialinfo_map=None,\n+                   omit_trialinfo_index=True,\n+                   omit_non_unique_trialinfo_index=True):\n+    \"\"\"Load epoched data from a FieldTrip preprocessing structure.\n+\n+    This function expects to find epoched data in the structure data_name is\n+    pointing at.\n+\n+    .. warning:: Only epochs with the same amount of channels and samples are\n+                 supported!\n+\n+    The data is read as it is. Events however are represented entirely","path":"mne/io/fieldtrip.py","position":71,"original_position":69,"commit_id":"f66749f4ff484bb2943c85683d288f8792b01572","original_commit_id":"36b7039d61e842c8d3acac4e25ae9d394aeb60d7","user":{"login":"larsoner","id":2365790,"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":"This is getting too long. This should be moved to a `Notes` section.","created_at":"2018-04-18T14:35:59Z","updated_at":"2018-04-18T14:38:55Z","html_url":"https://github.com/mne-tools/mne-python/pull/5141#discussion_r182450231","pull_request_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/5141","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/182450231"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/5141#discussion_r182450231"},"pull_request":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/5141"}}},"pull_request":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/5141","id":182444969,"html_url":"https://github.com/mne-tools/mne-python/pull/5141","diff_url":"https://github.com/mne-tools/mne-python/pull/5141.diff","patch_url":"https://github.com/mne-tools/mne-python/pull/5141.patch","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/5141","number":5141,"state":"open","locked":false,"title":"WIP: Add reader functions for FieldTrip data","user":{"login":"thht","id":7392715,"avatar_url":"https://avatars2.githubusercontent.com/u/7392715?v=4","gravatar_id":"","url":"https://api.github.com/users/thht","html_url":"https://github.com/thht","followers_url":"https://api.github.com/users/thht/followers","following_url":"https://api.github.com/users/thht/following{/other_user}","gists_url":"https://api.github.com/users/thht/gists{/gist_id}","starred_url":"https://api.github.com/users/thht/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thht/subscriptions","organizations_url":"https://api.github.com/users/thht/orgs","repos_url":"https://api.github.com/users/thht/repos","events_url":"https://api.github.com/users/thht/events{/privacy}","received_events_url":"https://api.github.com/users/thht/received_events","type":"User","site_admin":false},"body":"This pull request adds reader functions for FieldTrip data as outlined in issue #4833.\r\nIt has WIP status because test data needs to merged into mne-testing-data before it can be merged. I already made that PR.\r\nDocumentation should follow MNE standards.\r\ntests pass except for test_read_ctf, test_module_nesting and test_plot_evoked_cov. the latter is a locale issue on my machine. no idea about the first two but i doubt it relates to this PR.","created_at":"2018-04-18T11:12:32Z","updated_at":"2018-04-18T14:38:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a92ab4894f9eaee5cee4fec4e36f55baac6a371c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/5141/commits","review_comments_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/5141/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/5141/comments","statuses_url":"https://api.github.com/repos/mne-tools/mne-python/statuses/f66749f4ff484bb2943c85683d288f8792b01572","head":{"label":"thht:th/add_fieldtrip2mne","ref":"th/add_fieldtrip2mne","sha":"f66749f4ff484bb2943c85683d288f8792b01572","user":{"login":"thht","id":7392715,"avatar_url":"https://avatars2.githubusercontent.com/u/7392715?v=4","gravatar_id":"","url":"https://api.github.com/users/thht","html_url":"https://github.com/thht","followers_url":"https://api.github.com/users/thht/followers","following_url":"https://api.github.com/users/thht/following{/other_user}","gists_url":"https://api.github.com/users/thht/gists{/gist_id}","starred_url":"https://api.github.com/users/thht/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thht/subscriptions","organizations_url":"https://api.github.com/users/thht/orgs","repos_url":"https://api.github.com/users/thht/repos","events_url":"https://api.github.com/users/thht/events{/privacy}","received_events_url":"https://api.github.com/users/thht/received_events","type":"User","site_admin":false},"repo":{"id":130023247,"name":"mne-python","full_name":"thht/mne-python","owner":{"login":"thht","id":7392715,"avatar_url":"https://avatars2.githubusercontent.com/u/7392715?v=4","gravatar_id":"","url":"https://api.github.com/users/thht","html_url":"https://github.com/thht","followers_url":"https://api.github.com/users/thht/followers","following_url":"https://api.github.com/users/thht/following{/other_user}","gists_url":"https://api.github.com/users/thht/gists{/gist_id}","starred_url":"https://api.github.com/users/thht/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thht/subscriptions","organizations_url":"https://api.github.com/users/thht/orgs","repos_url":"https://api.github.com/users/thht/repos","events_url":"https://api.github.com/users/thht/events{/privacy}","received_events_url":"https://api.github.com/users/thht/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thht/mne-python","description":"MNE : Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python","fork":true,"url":"https://api.github.com/repos/thht/mne-python","forks_url":"https://api.github.com/repos/thht/mne-python/forks","keys_url":"https://api.github.com/repos/thht/mne-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thht/mne-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thht/mne-python/teams","hooks_url":"https://api.github.com/repos/thht/mne-python/hooks","issue_events_url":"https://api.github.com/repos/thht/mne-python/issues/events{/number}","events_url":"https://api.github.com/repos/thht/mne-python/events","assignees_url":"https://api.github.com/repos/thht/mne-python/assignees{/user}","branches_url":"https://api.github.com/repos/thht/mne-python/branches{/branch}","tags_url":"https://api.github.com/repos/thht/mne-python/tags","blobs_url":"https://api.github.com/repos/thht/mne-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thht/mne-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thht/mne-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/thht/mne-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thht/mne-python/statuses/{sha}","languages_url":"https://api.github.com/repos/thht/mne-python/languages","stargazers_url":"https://api.github.com/repos/thht/mne-python/stargazers","contributors_url":"https://api.github.com/repos/thht/mne-python/contributors","subscribers_url":"https://api.github.com/repos/thht/mne-python/subscribers","subscription_url":"https://api.github.com/repos/thht/mne-python/subscription","commits_url":"https://api.github.com/repos/thht/mne-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/thht/mne-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/thht/mne-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/thht/mne-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/thht/mne-python/contents/{+path}","compare_url":"https://api.github.com/repos/thht/mne-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thht/mne-python/merges","archive_url":"https://api.github.com/repos/thht/mne-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thht/mne-python/downloads","issues_url":"https://api.github.com/repos/thht/mne-python/issues{/number}","pulls_url":"https://api.github.com/repos/thht/mne-python/pulls{/number}","milestones_url":"https://api.github.com/repos/thht/mne-python/milestones{/number}","notifications_url":"https://api.github.com/repos/thht/mne-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thht/mne-python/labels{/name}","releases_url":"https://api.github.com/repos/thht/mne-python/releases{/id}","deployments_url":"https://api.github.com/repos/thht/mne-python/deployments","created_at":"2018-04-18T07:40:10Z","updated_at":"2018-04-18T07:40:16Z","pushed_at":"2018-04-18T14:38:43Z","git_url":"git://github.com/thht/mne-python.git","ssh_url":"git@github.com:thht/mne-python.git","clone_url":"https://github.com/thht/mne-python.git","svn_url":"https://github.com/thht/mne-python","homepage":"http://martinos.org/mne/","size":100316,"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,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mne-tools:master","ref":"master","sha":"1dc1502215a53385cda15c6c336fcc4341dc4d3b","user":{"login":"mne-tools","id":583875,"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,"name":"mne-python","full_name":"mne-tools/mne-python","owner":{"login":"mne-tools","id":583875,"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},"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}","deployments_url":"https://api.github.com/repos/mne-tools/mne-python/deployments","created_at":"2011-01-28T03:31:13Z","updated_at":"2018-04-18T13:21:12Z","pushed_at":"2018-04-18T14:38:44Z","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":99260,"stargazers_count":441,"watchers_count":441,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":390,"mirror_url":null,"archived":false,"open_issues_count":225,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":390,"open_issues":225,"watchers":441,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/5141"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/5141"},"issue":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/5141"},"comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/5141/comments"},"review_comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/5141/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/5141/commits"},"statuses":{"href":"https://api.github.com/repos/mne-tools/mne-python/statuses/f66749f4ff484bb2943c85683d288f8792b01572"}},"author_association":"NONE"}}
{"actor":{"display_login":"larsoner"}}