scipy.signal.spectrogram

  • Post author:
  • Post category:其他


参考官方文档



https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.spectrogram.html

scipy.signal.spectrogram(x, fs=1.0, window=(‘tukey’, 0.25), nperseg=None, noverlap=None, nfft=None, detrend=’constant’, return_onesided=True, scaling=’density’, axis=-1, mode=’psd’)


Parameters:



x

:输入的时间序列


fs

:float型,采样频率,默认值为1.0


window

:分窗大小,默认使用参数为0.25的Tukey window


nperseg

:int型 窗口长度


noverlap

:int型 段与段之间的重叠面积


nfft

: int, optional

Length of the FFT used, if a zero padded FFT is desired. If None, the FFT length is nperseg. Defaults to None.


detrend

: str or function or False, optional

Specifies how to detrend each segment. If detrend is a string, it is passed as the type argument to the detrend function. If it is a function, it takes a segment and returns a detrended segment. If detrend is False, no detrending is done. Defaults to ‘constant’.


return_onesided

: bool, optional

If True, return a one-sided spectrum for real data. If False return a two-sided spectrum. Note that for complex data, a two-sided spectrum is always returned.


scaling

: { ‘density’, ‘spectrum’ }, optional

Selects between computing the power spectral density (‘density’) where Sxx has units of V**2/Hz and computing the power spectrum (‘spectrum’) where Sxx has units of V**2, if x is measured in V and fs is measured in Hz. Defaults to ‘density’.


axis

: int, optional

Axis along which the spectrogram is computed; the default is over the last axis (i.e. axis=-1).


mode

: str, optional

Defines what kind of return values are expected. Options are [‘psd’, ‘complex’, ‘magnitude’, ‘angle’, ‘phase’]. ‘complex’ is equivalent to the output of stft with no padding or boundary extension. ‘magnitude’ returns the absolute magnitude of the STFT. ‘angle’ and ‘phase’ return the complex angle of the STFT, with and without unwrapping, respectively.


Returns:


f:频域信息

t:时域信息

Sxx:时频图



版权声明:本文为gw1994原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。