You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reject_tmin and reject_tmax parameters from Epochs are not used for the reject_by_annotation parameter. But instead only for the reject and flat parameters.
# Create raw datasfreq=1000times=np.arange(0, 10, 0.001)
sin=np.sin(times*10)
cos=np.cos(times*10)
data=np.array([sin, cos])
ch_types= ['mag', 'grad']
ch_names= ['sin', 'cos']
info=mne.create_info(ch_names=ch_names, sfreq=sfreq, ch_types=ch_types)
raw=mne.io.RawArray(data, info)
# We have an event at 2 secondsevents=np.array([[2000, 0, 1]])
# There is a bad segment from 1 to 1.5 secondsonset=[1]
duration=[0.5]
description=['BAD']
annots=mne.Annotations(onset, duration, description)
raw.set_annotations(annots)
# Create epochs from 1s to 3s, centered on the event at 2s.# this epoch will be rejected_by_annotation, because there is an overlap# with a bad segment (1s to 1.5s)epochs=mne.Epochs(raw, events, tmin=-1, tmax=1, preload=True, reject_by_annotation=True)
assertlen(epochs) ==0# Now setting `reject_tmin` so that there is NO overlap ... should not reject# any epochs ... because bad segment is from 1s to 1.5s ... but epochs "reject" window# is from 1.8s to 3sepochs=mne.Epochs(raw, events, tmin=-1, tmax=1, reject_tmin=-0.2, preload=True, reject_by_annotation=True)
# This errorsassertlen(epochs) ==1, "oups!"
Expected results
reject_tmin and reject_tmax should have an effect on how reject_by_annotation is applied.
Example: When an epoch from -2s to 3s relative to 0 was formed with reject_tmin=-0.2, then that epoch MUST NOT be rejected if there is an overlap with a BAD annotation from, say -2s to -1.5s
The text was updated successfully, but these errors were encountered:
first reported on gitter
Describe the bug
The
reject_tmin
andreject_tmax
parameters fromEpochs
are not used for thereject_by_annotation
parameter. But instead only for thereject
andflat
parameters.Look at this part in the code.
Steps to reproduce
MWE:
Expected results
reject_tmin
andreject_tmax
should have an effect on howreject_by_annotation
is applied.Example: When an epoch from -2s to 3s relative to 0 was formed with
reject_tmin=-0.2
, then that epoch MUST NOT be rejected if there is an overlap with aBAD
annotation from, say -2s to -1.5sThe text was updated successfully, but these errors were encountered: