From e0b67bd92319e6da1e804af794c33c7fbfd4cfc1 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 4 May 2013 18:27:21 -0400 Subject: [PATCH] vibration_analyze.py: Don't use the peak power for D_guess Use the power at the Nyquist frequency. This is what I'd meant to use back in 82cd9c1 (Massive rewrite (v 0.6) to base everything on Cython and revamped pypiezo, 2011-04-21), but I goofed. Luckily, the fitting algorithm was generally able to recover from my poor heuristic, but using a borked heuristic is not ideal. The fixed heuristic should reduce the number of poorly fit cases, and improve convergence efficiency for all cases. --- calibcant/vibration_analyze.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calibcant/vibration_analyze.py b/calibcant/vibration_analyze.py index 487d027..f5b83de 100644 --- a/calibcant/vibration_analyze.py +++ b/calibcant/vibration_analyze.py @@ -390,7 +390,7 @@ def fit_psd(freq_axis, psd_data, min_frequency=500, max_frequency=25000, A_guess = Q_guess*B_guess C_guess = max_psd * (-res_freq**4 + A_guess**4) if offset: - D_guess = psd_data[max_psd_index] + D_guess = psd_data[-1] C_guess -= D_guess else: D_guess = 0 -- 2.26.2