{"action":"created","issue":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/3473","repository_url":"https://api.github.com/repos/mne-tools/mne-python","labels_url":"https://api.github.com/repos/mne-tools/mne-python/issues/3473/labels{/name}","comments_url":"https://api.github.com/repos/mne-tools/mne-python/issues/3473/comments","events_url":"https://api.github.com/repos/mne-tools/mne-python/issues/3473/events","html_url":"https://github.com/mne-tools/mne-python/issues/3473","id":168460816,"number":3473,"title":"Cannot find channel types using \"reject\" (but \"pick_types\" works)","user":{"login":"nicoa47","id":15858293,"avatar_url":"https://avatars.githubusercontent.com/u/15858293?v=3","gravatar_id":"","url":"https://api.github.com/users/nicoa47","html_url":"https://github.com/nicoa47","followers_url":"https://api.github.com/users/nicoa47/followers","following_url":"https://api.github.com/users/nicoa47/following{/other_user}","gists_url":"https://api.github.com/users/nicoa47/gists{/gist_id}","starred_url":"https://api.github.com/users/nicoa47/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicoa47/subscriptions","organizations_url":"https://api.github.com/users/nicoa47/orgs","repos_url":"https://api.github.com/users/nicoa47/repos","events_url":"https://api.github.com/users/nicoa47/events{/privacy}","received_events_url":"https://api.github.com/users/nicoa47/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-30T10:24:38Z","updated_at":"2016-07-30T13:31:09Z","closed_at":null,"body":"I have an issue using reject based on eeg channels in mne.Epochs: It gives the error \"No EEG channel found. Cannot reject based on EEG.\"\r\n\r\nHere is an example file:\r\nhttps://www.dropbox.com/s/i81x10ygemv5tbm/example_raw.fif?dl=0\r\n\r\nHere is the relevant code:\r\n`#load data\r\n#this fif file was created from an EDF file, using MNE's save command\r\nraw = mne.io.read_raw_fif('example_raw.fif', preload=True)\r\n\r\n#set channel types (simply using \"set_channel_types\" gives an error)\r\nraw.info['projs'] = []\r\nraw.set_channel_types({'EMG l':'misc','EMG r':'misc','E1':'eog','E2':'eog','F3':'eeg','F4':'eeg','C3':'eeg','C4':'eeg','O1':'eeg','O2':'eeg'})\r\nraw.add_proj(mne.preprocessing.ssp.make_eeg_average_ref_proj(raw.info, activate=False))\r\n\r\n#check if channels set correctly\r\nprint('originally: \\n', raw.info)\r\nraw.pick_types(eeg=True)\r\nprint('after picking eeg: \\n', raw.info)\r\n#seems to work --> now only 6 channels left (but why called stim?)\r\n\r\n#artifact rejection\r\nchunk_size = raw.info['sfreq'] * 30\r\nchunk_starts = np.arange(0, raw.n_times, chunk_size)\r\nevents = np.c_[chunk_starts, np.zeros((len(chunk_starts), 2))].astype(int)\r\nepochs = mne.Epochs(raw, events[:-1], reject=dict(eeg=200e-06)) #error: no channels of type eeg\r\nmne.viz.plot_epochs(epochs)\r\ninput()`"},"comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/comments/236365405","html_url":"https://github.com/mne-tools/mne-python/issues/3473#issuecomment-236365405","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/3473","id":236365405,"user":{"login":"agramfort","id":161052,"avatar_url":"https://avatars.githubusercontent.com/u/161052?v=3","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},"created_at":"2016-07-30T13:31:09Z","updated_at":"2016-07-30T13:31:09Z","body":"try this:\r\n\r\n```\r\nimport numpy as np\r\nimport mne\r\n\r\nraw = mne.io.read_raw_fif('example_raw.fif', preload=True)\r\n\r\n#set channel types (simply using \"set_channel_types\" gives an error)\r\nraw.info['projs'] = []\r\nraw.set_channel_types({'EMG l':'misc','EMG r':'misc','E1':'eog','E2':'eog','F3':'eeg','F4':'eeg','C3':'eeg','C4':'eeg','O1':'eeg','O2':'eeg'})\r\nraw.add_proj(mne.preprocessing.ssp.make_eeg_average_ref_proj(raw.info, activate=False))\r\n\r\n#check if channels set correctly\r\nprint('originally: \\n', raw.info)\r\nraw.pick_types(eeg=True)\r\nprint('after picking eeg: \\n', raw.info)\r\n#seems to work --> now only 6 channels left (but why called stim?)\r\n\r\nraw._data *= .1  # are data really in Volts?\r\n\r\n#artifact rejection\r\nchunk_size = raw.info['sfreq'] * 30\r\nchunk_starts = np.arange(0, raw.n_times, chunk_size) + raw.first_samp\r\nevents = np.c_[chunk_starts, np.zeros((len(chunk_starts), 2))].astype(int)\r\nepochs = mne.Epochs(raw, events[:-1], reject=dict(eeg=300e-06)) #error: no channels of type eeg\r\nmne.viz.plot_epochs(epochs)\r\n```\r\n\r\nyou had no good epoch. You did not take into account raw.first_samp and the reject was too low."}}
{"actor":{"display_login":"agramfort"}}