I am working on EEG signal data stored in a ".gdf" file, for my university project. My aim is to open that file using Python. Till now, I am able to open that file using MNE package. The code is :
import os
import numpy as np
import mne
raw=mne.io.read_raw_gdf('1.gdf')
print(raw.info)
As a result, I am getting :
Extracting EDF parameters from C:\Users\Gamer\Desktop\1.gdf...
GDF file detected
Setting channel info structure...
Creating raw.info structure...
<Info | 7 non-empty values
bads: []
ch_names: AFz, F3, F1, Fz, F2, F4, FFC5h, FFC3h, FFC1h, FFC2h, FFC4h, ...
chs: 64 EEG
custom_ref_applied: False
highpass: 0.0 Hz
lowpass: 128.0 Hz
meas_date: 2017-04-04 12:50:01 UTC
nchan: 64
projs: []
sfreq: 256.0 Hz
>
Now, my questions are:
- how can I get the values in tabular form?
- How do I know the dimension of the dataset using Python?
- Is there any way to convert the .gdf file into .csv file or any other format (like pandas dataframe)?
The data set description is available at http://bnci-horizon-2020.eu/database/data-sets/001-2019/dataset_description_v1-1.pdf
Welcome to stack overflow and mne-python! :)
If you try to print the raw file that you've read (instead of just its info attribute) you should be able to see the dimensions. Raw files are always stored in mne python channels-first, so the dimensions of the data array are
channels x samples
.If you are fine with an array you can get it via
.get_data()
method (see the docs here). If you prefer pandas dataframe you can get it byraw.to_data_frame()
(docs).But before getting the data array/table you might want to perform filtering (for example
raw.filter(1, None)
), annotate bad data segments (tutorial), interpolate bad channels (tutorial) and perform ICA (tutorial). In general, it is likely that the analysis you are trying to conduct is either implemented in mne or easier to perform using mne objects.Make sure to see the many rich tutorials and examples in mne docs. If you have any further problems we use Discourse now: https://mne.discourse.group/