Mercurial > hg > constant-q-cpp
changeset 67:d6dd6e1cc00e
Plot failing test matrices
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 28 Feb 2014 17:18:54 +0000 |
parents | 3d165bf186f1 |
children | b75c0eaaa6dd |
files | yeti/test_frequency.yeti |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/yeti/test_frequency.yeti Fri Feb 14 14:24:37 2014 +0000 +++ b/yeti/test_frequency.yeti Fri Feb 28 17:18:54 2014 +0000 @@ -7,6 +7,7 @@ mm = load may.mathmisc; cm = load may.matrix.complex; syn = load may.stream.syntheticstream; +plot = load may.plot; { cqt } = load cqt; @@ -31,6 +32,8 @@ testFreqs = map (* 5) [ 0..10 ]; duration = sampleRate * 2; +threshold = 0.05; + streamBuilder = sinTestStream sampleRate duration; binForFreq f = @@ -44,6 +47,7 @@ m = mat.concatHorizontal (map cm.magnitudes cq.output); // println "binFrequencies = \(cq.kernel.binFrequencies)"; // println "binForFreq \(f) = \(binForFreq f)"; + var colno = 0; success = all id (map do c: // passes test if the correct max bin, or the expected max @@ -51,15 +55,19 @@ expected = binForFreq f; good = (expected < 0 or expected >= vec.length c) or - (vec.max c < 0.001) or + (vec.max c < threshold) or (vec.maxindex c == binForFreq f); if (not good) then - println " * bad! maxindex \(vec.maxindex c) != expected \(binForFreq f) for freq \(f) in column: \(vec.list c)"; + println " * bad! maxindex \(vec.maxindex c) != expected \(binForFreq f) for freq \(f) in column \(colno) of \(mat.width m): column is \(vec.list c)"; println "matrix is:"; mat.print m; + chart = plot.plot [Grid m]; + sleep 100; + chart#dispose(); else print "✓"; fi; + colno := colno + 1; good; done (mat.asColumns m)); success;