diff options
author | John Glover <j@johnglover.net> | 2013-02-16 15:22:20 +0000 |
---|---|---|
committer | John Glover <j@johnglover.net> | 2013-02-16 15:22:20 +0000 |
commit | 2b9cec80434f0bef506633deff97d289b483c97d (patch) | |
tree | 8e3b4c77951601456f51c97ecdc96034957f3e46 | |
parent | 10bc63c13cf9a6195d6b19f832258ff8e1d84f78 (diff) | |
download | simpl-2b9cec80434f0bef506633deff97d289b483c97d.tar.gz simpl-2b9cec80434f0bef506633deff97d289b483c97d.tar.bz2 simpl-2b9cec80434f0bef506633deff97d289b483c97d.zip |
[mq] Fix bug in TWM and use more harmonics in predictions.
-rw-r--r-- | simpl/mq.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/simpl/mq.py b/simpl/mq.py index 8e86718..d8a701d 100644 --- a/simpl/mq.py +++ b/simpl/mq.py @@ -18,7 +18,7 @@ def twm(peaks, f_min=0.0, f_max=3000.0, f_step=20.0): q = 1.4 r = 0.5 rho = 0.33 - N = 8 + N = 20 Err = {} max_amp = max([x.amplitude for x in peaks]) @@ -43,7 +43,7 @@ def twm(peaks, f_min=0.0, f_max=3000.0, f_step=20.0): # calculate mismatch between predicted and actual peaks for h in harmonics: - k = best_match(f_current, [x.frequency for x in peaks]) + k = best_match(h, [x.frequency for x in peaks]) f = peaks[k].frequency a = peaks[k].amplitude Err_pm += abs(h - f) * (h ** -p) + (a / max_amp) * \ |