{"action":"created","comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/216952521","pull_request_review_id":154551347,"id":216952521,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNjk1MjUyMQ==","diff_hunk":"@@ -117,19 +117,24 @@ def __init__(self, fname, allow_maxshield=False, preload=False,\n                 n_samples += r.last_samp - r.first_samp + 1\n \n         # Add annotations for in-data skips\n-        offsets = [0] + self._raw_lengths[:-1]\n-        for extra, first_samp, offset in zip(self._raw_extras,\n-                                             self._first_samps, offsets):\n-            for skip in extra:\n-                if skip['ent'] is None:  # these are skips\n-                    if self.annotations is None:\n-                        self.set_annotations(Annotations((), (), ()))\n-                    start = skip['first'] - first_samp + offset\n-                    stop = skip['last'] - first_samp + offset\n-                    self.annotations.append(\n-                        _sync_onset(self, start / self.info['sfreq']),\n-                        (stop - start + 1) / self.info['sfreq'],\n-                        'BAD_ACQ_SKIP')\n+        for extra in self._raw_extras:\n+            start = np.array([_['first'] for _ in extra if _['ent'] is None])\n+            stop = np.array([_['last'] for _ in extra if _['ent'] is None])\n+            duration = (stop - start + 1) / self.info['sfreq']\n+\n+            annot = Annotations(onset=(start / self.info['sfreq']),\n+                                duration=duration,","path":"mne/io/fiff/raw.py","position":32,"original_position":32,"commit_id":"323b289b7a1cb162c337b16a4fb7d2fb9e0ead16","original_commit_id":"323b289b7a1cb162c337b16a4fb7d2fb9e0ead16","user":{"login":"massich","id":7044835,"node_id":"MDQ6VXNlcjcwNDQ4MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/7044835?v=4","gravatar_id":"","url":"https://api.github.com/users/massich","html_url":"https://github.com/massich","followers_url":"https://api.github.com/users/massich/followers","following_url":"https://api.github.com/users/massich/following{/other_user}","gists_url":"https://api.github.com/users/massich/gists{/gist_id}","starred_url":"https://api.github.com/users/massich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/massich/subscriptions","organizations_url":"https://api.github.com/users/massich/orgs","repos_url":"https://api.github.com/users/massich/repos","events_url":"https://api.github.com/users/massich/events{/privacy}","received_events_url":"https://api.github.com/users/massich/received_events","type":"User","site_admin":false},"body":"This code replicates what was in the code base:\r\n```py\r\n                    self.annotations.append(\t\t￼\r\n￼                        _sync_onset(self, start / self.info['sfreq']),\r\n￼                        (stop - start + 1) / self.info['sfreq'],\t\t￼                \r\n￼                        'BAD_ACQ_SKIP')\r\n```\r\n\r\nWe had that conversation in gitter:\r\n\r\n@massich\r\n> I'm trying to understand this part of the code base:\r\nhttps://github.com/mne-tools/mne-python/blob/6aff6e6cc11e7428fe6a89bf8516d9b3669d3938/mne/io/fiff/raw.py#L119-L132\r\n>\r\n> let's say that we have an experiment with several parts (XXX recording with A\r\nannotations, and YYY with B) that gets recorded in `foo_raw.fif` and `bar_raw.fif`,\r\nand we do something like `raw = read_raw_fif([foo_raw.fif, bar_raw.fif])`.\r\nIf I understand the snipped properly, the raw file has X and Y stick together\r\nin `_data`, B onset is modified and adds an annotation C where X and Y are stick\r\nwhich lasts a duration (time between X and Y).\r\n>\r\n> this picture my help\r\n```\r\n              meas-date\r\nexperiment        |---XXXXXXXXXXXXXXXX------YYYYYYYYYYY-----\r\n                  |------AAA-------------------BB-----------\r\n\r\nfoo_raw.fif       |---XXXXXXXXXXXXXXXX----------------------\r\n                  |------AAA--------------------------------\r\n\r\nbar_raw.fif       |-------------------------YYYYYYYYYYY-----\r\n                  |----------------------------BB-----------\r\n\r\nraw-object        |---XXXXXXXXXXXXXXXXYYYYYYYYYYY----\r\n                  |------AAA-------------------------\r\n                  |----------------------BB----------\r\n                  |-------------------CCCCCC---------\r\n```\r\n\r\n@larsoner:\r\n> `_raw_extra` holds whatever file-format-specific information is necessary to properly read data\r\n> your example is wrong\r\n> it should be\r\n```\r\nraw-object        |---XXXXXXXXXXXXXXXX------YYYYYYYYYYY----\r\n                  |------AAA-------------------------------\r\n                  |----------------------------BB----------\r\n                  |-------------------CCCCCC---------------\r\n```\r\n> but this doesn't usually happen with `concatenate_raws`\r\n> some formats like `neuromag` allow you to turn recordings off *in the middle of a file* then turn them back on\r\n> so with no annotations added at all you can have files that are like:\r\n```\r\n---XXXXXXXXX----XXXXXXXXXX\r\n------------SSSS----------\r\n```","created_at":"2018-09-12T09:08:27Z","updated_at":"2018-09-12T09:08:39Z","html_url":"https://github.com/mne-tools/mne-python/pull/5433#discussion_r216952521","pull_request_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/5433","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/216952521"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/5433#discussion_r216952521"},"pull_request":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/5433"}},"in_reply_to_id":216785615},"pull_request":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/5433","id":207616200,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3NjE2MjAw","html_url":"https://github.com/mne-tools/mne-python/pull/5433","diff_url":"https://github.com/mne-tools/mne-python/pull/5433.diff","patch_url":"https://github.com/mne-tools/mne-python/pull/5433.patch","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/5433","number":5433,"state":"open","locked":false,"title":"[MRG] reset `raw.annotations.orig_time` to `meas_date`","user":{"login":"massich","id":7044835,"node_id":"MDQ6VXNlcjcwNDQ4MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/7044835?v=4","gravatar_id":"","url":"https://api.github.com/users/massich","html_url":"https://github.com/massich","followers_url":"https://api.github.com/users/massich/followers","following_url":"https://api.github.com/users/massich/following{/other_user}","gists_url":"https://api.github.com/users/massich/gists{/gist_id}","starred_url":"https://api.github.com/users/massich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/massich/subscriptions","organizations_url":"https://api.github.com/users/massich/orgs","repos_url":"https://api.github.com/users/massich/repos","events_url":"https://api.github.com/users/massich/events{/privacy}","received_events_url":"https://api.github.com/users/massich/received_events","type":"User","site_admin":false},"body":"This is the proposed behaviour when doing `raw.set_annotations(annot)`:\r\n\r\n![image](https://user-images.githubusercontent.com/7044835/45109304-6a57e000-b13f-11e8-8b93-250f6e717a82.png)\r\n\r\nWhen `meas_date` is set and `orig_time` is set : set the annotations, set orig_time to meas_date and reset onsets\r\nWhen `meas_date` is set and `orig_time` is None : assume `orig_time` to be `raw.first_samp`\r\nWhen `meas_date` is None and `orig_time` is set : Crash\r\nWhen `meas_date` is None and `orig_time` is None : assume `orig_time` to be `raw.first_samp` and keep `raw.annotations.orig_time` as None\r\n\r\n\r\nThis needs to go in before #4936 ","created_at":"2018-08-10T13:43:14Z","updated_at":"2018-09-12T09:08:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f3786c4c113a8ec1de1511e0896ce7511890212","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/5433/commits","review_comments_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/5433/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/5433/comments","statuses_url":"https://api.github.com/repos/mne-tools/mne-python/statuses/323b289b7a1cb162c337b16a4fb7d2fb9e0ead16","head":{"label":"massich:orig_matrix","ref":"orig_matrix","sha":"323b289b7a1cb162c337b16a4fb7d2fb9e0ead16","user":{"login":"massich","id":7044835,"node_id":"MDQ6VXNlcjcwNDQ4MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/7044835?v=4","gravatar_id":"","url":"https://api.github.com/users/massich","html_url":"https://github.com/massich","followers_url":"https://api.github.com/users/massich/followers","following_url":"https://api.github.com/users/massich/following{/other_user}","gists_url":"https://api.github.com/users/massich/gists{/gist_id}","starred_url":"https://api.github.com/users/massich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/massich/subscriptions","organizations_url":"https://api.github.com/users/massich/orgs","repos_url":"https://api.github.com/users/massich/repos","events_url":"https://api.github.com/users/massich/events{/privacy}","received_events_url":"https://api.github.com/users/massich/received_events","type":"User","site_admin":false},"repo":{"id":97946362,"node_id":"MDEwOlJlcG9zaXRvcnk5Nzk0NjM2Mg==","name":"mne-python","full_name":"massich/mne-python","owner":{"login":"massich","id":7044835,"node_id":"MDQ6VXNlcjcwNDQ4MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/7044835?v=4","gravatar_id":"","url":"https://api.github.com/users/massich","html_url":"https://github.com/massich","followers_url":"https://api.github.com/users/massich/followers","following_url":"https://api.github.com/users/massich/following{/other_user}","gists_url":"https://api.github.com/users/massich/gists{/gist_id}","starred_url":"https://api.github.com/users/massich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/massich/subscriptions","organizations_url":"https://api.github.com/users/massich/orgs","repos_url":"https://api.github.com/users/massich/repos","events_url":"https://api.github.com/users/massich/events{/privacy}","received_events_url":"https://api.github.com/users/massich/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/massich/mne-python","description":"MNE : Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python","fork":true,"url":"https://api.github.com/repos/massich/mne-python","forks_url":"https://api.github.com/repos/massich/mne-python/forks","keys_url":"https://api.github.com/repos/massich/mne-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/massich/mne-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/massich/mne-python/teams","hooks_url":"https://api.github.com/repos/massich/mne-python/hooks","issue_events_url":"https://api.github.com/repos/massich/mne-python/issues/events{/number}","events_url":"https://api.github.com/repos/massich/mne-python/events","assignees_url":"https://api.github.com/repos/massich/mne-python/assignees{/user}","branches_url":"https://api.github.com/repos/massich/mne-python/branches{/branch}","tags_url":"https://api.github.com/repos/massich/mne-python/tags","blobs_url":"https://api.github.com/repos/massich/mne-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/massich/mne-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/massich/mne-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/massich/mne-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/massich/mne-python/statuses/{sha}","languages_url":"https://api.github.com/repos/massich/mne-python/languages","stargazers_url":"https://api.github.com/repos/massich/mne-python/stargazers","contributors_url":"https://api.github.com/repos/massich/mne-python/contributors","subscribers_url":"https://api.github.com/repos/massich/mne-python/subscribers","subscription_url":"https://api.github.com/repos/massich/mne-python/subscription","commits_url":"https://api.github.com/repos/massich/mne-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/massich/mne-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/massich/mne-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/massich/mne-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/massich/mne-python/contents/{+path}","compare_url":"https://api.github.com/repos/massich/mne-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/massich/mne-python/merges","archive_url":"https://api.github.com/repos/massich/mne-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/massich/mne-python/downloads","issues_url":"https://api.github.com/repos/massich/mne-python/issues{/number}","pulls_url":"https://api.github.com/repos/massich/mne-python/pulls{/number}","milestones_url":"https://api.github.com/repos/massich/mne-python/milestones{/number}","notifications_url":"https://api.github.com/repos/massich/mne-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/massich/mne-python/labels{/name}","releases_url":"https://api.github.com/repos/massich/mne-python/releases{/id}","deployments_url":"https://api.github.com/repos/massich/mne-python/deployments","created_at":"2017-07-21T12:41:17Z","updated_at":"2018-09-03T15:12:58Z","pushed_at":"2018-09-11T15:14:17Z","git_url":"git://github.com/massich/mne-python.git","ssh_url":"git@github.com:massich/mne-python.git","clone_url":"https://github.com/massich/mne-python.git","svn_url":"https://github.com/massich/mne-python","homepage":"http://martinos.org/mne/","size":101314,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"mne-tools:master","ref":"master","sha":"d1e2cc88b83d26d45140ea6ff7b66e04082e7728","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":1301584,"node_id":"MDEwOlJlcG9zaXRvcnkxMzAxNTg0","name":"mne-python","full_name":"mne-tools/mne-python","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},"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-09-11T20:50:16Z","pushed_at":"2018-09-12T09:03:15Z","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":101378,"stargazers_count":589,"watchers_count":589,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":444,"mirror_url":null,"archived":false,"open_issues_count":268,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":444,"open_issues":268,"watchers":589,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/5433"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/5433"},"issue":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/5433"},"comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/5433/comments"},"review_comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/5433/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/5433/commits"},"statuses":{"href":"https://api.github.com/repos/mne-tools/mne-python/statuses/323b289b7a1cb162c337b16a4fb7d2fb9e0ead16"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"massich"}}