yasa.stft_power¶
- yasa.stft_power(data, sf, window=2, step=0.2, band=(1, 30), interp=True, norm=False)[source]¶
Compute the pointwise power via STFT and interpolation.
- Parameters
- dataarray_like
Single-channel data.
- sffloat
Sampling frequency of the data.
- windowint
Window size in seconds for STFT. 2 or 4 seconds are usually a good default. Higher values = higher frequency resolution = lower time resolution.
- stepint
Step in seconds for the STFT. A step of 0.2 second (200 ms) is usually a good default.
If
step
== 0, overlap at every sample (slowest)If
step
== nperseg, no overlap (fastest)
Higher values = higher precision = slower computation.
- bandtuple or None
Broad band frequency range. Default is 1 to 30 Hz.
- interpboolean
If True, a cubic interpolation is performed to ensure that the output is the same size as the input (= pointwise power).
- normbool
If True, return bandwise normalized band power, i.e. for each time point, the sum of power in all the frequency bins equals 1.
- Returns
- f
numpy.ndarray
Frequency vector
- t
numpy.ndarray
Time vector
- Sxx
numpy.ndarray
Power in the specified frequency bins of shape (f, t)
- f
Notes
2D Interpolation is done using
scipy.interpolate.RectBivariateSpline
which is much faster thanscipy.interpolate.interp2d
for a rectangular grid. The default is to use a bivariate spline with 3 degrees.