# downsampling in bdf file

**URL:** <https://mne.discourse.group/t/downsampling-in-bdf-file/900>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [January 14, 2015, 8:24pm UTC](https://mne.discourse.group/t/downsampling-in-bdf-file/900 "2015-01-14T20:24:21Z")\
**Posts on this page:** 4\
**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:** [January 14, 2015, 8:24pm UTC](https://mne.discourse.group/t/downsampling-in-bdf-file/900/1 "2015-01-14T20:24:21Z")

</div>

Hi MNE users,

I am tring to use MNE python to process the bdf EEG file. Since our data is  
huge, so I first downsampled using the edfbrowser which is a bdf processing  
software, then I loaded the downsampled data using read\_raw\_edf(), but I  
found that the STI channel was totally messed up, I can find far more  
events than there should be.

To make sure the file is good, I tested using matlab and everything works  
well, do you guys have any idea what is going on please?

Thanks and appreciate,

Mengting  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20150114/48ebe647/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20150114/48ebe647/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:** [January 14, 2015, 8:31pm UTC](https://mne.discourse.group/t/downsampling-in-bdf-file/900/2 "2015-01-14T20:31:33Z")

</div>

I'm not familiar with the edfbrowser routines, but if they use standard  
low-pass-downsample methods instead of a zero-order hold for the stimulus  
channel, the low-pass filter ringing will produce many errant events. When  
you say that you tested the file using MATLAB, you mean that you opened it?  
Did you look at the stimulus channel to see if the resampling introduced  
ringing?

Cheers,  
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:** [January 14, 2015, 8:46pm UTC](https://mne.discourse.group/t/downsampling-in-bdf-file/900/3 "2015-01-14T20:46:07Z")

</div>

Ya, I opened it with matlab, see the events, there appears some more event  
(probably twice more), but the original events are well kept (both the  
temporal point and event id are both kept). However in MNE, it appears 100  
times more events than there should be and all their temporal order and  
events id are both messed up.

There is also a error as below:

ValueError: You have 77499 events shorter than the shortest\_event.  
These are very unusual and you may want to set min\_duration to a larger  
value e.g. x / raw.info['sfreq']. Where x = 1 sample shorter than the  
shortest event length.

Thanks,

Mengting

2015-01-14 15:31 GMT-05:00 Eric Larson \<larson.eric.d at gmail.com\>:

> I'm not familiar with the edfbrowser routines, but if they use standard  
> low-pass-downsample methods instead of a zero-order hold for the stimulus  
> channel, the low-pass filter ringing will produce many errant events. When  
> you say that you tested the file using MATLAB, you mean that you opened it?  
> Did you look at the stimulus channel to see if the resampling introduced  
> ringing?
> 
> Cheers,  
> Eric
> 
> > Hi MNE users,
> > 
> > I am tring to use MNE python to process the bdf EEG file. Since our data  
> > is huge, so I first downsampled using the edfbrowser which is a bdf  
> > processing software, then I loaded the downsampled data using  
> > read\_raw\_edf(), but I found that the STI channel was totally messed up, I  
> > can find far more events than there should be.
> > 
> > To make sure the file is good, I tested using matlab and everything works  
> > well, do you guys have any idea what is going on please?
> > 
> > Thanks and appreciate,
> > 
> > Mengting
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Mne\_analysis mailing list  
> > Mne\_analysis at nmr.mgh.harvard.edu  
> > [Mne\_analysis Info Page](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> > 
> > The information in this e-mail is intended only for the person to whom it  
> > is  
> > addressed. If you believe this e-mail was sent to you in error and the  
> > e-mail  
> > contains patient information, please contact the Partners Compliance  
> > HelpLine at  
> > [MyComplianceReport.com: Compliance and Ethics Reporting](http://www.partners.org/complianceline) . If the e-mail was sent to you  
> > in error  
> > but does not contain patient information, please contact the sender and  
> > properly  
> > dispose of the e-mail.
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Mne\_analysis mailing list  
> Mne\_analysis at nmr.mgh.harvard.edu  
> [Mne\_analysis Info Page](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> 
> The information in this e-mail is intended only for the person to whom it  
> is  
> addressed. If you believe this e-mail was sent to you in error and the  
> e-mail  
> contains patient information, please contact the Partners Compliance  
> HelpLine at  
> [MyComplianceReport.com: Compliance and Ethics Reporting](http://www.partners.org/complianceline) . If the e-mail was sent to you in  
> error  
> but does not contain patient information, please contact the sender and  
> properly  
> dispose of the e-mail.

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20150114/8cb8ec1e/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20150114/8cb8ec1e/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:** [January 14, 2015, 9:02pm UTC](https://mne.discourse.group/t/downsampling-in-bdf-file/900/4 "2015-01-14T21:02:12Z")

</div>

it's possible that mne-python resamples the stim channel as it does  
not know it's a stim channel.

it you confirm the bug please share the file so we can fix asap

Alex
