{"action":"created","issue":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/1963","labels_url":"https://api.github.com/repos/mne-tools/mne-python/issues/1963/labels{/name}","comments_url":"https://api.github.com/repos/mne-tools/mne-python/issues/1963/comments","events_url":"https://api.github.com/repos/mne-tools/mne-python/issues/1963/events","html_url":"https://github.com/mne-tools/mne-python/issues/1963","id":68223065,"number":1963,"title":"MNE events functionality","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":null,"comments":34,"created_at":"2015-04-13T23:58:36Z","updated_at":"2015-06-06T17:52:41Z","closed_at":null,"body":"Now that the \"extra info\" issue has been closed I'm thinking about ways that I could incorporate my metadata with the metadata in MNE. This brought up an idea that might be worth implementing if it'd be useful.\r\n\r\nThe tricky thing about my data is that my events are not defined by triggers because I am playing sentences of variable length in a continuous fashion. To that extent, I can't just store the starting time of each trial...I also need to know the length.\r\n\r\nIn order to keep this flexible when I change sampling rates of the signal, I've been storing time information as a pandas dataframe that has one row for each trial. For any row, there are always two columns: 'start', 'stop'. These are stored in seconds to the highest possible precision. \r\n\r\nThen, I append columns to each row to add information about that trial. For example, one row might look like this:\r\n\r\n```python\r\ntime_info = {'start': 1.23453,\r\n                    'stop': 3.5642,\r\n                    'trial_type': 'filter',\r\n                    'filter_type': high_pass'\r\n                   }\r\n```\r\nThe values in `start` and `stop` always correspond to 0 being the start of the data files. That way, as long as I have the sampling rate then I can use a function like this:\r\n\r\n`stim_time_series = time_series_from_time_info(time_info, sample_rate, total_length)`\r\n\r\nand it will generate a time series were each row is a timepoint, then fill row/column values with values corresponding to the other columns in time_info. Total length defines the total length of the brain data that we've got. The result is a vector of stimulus information that is kind of like the ones that MNE uses to read in events information.\r\n\r\nWould it be useful to contribute these kinds of functions to MNE? I could work on this after finishing up the layout stuff. I could imagine it being useful for anyone that doesn't store their event information as vectors along with the data."},"comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/comments/109625466","html_url":"https://github.com/mne-tools/mne-python/issues/1963#issuecomment-109625466","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/1963","id":109625466,"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},"created_at":"2015-06-06T17:52:41Z","updated_at":"2015-06-06T17:52:41Z","body":"I think someone mentioned a similar use case above, but the basic idea for me is that I have a lot of metadata about any given trial. For example, I have trials in blocks of 3. I'd like to keep information about which block each stimulus presentation belongs to, but other than hard-coding this into event_id, I'm not sure how best to do it. Since I also have a lot of metadata too, I thought it would be easier to include an ID that I can lookup with my own trials metadata structure.\r\n\r\nAn example of metadata columns is as follows. Each trial is a spoken sentence, but the lengths of the sentences are not the same, and for regression purposes I'd like to know exactly how long each sentences took to play. Moreover, some sentences are filtered in particular ways depending on the block type. Here is information I have about each sentence:\r\n\r\n* Sentence ID (aka file name)\r\n* Filter type (or not filtered)\r\n* Block filter type (are other sentences in the block filtered)\r\n* Position within block\r\n* Length of sentence\r\n* Speaker ID of sentence\r\n* Words spoken in sentence\r\n* etc etc\r\n\r\nThe problem is that right now when I have an epochs object, there is a mapping onto integer numbers. I could make a complicated system that encodes all this information into a really long integer, but it seems easier/clearer to just have a single number associated with each stimulus presentation, and I can use this in my own lookup table of stimulus metadata. I suppose that I could **only** use the stimulus event code functionality for this (aka make it an integer that only serves as a lookup key, and doesn't tell me anything about the stimulus). What do you think?"}}