Hello,
I am trying time-frequency analysis by using csv file according to âOverview of MEG/EEG analysis with MNE-Pythonâ. But, I could not load csv file correctly.
âraw.plotâ displays only axis not wave, if I add scalings=âautoâ , wave forms appear.
But stim(event,misc) wave does not appear.
My question:
- Please let me know how to load csv file and display the waveform correctly.
The data is 'eegâx5ch, 'miscâx2ch. Please see the below. - If available, please let me know how to convert csv file to fif format.
I can not use raw.save(`raw.fifâ,overwrite=True) command.
There are many variables, and the selection is very complicated for a beginner.
Looking forward to hearing from any advise.
Best regards,
Tetsu
import numpy as np
import pandas as pd
import mne
Loading data
data = pd.read_csv(âC:/users/oyamatetsuji/desktop/veri_dEc09aft.csvâ, dtype = np.float64)
user_frame = pd.read_csv(âC:/users/oyamatetsuji/desktop/veri_dEc09aft.csvâ, dtype = np.float64)
data = user_frame.transpose().to_numpy()
n_channels = 7
sampling_freq = 2000
ch_names = [âch1â,âch2â,âch3â,âch4â,âch5â,âch6â,âch7â]
ch_names = [âFp1â,âFp2â,âFzâ,âCzâ,âPzâ,âO1â,âO2â]
ch_types = [âeegâ,âeegâ,âeegâ,âeegâ,âeegâ,âmiscâ,âmiscâ]
ch_types = [âmiscâ,âmiscâ,âmiscâ,âmiscâ,âmiscâ,âmiscâ,âmiscâ]
info = mne.create_info(ch_names=ch_names, ch_types=ch_types, sfreq = sampling_freq)
info.set_montage(âstandard_1020â)
info[âdescriptionâ] = âMy custom datasetâ
info[âbadsâ] =
print(info)
raw = mne.io.RawArray(data, info)
raw.save(âraw.fifâ, overwrite=True)
raw.plot(show_scrollbars=False,show_scalebars=False)
raw.plot()
print(raw)
print(raw.info)
raw.compute_psd(fmax=50).plot(picks=âdataâ, exclude=âbadsâ, amplitude=False)
raw.plot(duration=5, n_channels=7)