{"action":"created","issue":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/2787","labels_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2787/labels{/name}","comments_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2787/comments","events_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2787/events","html_url":"https://github.com/mne-tools/mne-python/issues/2787","id":126717917,"number":2787,"title":"Inconsistencies with tmin/tmax","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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/mne-tools/mne-python/milestones/8","html_url":"https://github.com/mne-tools/mne-python/milestones/0.12","labels_url":"https://api.github.com/repos/mne-tools/mne-python/milestones/8/labels","id":1429321,"number":8,"title":"0.12","description":"","creator":{"login":"Eric89GXL","id":2365790,"avatar_url":"https://avatars.githubusercontent.com/u/2365790?v=3","gravatar_id":"","url":"https://api.github.com/users/Eric89GXL","html_url":"https://github.com/Eric89GXL","followers_url":"https://api.github.com/users/Eric89GXL/followers","following_url":"https://api.github.com/users/Eric89GXL/following{/other_user}","gists_url":"https://api.github.com/users/Eric89GXL/gists{/gist_id}","starred_url":"https://api.github.com/users/Eric89GXL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eric89GXL/subscriptions","organizations_url":"https://api.github.com/users/Eric89GXL/orgs","repos_url":"https://api.github.com/users/Eric89GXL/repos","events_url":"https://api.github.com/users/Eric89GXL/events{/privacy}","received_events_url":"https://api.github.com/users/Eric89GXL/received_events","type":"User","site_admin":false},"open_issues":32,"closed_issues":13,"state":"open","created_at":"2015-11-25T13:36:18Z","updated_at":"2016-01-14T18:32:30Z","due_on":"2016-04-29T04:00:00Z","closed_at":null},"comments":31,"created_at":"2016-01-14T18:31:12Z","updated_at":"2016-01-16T15:05:37Z","closed_at":null,"body":"There are some inconsistencies in inclusiveness for tmin/tmax in Epochs. When you create an epochs object using tmin/tmax, there's one extra index (on the tmin side of things) when you compare this with doing `epochs.crop`. E.g.:\r\n```python\r\nimport mne\r\nfrom mne import io\r\nfrom mne.datasets import sample\r\n\r\n# Set parameters\r\ndata_path = sample.data_path()\r\nraw_fname = data_path + '/MEG/sample/sample_audvis_raw.fif'\r\nevent_fname = data_path + '/MEG/sample/sample_audvis_raw-eve.fif'\r\n\r\n# Setup for reading the raw data\r\nraw = io.Raw(raw_fname)\r\nevents = mne.read_events(event_fname)\r\ntmin, event_id = -1., 1\r\ntmax = tmin + 1000. / raw.info['sfreq']\r\nepochs = mne.Epochs(raw, events, event_id, tmin, tmax, baseline=None, preload=True)\r\nprint('{}...{} | {}'.format(epochs.times[:5], epochs.times[-5:], epochs.times.shape))\r\nepochs.crop(tmin, tmax)\r\nprint('{}...{} | {}'.format(epochs.times[:5], epochs.times[-5:], epochs.times.shape))\r\n```\r\ngives\r\n\r\n```\r\n[-1.00064103 -0.99897607 -0.99731111 -0.99564615 -0.99398119]...[ 0.65765924  0.6593242   0.66098916  0.66265412  0.66431908] | (1001,)\r\n[-0.99897607 -0.99731111 -0.99564615 -0.99398119 -0.99231623]...[ 0.65765924  0.6593242   0.66098916  0.66265412  0.66431908] | (1000,)\r\n```\r\n(+ a warning about tmax being too large)\r\n\r\nI feel that tmin/tmax should behave the same in both cases. This probably isn't usually an issue unless the user needs to have index-level specificity (e.g., if they need a length 2**N signal)"},"comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/comments/172214601","html_url":"https://github.com/mne-tools/mne-python/issues/2787#issuecomment-172214601","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2787","id":172214601,"user":{"login":"jasmainak","id":15852194,"avatar_url":"https://avatars.githubusercontent.com/u/15852194?v=3","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},"created_at":"2016-01-16T15:05:37Z","updated_at":"2016-01-16T15:05:37Z","body":":) I think this is related to how the `tmin` is stored in the `epochs` object. If `epochs.tmin` was the same as the user-supplied `tmin` in the constructor, there would be no surprises. We don't store the user-supplied `tmin` anywhere do we? I would be happy with just a warning if the `tmin` for the crop method was the same as the `tmin` in the constructor of Epochs asking the user to supply `None` instead."}}