- 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:
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?
Could you please share a minimal example of Python code that demonstrates the problem?
raw = mne.io.read_raw_edf('C:/Users/SC4001E0-PSG.edf', preload=True)
chan = raw.ch_names
print("print channel :", chan)
sf = raw.info['sfreq']
data = raw.get_data() * 1e6
import pandas as pd
hypno = pd.read_csv("C:/Users/yasa_example_night_young_hypno.csv", squeeze=True)
counts, probs = yasa.transition_matrix(hypno)
import numpy as np
hypno_up = yasa.hypno_upsample_to_data(hypno, sf_hypno=1/30, data=raw)
yasa.plot_spectrogram(data[chan.index("EEG Fpz-Cz")], sf, hypno_up)
yasa.bandpower(raw, relative=False, bands=[(1, 9, "Slow"), (9, 30, "Fast")])
bandpower = yasa.bandpower(raw, hypno=hypno_up, include=(2, 3, 4))
fig = yasa.topoplot(bandpower.xs(3)['Delta'])
Error —> 47 fig = yasa.topoplot(bandpower.xs(3)[‘Delta’])
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.
Vallat who made yasa told me to ask mne about the channel!