Skip to content

tadorfer/artefact-correction-ICA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Artefact Correction with ICA

This repository contains the notebook referenced in my Medium post on ICA-based artefact correction.

Dependencies

  • Numpy
  • Pandas
  • mne
  • scikit-learn
  • matplotlib
  • PyQt5 (for dynamic plot only)

From .vhdr to .csv

The EEG data used in this notebook, eeg.csv, was originally loaded into Python using the MNE package. Assuming the raw EEG data file is named eeg.vhdr (Brain Products), the corresponding code to convert the .vhdr file to .csv is as follows:

import mne
import pandas as pd

# load data into MNE
raw = mne.io.read_raw_brainvision('eeg.vhdr')

# set channel montage
montage = mne.channels.make_standard_montage('standard_1020')
raw.set_montage(montage)

# get channel names
channels = raw.info.ch_names

# get the data in shape (samples, channels)
eeg = raw.get_data().T

# construct and save Pandas DataFrame as .csv
df = pd.DataFrame(eeg, columns=channels)
df.to_csv('eeg.csv', index=False)

Note: This code snippet is purely for illustratory purposes and does not include any preprocessing steps such as average referencing or signal filtering that would typically be performed.

About

Correcting time-series artefacts using FastICA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published