# Problem with temporal spans mark with BAD when	epoching data

**URL:** https://mne.discourse.group/t/problem-with-temporal-spans-mark-with-bad-when-epoching-data/2279
**Category:** Mailing List Archive (read-only)
**Tags:** list-archive
**Created:** [August 2, 2020, 5:26pm UTC](https://mne.discourse.group/t/problem-with-temporal-spans-mark-with-bad-when-epoching-data/2279 "2020-08-02T17:26:50Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)
#### Post date: [August 2, 2020, 5:26pm UTC](https://mne.discourse.group/t/problem-with-temporal-spans-mark-with-bad-when-epoching-data/2279/1 "2020-08-02T17:26:50Z")

</div>

External Email - Use Caution

Hi Group,

I have a problem when epoching data using the Epoch module. Even though the  
annotations mark some of the time spans as BAD, but the drop\_log info  
indicated that all epochs are not BAD. I'm not sure which parameters that I  
have not correctly configured for the code below

import mne

filename = r'S17\_3.mff' # Accessible via the:  
[https://drive.google.com/drive/folders/15lAjuEPC2iSbBKBSy8y11Q0Fs24cnSd1](https://drive.google.com/drive/folders/15lAjuEPC2iSbBKBSy8y11Q0Fs24cnSd1)

raw = mne.io.read\_raw\_egi(filename)

raw.crop(tmax=240)

my\_annot = mne.Annotations(onset=[50, 95, 155], duration=[1, 3, 0.25],  
description=['BAD\_x', 'BAD', 'BAD\_Y'])

raw2 = raw.copy().set\_annotations(my\_annot)

event\_id = 1 # This is used to identify the events.

duration = 30 # Divide continous signal into an epoch of 30 seconds

events = mne.make\_fixed\_length\_events(raw2, id=event\_id, duration=duration)

epochs = mne.Epochs(raw2, events=events, event\_id=event\_id)

Thanks in advance for any insight

Regards

Rodney

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20200803/582e3508/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200803/582e3508/attachment.html)

---

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)
#### Post date: [August 3, 2020, 7:38pm UTC](https://mne.discourse.group/t/problem-with-temporal-spans-mark-with-bad-when-epoching-data/2279/2 "2020-08-03T19:38:33Z")

</div>

External Email - Use Caution

> import mne
> 
> filename = r'S17\_3.mff' # Accessible via the:  
> [S17\_1.mff - Google Drive](https://drive.google.com/drive/folders/15lAjuEPC2iSbBKBSy8y11Q0Fs24cnSd1)

The file I can download from that link is S17\_1.mff. When I download it,  
modify your code snippet to use that filename, and run it, I get an  
`epochs` instance with 8 events. `epochs.drop_bad()` gives 7 events, which  
makes sense because the first event will be cut off by the `tmin=-0.2`  
default. So I can't really reproduce your error.

You probably also want to pass `tmin=0, tmax=duration, baseline=None` or  
something similar to make sure you actually get 30 second epochs (the  
defaults are tmin=-0.2, tmax=5.0).

Eric  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20200803/6863f403/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200803/6863f403/attachment.html)
