Finding index of dropped epoch & automatic rejection for bad epoch

Hi,

Could anyone help me how to find indices of epochs that have been dropped ?

Also, does mne have an automatic rejection for bad epochs ?

Thanks in advanced
IG

Sorry for the slow reply. epochs.selection gives you the indices of epochs that have not been dropped. epochs.drop_log records the reasons why epochs have been dropped. So to get the indices of dropped epochs, there are a few options, e.g.,;

[n for n, dl in enumerate(epochs.drop_log) if len(dl)]  # result is a list
np.nonzero(map(len, epochs.drop_log))  # result is a numpy array

For your second question, when epochs are created via mne.Epochs(raw, events, ...) there are a few ways that epochs can get dropped:

  1. if you pass something for the reject parameter. See the docstring for examples.
  2. if your raw object had any annotations that start with bad or edge, and an epoch would overlap that annotation. These are signal values used when concatenating raws (edge) or when annotating artifacts (bad). You can prevent this dropping by passing reject_by_annotation=False
  3. if the events that you’re epoching are too close to the start/end of the raw object, such that they would get truncated. There is no way to prevent this kind of dropping (all epochs must be the same length, so we can’t possibly include an epoch that is shorter because it occurs right at the beginning/end of the recording).
2 Likes

Thank you so much for this info. I will try your advice