Source: GitHub
Signature¶
def sdynpy.signal_processing.sdynpy_harmonic.vold_kalman_filter(sample_rate, signal, arguments, filter_order=None, bandwidth=None, method=None, return_amp_phs=False, return_envelope=False, return_r=False, verbose=False)Extract sinusoidal components from a signal using the second generation Vold-Kalman filter.
Parameters¶
sample_rate : float The sample rate of the signal in Hz.
signal : ndarray A 1D signal containing sinusoidal components that need to be extracted
arguments : ndarray A 2D array consisting of the arguments to the sinusoidal components of the form exp(1jargument). This is the integral over time of the angular frequency, which can be approximated as 2np.pi*scipy.integrate.cumulative_trapezoid(frequencies,timesteps,initial=0) if frequencies is the frequency at each time step in Hz timesteps is the vector of time steps in seconds. This is a 2D array where the number of rows is the number of different sinusoidal components that are desired to be extracted, and the number of columns are the number of time steps in the
signalargument.filter_order : int, optional The order of the VK filter, which should be 1, 2, or 3. The default is 2. The low-pass filter roll-off is approximately -40 dB per times the filter order.
bandwidth : ndarray, optional The prescribed bandwidth of the filter. This is related to the filter selectivity parameter
rin the literature. This will be broadcast to the same shape as theargumentsargument. The default is the sample rate divided by 1000.method : str, optional Can be set to either ‘single’ or ‘multi’. In a ‘single’ solution, each sinusoidal component will be solved independently without any coupling. This can be more efficient, but will result in errors if the frequencies of the sine waves cross. The ‘multi’ solution will solve for all sinusoidal components simultaneously, resulting in a better estimate of crossing frequencies. The default is ‘multi’.
return_amp_phs : bool Returns the amplitude and phase of the reconstructed signals at each time step. Default is False
return_envelope : bool Returns the complex envelope and phasors at each time step. Default is False
return_r : bool Returns the computed selectivity parameters for the filter. Default is False
verbose : bool Prints progress throughout the calculation if True, default is False.
Returns¶
reconstructed_signals : ndarray Returns a time history the same size as
signalfor each of the sinusoidal components solved for.reconstructed_amplitudes : ndarray Returns the amplitude over time for each of the sinusoidal components solved for. Only returned if return_amp_phs is True.
reconstructed_phases : ndarray Returns the phase over time for each of the sinusoidal components solved for. Only returned if return_amp_phs is True.
reconstructed_envelope : ndarray Returns the complex envelope
xover time for each of the sinusoidal components solved for. Only returned if return_envelope is True.reconstructed_phasor : ndarray Returns the phasor
cover time for each of the sinusoidal components solved for. Only returned if return_envelope is True.r : ndarray Returns the selectivity
rover time for each of the sinusoidal components solved for. Only returned if return_r is True.
Raises¶
ValueError
If arguments are not the correct size or values.