{"action":"created","issue":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/2521","labels_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2521/labels{/name}","comments_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2521/comments","events_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2521/events","html_url":"https://github.com/mne-tools/mne-python/issues/2521","id":110591396,"number":2521,"title":"hierarchical tagging faces problems with equalize_event_counts","user":{"login":"teonlamont","id":1578674,"avatar_url":"https://avatars.githubusercontent.com/u/1578674?v=3","gravatar_id":"","url":"https://api.github.com/users/teonlamont","html_url":"https://github.com/teonlamont","followers_url":"https://api.github.com/users/teonlamont/followers","following_url":"https://api.github.com/users/teonlamont/following{/other_user}","gists_url":"https://api.github.com/users/teonlamont/gists{/gist_id}","starred_url":"https://api.github.com/users/teonlamont/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teonlamont/subscriptions","organizations_url":"https://api.github.com/users/teonlamont/orgs","repos_url":"https://api.github.com/users/teonlamont/repos","events_url":"https://api.github.com/users/teonlamont/events{/privacy}","received_events_url":"https://api.github.com/users/teonlamont/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mne-tools/mne-python/labels/ENH","name":"ENH","color":"d7e102"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-10-09T05:52:23Z","updated_at":"2015-10-19T21:25:32Z","closed_at":"2015-10-19T21:25:32Z","body":"Tagging is currently not compatible with the function `equalize_event_counts`. \r\n\r\n```python\r\n---------------------------------------------------------------------------\r\nKeyError                                  Traceback (most recent call last)\r\n/Applications/packages/E-MEG/scripts/priming_sensor_analysis.py in <module>()\r\n     73     epochs.pick_types(meg=True, exclude='bads')\r\n     74 \r\n---> 75     epochs.equalize_event_counts(['unprimed', 'primed'], copy=False)\r\n     76     # plotting grand average\r\n     77     p = epochs.average().plot(show=False)\r\n\r\n/Applications/packages/mne-python/mne/epochs.pyc in equalize_event_counts(self, event_ids, method, copy)\r\n   1552             key_match = np.zeros(epochs.events.shape[0])\r\n   1553             for key in eq:\r\n-> 1554                 key_match = np.logical_or(key_match, epochs._key_match(key))\r\n   1555             eq_inds.append(np.where(key_match)[0])\r\n   1556 \r\n\r\n/Applications/packages/mne-python/mne/epochs.pyc in _key_match(self, key)\r\n   1297         \"\"\"Helper function for event dict use\"\"\"\r\n   1298         if key not in self.event_id:\r\n-> 1299             raise KeyError('Event \"%s\" is not in Epochs.' % key)\r\n   1300         return self.events[:, 2] == self.event_id[key]\r\n   1301 \r\n\r\nKeyError: 'Event \"unprimed\" is not in Epochs.'\r\n```\r\nthis is the event_id dictionary:\r\n```python\r\nipdb> self.event_id\r\n{u'nonword/prime': 9, u'nonword/target': 10, u'word/target/primed': 6, u'fixation': 128, u'word/prime/primed': 5, u'word/prime/unprimed': 1, u'word/target/unprimed': 2}\r\n```\r\n\r\nhere's a print of the epochs:\r\n```python\r\nipdb> self\r\n<EpochsFIF  |  n_events : 669 (all good), tmin : -0.5 (s), tmax : 1.0 (s), baseline : None,\r\n u'fixation': 240, u'nonword/prime': 48, u'nonword/target': 94, u'word/prime/primed': 48, u'word/prime/unprimed': 143, u'word/target/primed': 48, u'word/target/unprimed': 48>\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/comments/149351917","html_url":"https://github.com/mne-tools/mne-python/issues/2521#issuecomment-149351917","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2521","id":149351917,"user":{"login":"teonlamont","id":1578674,"avatar_url":"https://avatars.githubusercontent.com/u/1578674?v=3","gravatar_id":"","url":"https://api.github.com/users/teonlamont","html_url":"https://github.com/teonlamont","followers_url":"https://api.github.com/users/teonlamont/followers","following_url":"https://api.github.com/users/teonlamont/following{/other_user}","gists_url":"https://api.github.com/users/teonlamont/gists{/gist_id}","starred_url":"https://api.github.com/users/teonlamont/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teonlamont/subscriptions","organizations_url":"https://api.github.com/users/teonlamont/orgs","repos_url":"https://api.github.com/users/teonlamont/repos","events_url":"https://api.github.com/users/teonlamont/events{/privacy}","received_events_url":"https://api.github.com/users/teonlamont/received_events","type":"User","site_admin":false},"created_at":"2015-10-19T21:25:32Z","updated_at":"2015-10-19T21:25:32Z","body":"closed via #2532 "}}