Source: GitHub
Signature¶
def sdynpy.signal_processing.sdynpy_srs.window_compensation(x: numpy.ndarray, window: numpy.ndarray | float, sample_rate: float, delay: float = 0.0) -> Dict[str, numpy.ndarray]Apply a compensation waveform to enforce zero terminal cumulative moments.
Parameters¶
x : ndarray Input waveform with shape
(n_samples,).window : ndarray or float If an array, it is used directly as the compensation window. If a scalar, it is interpreted as a compensation frequency and a Nuttall window is generated internally.
sample_rate : float Sampling rate in samples per second.
delay : float, default=0.0 Delay applied to the compensating waveform, in seconds.
Returns¶
dict
Dictionary containing:
-
"comp": ndarrayThe compensating waveform.
-
"xc": ndarrayThe compensated waveform.
-
"coefficients": ndarrayThe three coefficients multiplying the DC, sine, and cosine
compensation basis terms.
Notes¶
This function follows the numerical approach of MATLAB sdwcomp. The
compensation is constructed from three basis terms: a windowed DC term,
a windowed sine term, and a windowed cosine term. Their amplitudes are
chosen so that the final cumulative sums corresponding to acceleration,
velocity, and displacement-like integrals vanish.