Multitaper method uses multiple windows (tapers) leading to different subspectra, whose weighted average forms the spectrum estimate and leads to robust MFCCs. For visualization, spectra are shown in dB scale but computations are based on linear values. The tapers are from the SWCE method [9].
时间: 2024-04-17 07:23:29 浏览: 7
多窗口(taper)的使用是多塔普尔方法(Multitaper method)的特点,它会产生不同的子频谱(subspectra),通过对这些子频谱进行加权平均来形成频谱估计,从而得到稳健的MFCCs(Mel频率倒谱系数)。为了可视化,频谱通常以dB刻度显示,但计算过程是基于线性值进行的。这些tapers来自SWCE方法[9]。
相关问题
Got unexpected keyword argument yscale for PSD method "multitaper".
如果你使用 `epochs.plot_psd()` 方法时出现了类似于 "Got unexpected keyword argument yscale for PSD method 'multitaper'" 的错误提示,这是因为该方法的默认 PSD 估计方法是多锥体法(multitaper),而多锥体法并不支持 `yscale` 参数。
如果你需要在使用多锥体法时改变纵轴刻度,可以通过调整 `ax` 参数来实现。具体来说,你可以使用 `epochs.plot_psd()` 方法的 `return_fig` 参数来获取绘图所用的 `matplotlib.figure.Figure` 对象,然后使用 `Figure.axes` 属性获取绘图所用的 `Axes` 对象,在对 `Axes` 对象进行进一步的操作。
例如,下面的代码将 `yscale` 参数设置为 'log':
```python
import matplotlib.pyplot as plt
fig = epochs.plot_psd(picks='eeg', fmin=1, fmax=60, n_fft=512, return_fig=True)
ax = fig.axes[0]
ax.set_yscale('log')
plt.show()
```
这段代码中,我们首先将 `return_fig` 参数设置为 `True`,以获取绘图所用的 `Figure` 对象。然后,我们使用 `Figure.axes` 属性获取绘图所用的 `Axes` 对象,并将其保存到变量 `ax` 中。最后,我们使用 `Axes.set_yscale()` 方法将纵轴坐标轴设置为对数刻度。
Got unexpected keyword argument ylim for PSD method "multitaper".
如果在使用`epochs.plot_psd()`函数时出现“Got unexpected keyword argument”错误,通常是因为使用了不支持的参数。例如,对于"multitaper"方法的PSD计算,不支持`ylim`参数。这种情况下,需要查看函数的文档或源代码,以了解哪些参数适用于哪种PSD计算方法。如果确实需要设置不支持的参数,可以考虑使用其他计算方法,或者手动计算PSD并绘制图像。
下面是一个例子,演示如何手动计算PSD并绘制图像:
```python
import numpy as np
import matplotlib.pyplot as plt
from mne import Epochs
from mne.time_frequency import psd_multitaper
# 创建Epochs对象
epochs = Epochs(raw, events, event_id, tmin=-1, tmax=1, baseline=(None, 0))
# 计算PSD并绘制图像
fig, ax = plt.subplots()
psd, freqs = psd_multitaper(epochs, fmin=1, fmax=50, proj=True, n_jobs=1)
ax.plot(freqs, np.mean(psd, axis=0), color='blue')
ax.set(xlabel='Frequency (Hz)', ylabel='Power Spectral Density (uV^2/Hz)', xscale='log', yscale='log')
# 显示图像
plt.show()
```
在这个例子中,我们使用`psd_multitaper()`函数手动计算PSD,并绘制了平均PSD曲线。由于我们手动计算PSD,因此可以设置任何想要的参数,例如`ylim`参数。在这个例子中,我们将纵轴的刻度值设为对数刻度,并设置纵轴标签为“Power Spectral Density (uV^2/Hz)”,以便更好地阅读和理解图像。