MNE
python package¶I am interested in sleep data analysis, where one core informational source is neurophysiological data and in particular EEG data coming from polysomnigraphy.
MNE is a Python package designed particularly for this purpose. Below I outline how to install the package and how to load data with it.
We can also test the status of the package with the info
method.
import mne
import os
mne.sys_info()
We can set the path to where we download the dataset.
mne.set_config('MNE_DATA', '~/MNE_DATA')
Here we use the sample dataset which has its own module.
First we generate the path where we will download the sample dataset.
sample_data_folder = mne.datasets.sample.data_path()
sample_data_folder
We specify the specific dataset we want to use.
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample','sample_audvis_filt-0-40_raw.fif')
sample_data_raw_file
Then, we download and open the data (here I have it already)
raw = mne.io.read_raw_fif(sample_data_raw_file)
Basic information
print(raw)
print(raw.info)
And finally plotting the data
raw.plot_psd(fmax=50)
raw.plot(duration=5, n_channels=30)