PhD-GOAT
(GOATLAB)
May 3, 2022, 1:12am
1
MNE version: 1.0.1
operating system: Windows 10
When I using the yasa.topoplot function the index MUST be the channel names (e.g. [‘C4’, ‘F4’] or [‘C4-M1’, ‘C3-M2’]). A list of the accepted montage/channel names can be found here:
https://mne.tools/stable/generated/mne.channels.make_standard_montage.html#mne.channels.make_standard_montage
What I am curious about here is that there are 7 channels in the psg data. It doesn’t work if the number of channels is different. What should I do if the actual clinical data is different? Is there a way?
richard
(Richard Höchenberger)
May 3, 2022, 5:59am
2
Could you please share a minimal example of Python code that demonstrates the problem?
PhD-GOAT
(GOATLAB)
May 3, 2022, 6:01am
3
import mne
raw = mne.io.read_raw_edf('C:/Users/SC4001E0-PSG.edf', preload=True)
print(raw)
print(raw.ch_names)
chan = raw.ch_names
print("print channel :", chan)
print(raw.info['sfreq'])
raw.resample(100)
sf = raw.info['sfreq']
sf
raw.filter(0.3, 45)
data = raw.get_data() * 1e6
print(data.shape)
import pandas as pd
hypno = pd.read_csv("C:/Users/yasa_example_night_young_hypno.csv", squeeze=True)
hypno
import yasa
yasa.plot_hypnogram(hypno)
yasa.sleep_statistics(hypno, sf_hyp=1/30)
counts, probs = yasa.transition_matrix(hypno)
probs.round(3)
import numpy as np
np.diag(probs.loc[2:, 2:]).mean().round(3)
hypno_up = yasa.hypno_upsample_to_data(hypno, sf_hypno=1/30, data=raw)
print(len(hypno_up))
yasa.plot_spectrogram(data[chan.index("EEG Fpz-Cz")], sf, hypno_up)
yasa.bandpower(raw)
yasa.bandpower(raw, relative=False, bands=[(1, 9, "Slow"), (9, 30, "Fast")])
bandpower = yasa.bandpower(raw, hypno=hypno_up, include=(2, 3, 4))
bandpower.to_csv("C:/Users/bandpower.csv")
fig = yasa.topoplot(bandpower.xs(3)['Delta'])
Error —> 47 fig = yasa.topoplot(bandpower.xs(3)[‘Delta’])
richard
(Richard Höchenberger)
May 3, 2022, 12:48pm
4
Thank you, @PhD-GOAT .
As a general remark, please provide more context to your questions. We need the full traceback, for example. But also the version numbers of libraries you’re using etc.
That said, I’m not familiar with yasa, and I suggest you ask the author of this package for advice.
Best,
Richard
1 Like
PhD-GOAT
(GOATLAB)
May 3, 2022, 7:44pm
5
hi, @richard
Vallat who made yasa told me to ask mne about the channel!