From: W. Trevor King Date: Sat, 4 May 2013 22:27:21 +0000 (-0400) Subject: vibration_analyze.py: Don't use the peak power for D_guess X-Git-Tag: 0.9~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e0b67bd92319e6da1e804af794c33c7fbfd4cfc1;p=calibcant.git 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. --- 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