frequency¶
- frequency(x, y, filter_window=5, filter_dim=2)[source]¶
Get frequency of oscillating signal.
First this tries FFT. If the true value is likely below or near the frequency resolution, the function tries low frequency fit with
given
. In this mode, y data points are smoothed by a Savitzky-Golay filter to protect against outlier points.Note
This function returns always positive frequency. This function is sensitive to the DC offset. This function assumes sorted, no-overlapping x values.
- Parameters:
x (ndarray) – Array of x values.
y (ndarray) – Array of y values.
filter_window (int) – Window size of Savitzky-Golay filter. This should be odd number.
filter_dim (int) – Dimension of Savitzky-Golay filter.
- Returns:
Frequency estimation of oscillation signal.
- Return type:
float