# \[Martinos-python\] .drop\_bad problem

**URL:** <https://mne.discourse.group/t/martinos-python-drop-bad-problem/1735>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [February 6, 2019, 11:35am UTC](https://mne.discourse.group/t/martinos-python-drop-bad-problem/1735 "2019-02-06T11:35:19Z")\
**Posts on this page:** 3\
**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:** [February 6, 2019, 11:35am UTC](https://mne.discourse.group/t/martinos-python-drop-bad-problem/1735/1 "2019-02-06T11:35:19Z")

</div>

External Email - Use Caution

\*Dear Alexandre and Alexander,\*

I also fwd this message to the mne\_analysis at nmr.mgh.harvard.edu

Results of .drop\_bad in v 0.16.2 (python 3.6.6) and .drop\_bad\_epochs in  
0.12.dev (python 2.7.6) are different.

This is not filtering. I tested performance of the .drop\_bad in v 0.16.2  
(python 3.6.6) and .drop\_bad\_epochs in 0.12.dev (python 2.7.6) without any  
additional operations on the data. Result is clearly different! The  
difference, however, starts only after the 25th epoch.

I did:

\*data=epochs\_rej.get\_data() \*

\*average\_over\_epoch=np.mean(np.mean(data [:, 0:306, :], 2),1) \*

The ?\*average\_over\_epoch\*? is exactly the same in both versions up to the  
25th epoch, but is absolutely different afterwards.

I uploaded the epoches and the corresponding raw files:

[https://we.tl/t-Rmfow2yf2k](https://we.tl/t-Rmfow2yf2k)

and

[https://we.tl/t-N69ztC2qtt](https://we.tl/t-N69ztC2qtt)

Best regards,  
Elena

---

<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:** [February 6, 2019, 9:45pm UTC](https://mne.discourse.group/t/martinos-python-drop-bad-problem/1735/2 "2019-02-06T21:45:25Z")

</div>

External Email - Use Caution

I can confirm that the good epochs 25-89 (of 97) appear different with  
`epochs.plot()`, despite the epochs.events and epochs.selections attributes  
being the same. However `epochs.selection` shows that the first of the  
original events that would be skipped is the 25th, so this is presumably a  
bug with `mne.Epochs` selecting the wrong data under some circumstances.

Given that 0.12 is almost 3 years old now, we have fixed a lot of bugs  
since then. It's likely that there is some bug in 0.12 that was fixed in  
0.16 (or earlier). Can you provide a minimal script that takes the raw data  
you sent (which appears to be identical in both archives?) and creates  
`-epo.fif` files that differ between 0.12 and 0.16? The `mne.Epochs`  
constructor parameters probably matter here.

Eric

---

<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:** [February 7, 2019, 10:14am UTC](https://mne.discourse.group/t/martinos-python-drop-bad-problem/1735/3 "2019-02-07T10:14:18Z")

</div>

External Email - Use Caution

Dear Eric,  
I attached the scripts.  
I am sure that the problem is with v0.16, not with v0.12, because if I use  
v0.16, but do the bad epochs rejection manually the result is the same as  
with v0.12.

Best regards,  
Elena  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20190207/f92714c1/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190207/f92714c1/attachment.html)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: step4\_epoch\_v12py2\_simple.py  
Type: text/x-python-script  
Size: 2162 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20190207/f92714c1/attachment.bin](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190207/f92714c1/attachment.bin)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: step4\_epoch\_v16py3\_simple.py  
Type: text/x-python-script  
Size: 1987 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20190207/f92714c1/attachment-0001.bin](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190207/f92714c1/attachment-0001.bin)
