# Simulating EEG data with MNE

**URL:** <https://mne.discourse.group/t/simulating-eeg-data-with-mne/2153>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [April 13, 2020, 2:21pm UTC](https://mne.discourse.group/t/simulating-eeg-data-with-mne/2153 "2020-04-13T14:21:23Z")\
**Posts on this page:** 12\
**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:** [April 13, 2020, 2:21pm UTC](https://mne.discourse.group/t/simulating-eeg-data-with-mne/2153/1 "2020-04-13T14:21:23Z")

</div>

External Email - Use Caution

Hi,

I'm trying to simulate EEG data based on my existing dataset, which is in  
the format of .eeg/.vhdr/.vmrk files (raw), .rds files (processed) and a  
.csv file (summarised). I tried these tutorials

[https://mne.tools/dev/auto\_examples/simulation/plot\_simulate\_evoked\_data.html](https://mne.tools/dev/auto_examples/simulation/plot_simulate_evoked_data.html)  
[https://mne.tools/dev/auto\_examples/simulation/plot\_simulate\_raw\_data.html?highlight=simulate](https://mne.tools/dev/auto_examples/simulation/plot_simulate_raw_data.html?highlight=simulate)

but I did not manage to do so, since these are based on .fiff files and my  
dataset does not contain any fwd/ave/cov/proj files. Is there a way to  
simulate data based on .eeg/.vhdr/.vmrk OR .rds OR .csv files?

Any suggestions would be appreciated.

Thanks in advance,

Daniel  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20200413/dee9f281/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200413/dee9f281/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:** [April 13, 2020, 2:29pm UTC](https://mne.discourse.group/t/simulating-eeg-data-with-mne/2153/2 "2020-04-13T14:29:32Z")

</div>

External Email - Use Caution

hi Daniel,

to be able to simulate data you need a forward model (know how to go from  
source  
to your EEG channel locations).

WOuld it make sense to get sensor locations with your file and then use  
fsaverage  
after mapping your electrodes to this template head?

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:** [April 13, 2020, 2:42pm UTC](https://mne.discourse.group/t/simulating-eeg-data-with-mne/2153/3 "2020-04-13T14:42:24Z")

</div>

External Email - Use Caution

Hi Alex,

Thanks for your fast reply. I'm not entirely sure if I understand what you  
mean, but judging by the documentation (  
[https://mne.tools/dev/auto\_tutorials/source-modeling/plot\_forward.html](https://mne.tools/dev/auto_tutorials/source-modeling/plot_forward.html)), I  
would still need a -trans.fif file, correct? I am not in possession of this  
file.

I do have sensor location data in my files, but I'm not sure how I can use  
this or fsaverage to simulate data. Moreover, FreeSurfer is used for MRI  
data and not for EEG data right?

Daniel

---

<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:** [April 13, 2020, 2:44pm UTC](https://mne.discourse.group/t/simulating-eeg-data-with-mne/2153/4 "2020-04-13T14:44:38Z")

</div>

External Email - Use Caution

have a look at :

[https://mne.tools/stable/auto\_tutorials/source-modeling/plot\_eeg\_no\_mri.html#sphx-glr-auto-tutorials-source-modeling-plot-eeg-no-mri-py](https://mne.tools/stable/auto_tutorials/source-modeling/plot_eeg_no_mri.html#sphx-glr-auto-tutorials-source-modeling-plot-eeg-no-mri-py)

let me know if it does not help

A  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20200413/778ae5ee/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200413/778ae5ee/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:** [April 14, 2020, 6:59am UTC](https://mne.discourse.group/t/simulating-eeg-data-with-mne/2153/5 "2020-04-14T06:59:43Z")

</div>

External Email - Use Caution

Hi Alex,

I've been tinkering with your suggestions, but I keep getting the following  
error:

RuntimeError: Could not load any valid 3D backend: ['mayavi', 'pyvista']

I can't seem to find any documentation to solve it online, do you have  
any suggestions what this could be and how I can fix it?

Daniel

---

<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:** [April 14, 2020, 7:04am UTC](https://mne.discourse.group/t/simulating-eeg-data-with-mne/2153/6 "2020-04-14T07:04:52Z")

</div>

External Email - Use Caution

Hi Daniel,

What happens if you try and import either of those packages directly?

Cheers,

-Morgan

---

<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:** [April 14, 2020, 7:16am UTC](https://mne.discourse.group/t/simulating-eeg-data-with-mne/2153/7 "2020-04-14T07:16:16Z")

</div>

External Email - Use Caution

hi,

also please tell us what this gives you:

[https://mne.tools/dev/generated/mne.sys\_info.html](https://mne.tools/dev/generated/mne.sys_info.html)

on your machine

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:** [April 14, 2020, 7:22am UTC](https://mne.discourse.group/t/simulating-eeg-data-with-mne/2153/8 "2020-04-14T07:22:35Z")

</div>

External Email - Use Caution

I successfully installed Pyvista, but trying to install Mayavi generated a  
huge error log (see attached file).

This is the output of the mne.sys\_info():

Platform: Darwin-19.4.0-x86\_64-i386-64bit  
Python: 3.7.7 (default, Mar 26 2020, 10:32:53) [Clang 4.0.1  
(tags/RELEASE\_401/final)]  
Executable: /Users/danielvandencorput/anaconda3/envs/opencv/bin/python  
CPU: i386: 4 cores  
Memory: Unavailable (requires "psutil" package)  
mne: 0.20.0  
numpy: 1.18.1 {blas=mkl\_rt, lapack=mkl\_rt}  
scipy: 1.4.1  
matplotlib: 3.2.1 {backend=module://ipykernel.pylab.backend\_inline}

sklearn: 0.22.1  
numba: Not found  
nibabel: Not found  
cupy: Not found  
pandas: 1.0.3  
dipy: Not found  
mayavi: Not found  
pyvista: 0.24.1  
vtk: 8.1.2

Cheers

> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution
> 
> hi,
> 
> also please tell us what this gives you:
> 
> [mne.sys\_info — MNE 1.7.0.dev17+g20174f448 documentation](https://mne.tools/dev/generated/mne.sys_info.html)
> 
> on your machine
> 
> Alex
> 
> \>  
> \> External Email - Use Caution  
> \>  
> \> Hi Daniel,  
> \>  
> \> What happens if you try and import either of those packages directly?  
> \>  
> \> Cheers,  
> \>  
> \> -Morgan  
> \>  
> \>\>  
> \>\> External Email - Use Caution  
> \>\>  
> \>\> Hi Alex,  
> \>\>  
> \>\> I've been tinkering with your suggestions, but I keep getting the  
> following error:  
> \>\>  
> \>\> RuntimeError: Could not load any valid 3D backend: ['mayavi', 'pyvista']  
> \>\>  
> \>\>  
> \>\> I can't seem to find any documentation to solve it online, do you have  
> any suggestions what this could be and how I can fix it?  
> \>\>  
> \>\>  
> \>\> Daniel  
> \>\>  
> \>\>  
> \>\>\>  
> \>\>\> External Email - Use Caution  
> \>\>\>  
> \>\>\> have a look at :  
> \>\>\>  
> \>\>\>  
> [Page Redirection](https://mne.tools/stable/auto_tutorials/source-modeling/plot_eeg_no_mri.html#sphx-glr-auto-tutorials-source-modeling-plot-eeg-no-mri-py)  
> \>\>\>  
> \>\>\> let me know if it does not help  
> \>\>\>  
> \>\>\> A  
> \>\>\> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> \>\>\> 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)  
> \>\>  
> \>\> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> \>\> 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)  
> \>  
> \> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> \> 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)
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> 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)

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20200414/2a108f54/attachment-0001.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200414/2a108f54/attachment-0001.html)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: Error\_output.rtf  
Type: text/rtf  
Size: 45430 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20200414/2a108f54/attachment-0001.rtf](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200414/2a108f54/attachment-0001.rtf)

---

<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:** [April 14, 2020, 7:27am UTC](https://mne.discourse.group/t/simulating-eeg-data-with-mne/2153/9 "2020-04-14T07:27:08Z")

</div>

External Email - Use Caution

then you have pyvista so it should work.

does making a toy pyvista plot works on your system?

pick one in : [https://docs.pyvista.org/examples/index.html](https://docs.pyvista.org/examples/index.html)

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:** [April 14, 2020, 7:30am UTC](https://mne.discourse.group/t/simulating-eeg-data-with-mne/2153/10 "2020-04-14T07:30:04Z")

</div>

External Email - Use Caution

Plotting with pyvista works as it should be.

---

<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:** [April 14, 2020, 7:33am UTC](https://mne.discourse.group/t/simulating-eeg-data-with-mne/2153/11 "2020-04-14T07:33:43Z")

</div>

External Email - Use Caution

please open an issue at [https://github.com/mne-tools/mne-python/issues](https://github.com/mne-tools/mne-python/issues)

so we can look into it with Guillaume Favelier

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:** [April 14, 2020, 7:37am UTC](https://mne.discourse.group/t/simulating-eeg-data-with-mne/2153/12 "2020-04-14T07:37:33Z")

</div>

External Email - Use Caution

I will do that. Thanks for your help either way.

Daniel
