{"action":"created","comment":{"url":"https://api.github.com/repos/mne-tools/mne-bids/pulls/comments/222808957","pull_request_review_id":161786952,"id":222808957,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjgwODk1Nw==","diff_hunk":"@@ -0,0 +1,98 @@\n+\"\"\"\n+=================================\n+Rename BrainVision EEG data files\n+=================================\n+\n+The BrainVision file format is one of the recommended formats to store EEG data\n+within a BIDS directory. To organize EEG data in BIDS format, it is often\n+necessary to rename the files. In the case of BrainVision files, we would have\n+to rename multiple files for each dataset instance (i.e., once per recording):\n+\n+1. A text header file (``.vhdr``) containing meta data\n+2. A text marker file (``.vmrk``) containing information about events in the\n+data\n+3. A binary data file (``.eeg``) containing the voltage values of the EEG\n+\n+The problem is that the three files contain internal links that guide a\n+potential data reading software. If we just rename the three files without also\n+adjusting the internal links, we corrupt the file format.\n+\n+In this example, we use MNE-BIDS to rename BrainVision data files including a\n+repair of the internal file pointers.\n+\"\"\"\n+\n+# Authors: Stefan Appelhoff <stefan.appelhoff@mailbox.org>\n+# License: BSD (3-clause)\n+\n+###############################################################################\n+# We are importing everything we need for this example:\n+import os\n+import requests\n+\n+from mne_bids.utils import copyfile_brainvision\n+from mne.io import read_raw_brainvision\n+\n+###############################################################################\n+# Step 1: Download some example data\n+# ----------------------------------\n+# To demonstrate the MNE-BIDS functions, we need some testing data. Here, we\n+# will use data that is shipped with MNE-Python.\n+\n+# Make a directory to save the data to\n+home = os.path.expanduser('~')\n+examples_dir = os.path.join(home, 'mne_data', 'mne_bids_examples')\n+if not os.path.exists(examples_dir):\n+    os.makedirs(examples_dir)\n+\n+# Use the requests library to get content from github and save it\n+base_url = 'https://github.com/mne-tools/mne-python/'\n+base_url += 'raw/master/mne/io/brainvision/tests/data/test'\n+file_endings = ['.vhdr', '.vmrk', '.eeg', ]\n+\n+for f_ending in file_endings:\n+    url = base_url + f_ending\n+    response = requests.get(url)\n+\n+    fname = os.path.join(examples_dir, 'test' + f_ending)\n+    with open(fname, 'wb') as fout:\n+        fout.write(response.content)","path":"examples/rename_brainvision_files.py","position":59,"original_position":58,"commit_id":"956f2ac702e3f7d346aee926c5462f15413870f4","original_commit_id":"ef172830c8f98d5fa6b3bfa4035a80043de82c37","user":{"login":"jasmainak","id":15852194,"node_id":"MDQ6VXNlcjE1ODUyMTk0","avatar_url":"https://avatars3.githubusercontent.com/u/15852194?v=4","gravatar_id":"","url":"https://api.github.com/users/jasmainak","html_url":"https://github.com/jasmainak","followers_url":"https://api.github.com/users/jasmainak/followers","following_url":"https://api.github.com/users/jasmainak/following{/other_user}","gists_url":"https://api.github.com/users/jasmainak/gists{/gist_id}","starred_url":"https://api.github.com/users/jasmainak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasmainak/subscriptions","organizations_url":"https://api.github.com/users/jasmainak/orgs","repos_url":"https://api.github.com/users/jasmainak/repos","events_url":"https://api.github.com/users/jasmainak/events{/privacy}","received_events_url":"https://api.github.com/users/jasmainak/received_events","type":"User","site_admin":false},"body":"umm ... we have `mne_bids/datasets.py`. We could add it there and it would be a public function.","created_at":"2018-10-04T20:03:52Z","updated_at":"2018-10-04T20:03:52Z","html_url":"https://github.com/mne-tools/mne-bids/pull/104#discussion_r222808957","pull_request_url":"https://api.github.com/repos/mne-tools/mne-bids/pulls/104","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-bids/pulls/comments/222808957"},"html":{"href":"https://github.com/mne-tools/mne-bids/pull/104#discussion_r222808957"},"pull_request":{"href":"https://api.github.com/repos/mne-tools/mne-bids/pulls/104"}},"in_reply_to_id":222092563},"pull_request":{"url":"https://api.github.com/repos/mne-tools/mne-bids/pulls/104","id":219750094,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5NzUwMDk0","html_url":"https://github.com/mne-tools/mne-bids/pull/104","diff_url":"https://github.com/mne-tools/mne-bids/pull/104.diff","patch_url":"https://github.com/mne-tools/mne-bids/pull/104.patch","issue_url":"https://api.github.com/repos/mne-tools/mne-bids/issues/104","number":104,"state":"open","locked":false,"title":"[MRG] Brainvision example","user":{"login":"sappelhoff","id":9084751,"node_id":"MDQ6VXNlcjkwODQ3NTE=","avatar_url":"https://avatars1.githubusercontent.com/u/9084751?v=4","gravatar_id":"","url":"https://api.github.com/users/sappelhoff","html_url":"https://github.com/sappelhoff","followers_url":"https://api.github.com/users/sappelhoff/followers","following_url":"https://api.github.com/users/sappelhoff/following{/other_user}","gists_url":"https://api.github.com/users/sappelhoff/gists{/gist_id}","starred_url":"https://api.github.com/users/sappelhoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sappelhoff/subscriptions","organizations_url":"https://api.github.com/users/sappelhoff/orgs","repos_url":"https://api.github.com/users/sappelhoff/repos","events_url":"https://api.github.com/users/sappelhoff/events{/privacy}","received_events_url":"https://api.github.com/users/sappelhoff/received_events","type":"User","site_admin":false},"body":"This is the example I was talking about a few days ago on gitter.\r\n\r\nI also fixed all INCF links, because the INCF repos are now hosted by \"bids-standard\"","created_at":"2018-10-02T15:37:01Z","updated_at":"2018-10-04T20:03:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fde9d74d6ccb8160e379003f8e4a62225a601cc4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mne-tools/mne-bids/pulls/104/commits","review_comments_url":"https://api.github.com/repos/mne-tools/mne-bids/pulls/104/comments","review_comment_url":"https://api.github.com/repos/mne-tools/mne-bids/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mne-tools/mne-bids/issues/104/comments","statuses_url":"https://api.github.com/repos/mne-tools/mne-bids/statuses/956f2ac702e3f7d346aee926c5462f15413870f4","head":{"label":"sappelhoff:brainvision_example","ref":"brainvision_example","sha":"956f2ac702e3f7d346aee926c5462f15413870f4","user":{"login":"sappelhoff","id":9084751,"node_id":"MDQ6VXNlcjkwODQ3NTE=","avatar_url":"https://avatars1.githubusercontent.com/u/9084751?v=4","gravatar_id":"","url":"https://api.github.com/users/sappelhoff","html_url":"https://github.com/sappelhoff","followers_url":"https://api.github.com/users/sappelhoff/followers","following_url":"https://api.github.com/users/sappelhoff/following{/other_user}","gists_url":"https://api.github.com/users/sappelhoff/gists{/gist_id}","starred_url":"https://api.github.com/users/sappelhoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sappelhoff/subscriptions","organizations_url":"https://api.github.com/users/sappelhoff/orgs","repos_url":"https://api.github.com/users/sappelhoff/repos","events_url":"https://api.github.com/users/sappelhoff/events{/privacy}","received_events_url":"https://api.github.com/users/sappelhoff/received_events","type":"User","site_admin":false},"repo":{"id":140864326,"node_id":"MDEwOlJlcG9zaXRvcnkxNDA4NjQzMjY=","name":"mne-bids","full_name":"sappelhoff/mne-bids","private":false,"owner":{"login":"sappelhoff","id":9084751,"node_id":"MDQ6VXNlcjkwODQ3NTE=","avatar_url":"https://avatars1.githubusercontent.com/u/9084751?v=4","gravatar_id":"","url":"https://api.github.com/users/sappelhoff","html_url":"https://github.com/sappelhoff","followers_url":"https://api.github.com/users/sappelhoff/followers","following_url":"https://api.github.com/users/sappelhoff/following{/other_user}","gists_url":"https://api.github.com/users/sappelhoff/gists{/gist_id}","starred_url":"https://api.github.com/users/sappelhoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sappelhoff/subscriptions","organizations_url":"https://api.github.com/users/sappelhoff/orgs","repos_url":"https://api.github.com/users/sappelhoff/repos","events_url":"https://api.github.com/users/sappelhoff/events{/privacy}","received_events_url":"https://api.github.com/users/sappelhoff/received_events","type":"User","site_admin":false},"html_url":"https://github.com/sappelhoff/mne-bids","description":"MNE BIDS ","fork":true,"url":"https://api.github.com/repos/sappelhoff/mne-bids","forks_url":"https://api.github.com/repos/sappelhoff/mne-bids/forks","keys_url":"https://api.github.com/repos/sappelhoff/mne-bids/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sappelhoff/mne-bids/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sappelhoff/mne-bids/teams","hooks_url":"https://api.github.com/repos/sappelhoff/mne-bids/hooks","issue_events_url":"https://api.github.com/repos/sappelhoff/mne-bids/issues/events{/number}","events_url":"https://api.github.com/repos/sappelhoff/mne-bids/events","assignees_url":"https://api.github.com/repos/sappelhoff/mne-bids/assignees{/user}","branches_url":"https://api.github.com/repos/sappelhoff/mne-bids/branches{/branch}","tags_url":"https://api.github.com/repos/sappelhoff/mne-bids/tags","blobs_url":"https://api.github.com/repos/sappelhoff/mne-bids/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sappelhoff/mne-bids/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sappelhoff/mne-bids/git/refs{/sha}","trees_url":"https://api.github.com/repos/sappelhoff/mne-bids/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sappelhoff/mne-bids/statuses/{sha}","languages_url":"https://api.github.com/repos/sappelhoff/mne-bids/languages","stargazers_url":"https://api.github.com/repos/sappelhoff/mne-bids/stargazers","contributors_url":"https://api.github.com/repos/sappelhoff/mne-bids/contributors","subscribers_url":"https://api.github.com/repos/sappelhoff/mne-bids/subscribers","subscription_url":"https://api.github.com/repos/sappelhoff/mne-bids/subscription","commits_url":"https://api.github.com/repos/sappelhoff/mne-bids/commits{/sha}","git_commits_url":"https://api.github.com/repos/sappelhoff/mne-bids/git/commits{/sha}","comments_url":"https://api.github.com/repos/sappelhoff/mne-bids/comments{/number}","issue_comment_url":"https://api.github.com/repos/sappelhoff/mne-bids/issues/comments{/number}","contents_url":"https://api.github.com/repos/sappelhoff/mne-bids/contents/{+path}","compare_url":"https://api.github.com/repos/sappelhoff/mne-bids/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sappelhoff/mne-bids/merges","archive_url":"https://api.github.com/repos/sappelhoff/mne-bids/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sappelhoff/mne-bids/downloads","issues_url":"https://api.github.com/repos/sappelhoff/mne-bids/issues{/number}","pulls_url":"https://api.github.com/repos/sappelhoff/mne-bids/pulls{/number}","milestones_url":"https://api.github.com/repos/sappelhoff/mne-bids/milestones{/number}","notifications_url":"https://api.github.com/repos/sappelhoff/mne-bids/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sappelhoff/mne-bids/labels{/name}","releases_url":"https://api.github.com/repos/sappelhoff/mne-bids/releases{/id}","deployments_url":"https://api.github.com/repos/sappelhoff/mne-bids/deployments","created_at":"2018-07-13T15:32:40Z","updated_at":"2018-10-02T13:26:11Z","pushed_at":"2018-10-03T08:12:36Z","git_url":"git://github.com/sappelhoff/mne-bids.git","ssh_url":"git@github.com:sappelhoff/mne-bids.git","clone_url":"https://github.com/sappelhoff/mne-bids.git","svn_url":"https://github.com/sappelhoff/mne-bids","homepage":"http://mne-tools.github.io/mne-bids/","size":1109,"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":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mne-tools:master","ref":"master","sha":"ea3f22ea52701e8d90ff41d78ce45ef87f625a60","user":{"login":"mne-tools","id":583875,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU4Mzg3NQ==","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":89170358,"node_id":"MDEwOlJlcG9zaXRvcnk4OTE3MDM1OA==","name":"mne-bids","full_name":"mne-tools/mne-bids","private":false,"owner":{"login":"mne-tools","id":583875,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU4Mzg3NQ==","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},"html_url":"https://github.com/mne-tools/mne-bids","description":"MNE BIDS ","fork":false,"url":"https://api.github.com/repos/mne-tools/mne-bids","forks_url":"https://api.github.com/repos/mne-tools/mne-bids/forks","keys_url":"https://api.github.com/repos/mne-tools/mne-bids/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mne-tools/mne-bids/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mne-tools/mne-bids/teams","hooks_url":"https://api.github.com/repos/mne-tools/mne-bids/hooks","issue_events_url":"https://api.github.com/repos/mne-tools/mne-bids/issues/events{/number}","events_url":"https://api.github.com/repos/mne-tools/mne-bids/events","assignees_url":"https://api.github.com/repos/mne-tools/mne-bids/assignees{/user}","branches_url":"https://api.github.com/repos/mne-tools/mne-bids/branches{/branch}","tags_url":"https://api.github.com/repos/mne-tools/mne-bids/tags","blobs_url":"https://api.github.com/repos/mne-tools/mne-bids/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mne-tools/mne-bids/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mne-tools/mne-bids/git/refs{/sha}","trees_url":"https://api.github.com/repos/mne-tools/mne-bids/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mne-tools/mne-bids/statuses/{sha}","languages_url":"https://api.github.com/repos/mne-tools/mne-bids/languages","stargazers_url":"https://api.github.com/repos/mne-tools/mne-bids/stargazers","contributors_url":"https://api.github.com/repos/mne-tools/mne-bids/contributors","subscribers_url":"https://api.github.com/repos/mne-tools/mne-bids/subscribers","subscription_url":"https://api.github.com/repos/mne-tools/mne-bids/subscription","commits_url":"https://api.github.com/repos/mne-tools/mne-bids/commits{/sha}","git_commits_url":"https://api.github.com/repos/mne-tools/mne-bids/git/commits{/sha}","comments_url":"https://api.github.com/repos/mne-tools/mne-bids/comments{/number}","issue_comment_url":"https://api.github.com/repos/mne-tools/mne-bids/issues/comments{/number}","contents_url":"https://api.github.com/repos/mne-tools/mne-bids/contents/{+path}","compare_url":"https://api.github.com/repos/mne-tools/mne-bids/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mne-tools/mne-bids/merges","archive_url":"https://api.github.com/repos/mne-tools/mne-bids/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mne-tools/mne-bids/downloads","issues_url":"https://api.github.com/repos/mne-tools/mne-bids/issues{/number}","pulls_url":"https://api.github.com/repos/mne-tools/mne-bids/pulls{/number}","milestones_url":"https://api.github.com/repos/mne-tools/mne-bids/milestones{/number}","notifications_url":"https://api.github.com/repos/mne-tools/mne-bids/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mne-tools/mne-bids/labels{/name}","releases_url":"https://api.github.com/repos/mne-tools/mne-bids/releases{/id}","deployments_url":"https://api.github.com/repos/mne-tools/mne-bids/deployments","created_at":"2017-04-23T20:28:12Z","updated_at":"2018-09-27T17:52:23Z","pushed_at":"2018-10-04T05:51:01Z","git_url":"git://github.com/mne-tools/mne-bids.git","ssh_url":"git@github.com:mne-tools/mne-bids.git","clone_url":"https://github.com/mne-tools/mne-bids.git","svn_url":"https://github.com/mne-tools/mne-bids","homepage":"http://mne-tools.github.io/mne-bids/","size":1221,"stargazers_count":8,"watchers_count":8,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":28,"license":null,"forks":11,"open_issues":28,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-bids/pulls/104"},"html":{"href":"https://github.com/mne-tools/mne-bids/pull/104"},"issue":{"href":"https://api.github.com/repos/mne-tools/mne-bids/issues/104"},"comments":{"href":"https://api.github.com/repos/mne-tools/mne-bids/issues/104/comments"},"review_comments":{"href":"https://api.github.com/repos/mne-tools/mne-bids/pulls/104/comments"},"review_comment":{"href":"https://api.github.com/repos/mne-tools/mne-bids/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mne-tools/mne-bids/pulls/104/commits"},"statuses":{"href":"https://api.github.com/repos/mne-tools/mne-bids/statuses/956f2ac702e3f7d346aee926c5462f15413870f4"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"jasmainak"}}