{"action":"created","issue":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/5684","repository_url":"https://api.github.com/repos/mne-tools/mne-python","labels_url":"https://api.github.com/repos/mne-tools/mne-python/issues/5684/labels{/name}","comments_url":"https://api.github.com/repos/mne-tools/mne-python/issues/5684/comments","events_url":"https://api.github.com/repos/mne-tools/mne-python/issues/5684/events","html_url":"https://github.com/mne-tools/mne-python/issues/5684","id":376299417,"node_id":"MDU6SXNzdWUzNzYyOTk0MTc=","number":5684,"title":"MNE usage with sleep data","user":{"login":"agramfort","id":161052,"node_id":"MDQ6VXNlcjE2MTA1Mg==","avatar_url":"https://avatars2.githubusercontent.com/u/161052?v=4","gravatar_id":"","url":"https://api.github.com/users/agramfort","html_url":"https://github.com/agramfort","followers_url":"https://api.github.com/users/agramfort/followers","following_url":"https://api.github.com/users/agramfort/following{/other_user}","gists_url":"https://api.github.com/users/agramfort/gists{/gist_id}","starred_url":"https://api.github.com/users/agramfort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agramfort/subscriptions","organizations_url":"https://api.github.com/users/agramfort/orgs","repos_url":"https://api.github.com/users/agramfort/repos","events_url":"https://api.github.com/users/agramfort/events{/privacy}","received_events_url":"https://api.github.com/users/agramfort/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2018-11-01T08:31:03Z","updated_at":"2018-11-09T16:33:15Z","closed_at":null,"author_association":"MEMBER","body":"let me share here some thoughts of how working with EEG sleep data could be simplified once we have the annotations API in place. Given let's say 2 files (one raw data and one annotations) it should be as easy as doing:\r\n\r\n```\r\nimport mne\r\nraw = mne.io.read_raw_edf('data.edf')\r\nannotations = mne.read_annotations('sleep_annots.edf')\r\nraw.set_annotations(annotations)\r\nevents, event_id = mne.events_from_annotations(raw)\r\nepochs = mne.Epochs(raw, events, event_id, tmin=0., tmax=30., baseline=None)\r\nepochs['N1']  # to get all epochs of N1 type etc.\r\n```\r\n\r\ncc @massich @Slasnista\r\n\r\nit would be great to have this in place for the release. It's pretty much done but it needs some ironing."},"comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/comments/437415835","html_url":"https://github.com/mne-tools/mne-python/issues/5684#issuecomment-437415835","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/5684","id":437415835,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzQxNTgzNQ==","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},"created_at":"2018-11-09T16:33:15Z","updated_at":"2018-11-09T16:33:15Z","author_association":"CONTRIBUTOR","body":"I would say that this is experiment specific. Even if I have annotations of\ncontiguous regions all with the same size, why should I not be able to get\nepochs from onset-0.1 to duration+0.1?\nThat this might not make sense for most experiments. Maybe. But I don't see\nwhy it should not be possible.\n\nOn Fri, Nov 9, 2018 at 5:28 PM Mainak Jas <notifications@github.com> wrote:\n\n> I'm concerned about the use case you shared in your code snippet above.\n> The duration is not 0 there and the annotations are (probably) contiguous.\n> That is to say, right after N1 ends, another sleep stage starts. If you\n> allow the user to specify arbitrary tmin or tmax in the Epochs constructor,\n> their epochs could contain two (or more) sleep stages instead of one.\n>\n> I think adding a check inside the Epochs constructor that makes sure your\n> epochs don't contain more than one annotation should be fine.\n>\n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/mne-tools/mne-python/issues/5684#issuecomment-437414166>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/AGt-45aREyCiRBtbogeNB_cTzMnsbxi2ks5uta0WgaJpZM4YF_Gc>\n> .\n>\n"}}
{"actor":{"display_login":"massich"}}