# EEG Preprocessing

**URL:** https://mne.discourse.group/t/eeg-preprocessing/4097
**Category:** Support & Discussions
**Tags:** preprocessing, eeg
**Created:** [December 8, 2021, 2:57pm UTC](https://mne.discourse.group/t/eeg-preprocessing/4097 "2021-12-08T14:57:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![abirmh1](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/abirmh1/32/1018_2.png) [@abirmh1](https://mne.discourse.group/u/abirmh1)
#### Post date: [December 8, 2021, 2:57pm UTC](https://mne.discourse.group/t/eeg-preprocessing/4097/1 "2021-12-08T14:57:48Z")

</div>

- MNE version: e.g. 0.24.0
- operating system: Windows 10  
Hi, I’m working with Epoc + (14 channels), my EEG data is in a .csv file. I need a guidiline of preprocessing. I need a FFT, High pass filter and FIR filters. I trying a lot of code but it doesnt work with me…if there is someone who managed to do them can you share it with me or is there any open source can help me. Thank you

---

<div class="post-metadata">

### Author: ![BarryLiu97](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/barryliu97/32/33_2.png) [@BarryLiu97](https://mne.discourse.group/u/BarryLiu97)
#### Post date: [December 8, 2021, 3:17pm UTC](https://mne.discourse.group/t/eeg-preprocessing/4097/2 "2021-12-08T15:17:45Z")

</div>

you could firstly read the csv file use `pandas`, like `pd.read_csv(filename)`, then transfer the data to `numpy.arrary` with the shape of `(channel_number, time_step)`, then use the sampling rate, channels’ name and data to create a Raw or Epoch object.

---

<div class="post-metadata">

### Author: ![mscheltienne](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mscheltienne/32/827_2.png) [@mscheltienne](https://mne.discourse.group/u/mscheltienne)
#### Post date: [December 9, 2021, 8:23am UTC](https://mne.discourse.group/t/eeg-preprocessing/4097/3 "2021-12-09T08:23:34Z")

</div>

The problem with storing EEG data in `.csv` file is that the format is non-standard and varies a lot depending on who created the `.csv`. You have to figure out yourself how to read it, parse it and transform it into a format understood by MNE, namely a numpy array of shape `(n_channels, n_times)` for a RAW instance; and `(n_epochs, n_channels, n_times)` for an EPOCH instance.

Documentation to create raw or epoch instance from numpy array:

- Raw: [mne.io.RawArray — MNE 0.24.1 documentation](https://mne.tools/stable/generated/mne.io.RawArray.html?highlight=rawarray#mne.io.RawArray)
- Epochs: [mne.EpochsArray — MNE 0.24.1 documentation](https://mne.tools/stable/generated/mne.EpochsArray.html)

Bandpass filter can then be applied with `instance.filter()`, e.g. for `raw.filter()`: [mne.io.RawArray — MNE 0.24.1 documentation](https://mne.tools/stable/generated/mne.io.RawArray.html?highlight=rawarray#mne.io.RawArray.filter)

For FFT, you could use PSD methods:

- welch: [mne.time\_frequency.psd\_welch — MNE 0.24.1 documentation](https://mne.tools/stable/generated/mne.time_frequency.psd_welch.html?highlight=psd_welch#mne.time_frequency.psd_welch)
- multitaper: [mne.time\_frequency.psd\_multitaper — MNE 0.24.1 documentation](https://mne.tools/stable/generated/mne.time_frequency.psd_multitaper.html?highlight=psd_multi#mne.time_frequency.psd_multitaper)

All the links I provided are part of the API; and you can find at the end of each class/function/method tutorials using it. You can also look the available tutorials directly here: [Tutorials — MNE 0.24.1 documentation](https://mne.tools/stable/auto_tutorials/index.html?highlight=tutorials)
