# About MNE C API

**URL:** <https://mne.discourse.group/t/about-mne-c-api/1077>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [September 4, 2016, 4:35am UTC](https://mne.discourse.group/t/about-mne-c-api/1077 "2016-09-04T04:35:24Z")\
**Posts on this page:** 7\
**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:** [September 4, 2016, 4:35am UTC](https://mne.discourse.group/t/about-mne-c-api/1077/1 "2016-09-04T04:35:24Z")

</div>

Dear list,

I was wondering if the source code of MNE C API released? If yes, where can  
I find it? Thanks!

Foucault  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20160904/45c220ce/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160904/45c220ce/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:** [September 4, 2016, 1:11pm UTC](https://mne.discourse.group/t/about-mne-c-api/1077/2 "2016-09-04T13:11:24Z")

</div>

Hello,

this question is not really related to MNE itself, but maybe someone has  
seen something like this before (I am new to EEG analysis):

I did a fast Fourier transform on 6 second long segments and calculated  
mean power values (averaged over electrodes, participants and 15 segments  
each). What perplexes me is the power peak at approx. 38 Hz:

My steps for data preparation were as follows:

&nbsp;&nbsp;&nbsp;\* band-pass filter of data (1 to 45 Hz)  
&nbsp;&nbsp;&nbsp;\* resampling from 512 Hz to 200 Hz  
&nbsp;&nbsp;&nbsp;\* cut recording into consecutive segments of 6 sec duration  
&nbsp;&nbsp;&nbsp;\* exclude segment if maximum allowed voltage step of 50 ?V is exceeded  
&nbsp;&nbsp;&nbsp;\* exclude segment if activity is lower than 0.5 ?V  
&nbsp;&nbsp;&nbsp;\* exclude segment if maximum and minimum amplitude exceed +/- 200 ?V  
&nbsp;&nbsp;&nbsp;\* exclude segment if maximum absolute difference of values in the  
segment \> 200 ?V  
&nbsp;&nbsp;&nbsp;\* retain only segments that are ok for all electrodes  
&nbsp;&nbsp;&nbsp;\* randomly choose 15 such good segments (all electrodes) from every  
participant  
&nbsp;&nbsp;&nbsp;\* calculate FFT for every 2 sec time segment for every electrode and  
participant  
&nbsp;&nbsp;&nbsp;\* calculate mean of all these FFTs  
&nbsp;&nbsp;&nbsp;\* plot  
Has someone seen a similar peak before?

Thanks for any help and advice.

Nico  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20160904/fc10e4f7/attachment-0001.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160904/fc10e4f7/attachment-0001.html)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: myplot.jpg  
Type: image/jpeg  
Size: 38890 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20160904/fc10e4f7/attachment-0001.jpg](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160904/fc10e4f7/attachment-0001.jpg)

---

<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:** [September 4, 2016, 2:30pm UTC](https://mne.discourse.group/t/about-mne-c-api/1077/3 "2016-09-04T14:30:21Z")

</div>

Can you try the same analysis without the resampling step? Maybe there is  
some aliasing of a line harmonic. How did you resample?

You can also try raw.plot\_psd to see if the original unprocessed data has  
it. That will tell you if something is in the original data, or if there is  
a processing problem.

Eric

> Hello,
> 
> this question is not really related to MNE itself, but maybe someone has  
> seen something like this before (I am new to EEG analysis):
> 
> I did a fast Fourier transform on 6 second long segments and calculated  
> mean power values (averaged over electrodes, participants and 15 segments  
> each). What perplexes me is the power peak at approx. 38 Hz:
> 
> My steps for data preparation were as follows:
> 
> &nbsp;&nbsp;&nbsp;1. band-pass filter of data (1 to 45 Hz)  
> &nbsp;&nbsp;&nbsp;2. resampling from 512 Hz to 200 Hz  
> &nbsp;&nbsp;&nbsp;3. cut recording into consecutive segments of 6 sec duration  
> &nbsp;&nbsp;&nbsp;4. exclude segment if maximum allowed voltage step of 50 ?V is exceeded  
> &nbsp;&nbsp;&nbsp;5. exclude segment if activity is lower than 0.5 ?V  
> &nbsp;&nbsp;&nbsp;6. exclude segment if maximum and minimum amplitude exceed +/- 200 ?V  
> &nbsp;&nbsp;&nbsp;7. exclude segment if maximum absolute difference of values in the  
> &nbsp;&nbsp;&nbsp;segment \> 200 ?V  
> &nbsp;&nbsp;&nbsp;8. retain only segments that are ok for all electrodes  
> &nbsp;&nbsp;&nbsp;9. randomly choose 15 such good segments (all electrodes) from every  
> &nbsp;&nbsp;&nbsp;participant  
> &nbsp;&nbsp;&nbsp;10. calculate FFT for every 2 sec time segment for every electrode and  
> &nbsp;&nbsp;&nbsp;participant  
> &nbsp;&nbsp;&nbsp;11. calculate mean of all these FFTs  
> &nbsp;&nbsp;&nbsp;12. plot
> 
> Has someone seen a similar peak before?
> 
> Thanks for any help and advice.
> 
> Nico
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> 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/20160904/c2a6989f/attachment-0001.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160904/c2a6989f/attachment-0001.html)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: myplot.jpg  
Type: image/jpeg  
Size: 38890 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20160904/c2a6989f/attachment-0001.jpg](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160904/c2a6989f/attachment-0001.jpg)

---

<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:** [September 4, 2016, 3:12pm UTC](https://mne.discourse.group/t/about-mne-c-api/1077/4 "2016-09-04T15:12:04Z")

</div>

Hi,

the MNE C code is not public but it has been shared in the past.

Why do you need access to it?

Alex

---

<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:** [September 4, 2016, 3:31pm UTC](https://mne.discourse.group/t/about-mne-c-api/1077/5 "2016-09-04T15:31:06Z")

</div>

Hello Eric,

thank you so much for pointing out the function plot\_psd. I wasn't aware of  
this and it saves me a ton of work for testing...

My raw EDF files are too large so I only picked EEG channels, chose a  
segment of only some minutes duration and saved the file without filtering  
or resampling as a .fif file. Now plot\_psd looks like this:

So it seems it is indeed in the raw data. Also, each obvious line peak (50  
Hz, 150 Hz) seems to have smaller peaks 12 Hz apart. So it seems to somehow  
originate from line-frequency electrical noise. Would you agree? If yes,  
shouldn't that be an ubiquitous issue in EEG experiments?

Thank you

Nico

Quoting Eric Larson \<larson.eric.d at gmail.com\>:

> Can you try the same analysis without the resampling step? Maybe there is  
> some aliasing of a line harmonic. How did you resample?
> 
> You can also try raw.plot\_psd to see if the original unprocessed data has  
> it. That will tell you if something is in the original data, or if there

is

> a processing problem.
> 
> Eric
> 
> > Hello,
> > 
> > this question is not really related to MNE itself, but maybe someone has  
> > seen something like this before (I am new to EEG analysis):
> > 
> > I did a fast Fourier transform on 6 second long segments and calculated  
> > mean power values (averaged over electrodes, participants and 15

segments

> > each). What perplexes me is the power peak at approx. 38 Hz:
> > 
> > My steps for data preparation were as follows:
> > 
> > ? ? 1. band-pass filter of data (1 to 45 Hz)  
> > ? ? 2. resampling from 512 Hz to 200 Hz  
> > ? ? 3. cut recording into consecutive segments of 6 sec duration  
> > ? ? 4. exclude segment if maximum allowed voltage step of 50 ?V is

exceeded

> > ? ? 5. exclude segment if activity is lower than 0.5 ?V  
> > ? ? 6. exclude segment if maximum and minimum amplitude exceed +/- 200

?V

> > ? ? 7. exclude segment if maximum absolute difference of values in the  
> > ? ? segment \> 200 ?V  
> > ? ? 8. retain only segments that are ok for all electrodes  
> > ? ? 9. randomly choose 15 such good segments (all electrodes) from

every

> > ? ? participant  
> > ? ? 10. calculate FFT for every 2 sec time segment for every electrode

and

> > ? ? participant  
> > ? ? 11. calculate mean of all these FFTs  
> > ? ? 12. plot
> > 
> > Has someone seen a similar peak before?
> > 
> > Thanks for any help and advice.
> > 
> > Nico
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > 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/20160904/eb3529f7/attachment-0001.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160904/eb3529f7/attachment-0001.html)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: illustration.jpg  
Type: image/jpeg  
Size: 24030 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20160904/eb3529f7/attachment-0001.jpg](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160904/eb3529f7/attachment-0001.jpg)

---

<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:** [September 4, 2016, 3:46pm UTC](https://mne.discourse.group/t/about-mne-c-api/1077/6 "2016-09-04T15:46:31Z")

</div>

You might also consider looking at the Python code. Most of the heavy  
lifting functions exist there now and it is open source with a BSD license.

Eric

Hi,

the MNE C code is not public but it has been shared in the past.

Why do you need access to it?

Alex

> Dear list,
> 
> I was wondering if the source code of MNE C API released? If yes, where

can

> I find it? Thanks!
> 
> Foucault
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> 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

---

<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:** [September 4, 2016, 3:57pm UTC](https://mne.discourse.group/t/about-mne-c-api/1077/7 "2016-09-04T15:57:34Z")

</div>

If I had to guess, this is likely to be something that is specific to your site.

Best wishes,  
Avniel
