Channel information in psd functions

Hello!

What would be the best way to get channel names info from psd results (e.g. with psd_welch function)?
With the picks option you can select the specific channels to include. If there you have a list, then you have the information already there, but if you select things like “all” or “meg” where could we recover the channel info for each line of the array output?

Thanks!

Also where could I find the units of the results?

Units of psd_welch are (amplitude ** 2) / Hz, where amplitude will be the SI unit for the channel type (V for EEG, T for magnetometers, etc).

For keeping track of channel names, one approach is to store raw.ch_names (or epochs.ch_names or evoked.ch_names) in a list, then use mne.pick_info to get your pick indices. You can then use the pick indices for both the PSD function and for indexing the channel name list.

2 Likes

Thanks a lot @drammock !

For the units (or related) then I have a question:

– When I compute the PSD using mne.time_frequency.psd_welch function I get very different values than when I plot with raw.plot_psd with the very same inputs.

Even if I do log of Welch psd the magnitudes are very different.
Is this related just to the units or to some other additional processing step that I’m not taking into account. How are the plot_psd values computed? And what’s different from Welch? Can I have them as an output of the raw.plot_psd function?

Thanks for your help!

Look at the y-axis labels of the plots, and read the docstring for plot_psd parameters “estimate” and “dB”. These parameters affect exactly what gets computed before it is shown on the plot. Note also that internally, the values in MNE-Python are always in SI units, so the conversion from (say) V/√Hz to μV/√Hz is done by the plotting function so that the numbers labelling the y-axis don’t need to have 20 decimal places (this makes the plot easier to read).

Thanks @drammock !

I tried to plot both mne.time_frequency.psd_welch with some unit transformations and raw.plot_psd side by side in this notebook:

Would you mind having a look and guide me to get equal scales on the Welch psd plot?