oscillation_exp_decay¶
- oscillation_exp_decay(x, y, filter_window=5, filter_dim=2, freq_guess=None)[source]¶
Get exponential decay parameter from oscillating signal.
This assumes following function form.
\[y(x) = e^{\alpha x} F(x),\]where \(F(x)\) is arbitrary oscillation function oscillating at
freq_guess
. This function first applies a Savitzky-Golay filter to y value, then run scipy peak search to extract peak positions. Iffreq_guess
is provided, the search function will be robust to fake peaks due to noise. This function callsexp_decay()
function for extracted x and y values at peaks.Note
y values should contain more than one cycle of oscillation to use this guess approach.
- 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.
freq_guess (float | None) – Optional. Initial frequency guess of \(F(x)\).
- Returns:
Decay rate of signal.
- Return type:
float