yasa.moving_transform

yasa.
moving_transform
(x, y=None, sf=100, window=0.3, step=0.1, method='corr', interp=False)[source] Moving transformation of one or two timeseries.
 Parameters
 xarray_like
Singlechannel data
 yarray_like, optional
Second singlechannel data (only used if method in [‘corr’, ‘covar’]).
 sffloat
Sampling frequency.
 windowint
Window size in seconds.
 stepint
Step in seconds. A step of 0.1 second (100 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.
 methodstr
Transformation to use. Available methods are:
'mean' : arithmetic mean of x 'min' : minimum value of x 'max' : maximum value of x 'ptp' : peaktopeak amplitude of x 'prop_above_zero' : proportion of values of x that are above zero 'rms' : root mean square of x 'slope' : slope of the leastsquare regression of x (in a.u / sec) 'corr' : Correlation between x and y 'covar' : Covariance between x and y
 interpboolean
If True, a cubic interpolation is performed to ensure that the output has the same size as the input.
 Returns
 tnp.array
Time vector, in seconds, corresponding to the MIDDLE of each epoch.
 outnp.array
Transformed signal
Notes
This function was inspired by the transform_signal function of the Wonambi package (https://github.com/wonambipython/wonambi).