Mercurial > hg > constant-q-cpp
diff yeti/test_frequency.yeti @ 81:788799487b1e
More on tests and inverse stuff
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Tue, 29 Apr 2014 16:52:16 +0100 |
parents | 872fc9dc0321 |
children |
line wrap: on
line diff
--- a/yeti/test_frequency.yeti Tue Apr 29 08:36:47 2014 +0100 +++ b/yeti/test_frequency.yeti Tue Apr 29 16:52:16 2014 +0100 @@ -38,6 +38,8 @@ syn = load may.stream.syntheticstream; plot = load may.plot; +{ compare } = load may.test; + { cqt } = load cqt; // Test with a single windowed sinusoid, repeating at various frequencies @@ -71,23 +73,30 @@ report message matrix = (eprintln message; eprintln "matrix is:"; - mat.eprint matrix; - chart = plot.plot [Grid matrix]; - sleep 100; - chart#dispose()); + mat.eprint matrix); +// chart = plot.plot [Grid matrix]; +// sleep 100; +// chart#dispose()); tests = mapIntoHash do f: "freq_\(f)" done do f: \( str = streamBuilder f; cq = cqt { maxFreq = cqmax, minFreq = cqmin, binsPerOctave = bpo } str; - out = cq.cqComplex; - m = mat.concatHorizontal (map cm.magnitudes out); + spec = cq.cqSpectrogram; + rightSize = all id + (map do s: + compare (mat.size s) { + rows = cq.kernel.binsPerOctave * cq.octaves, + columns = cq.kernel.atomsPerFrame * mm.pow 2 (cq.octaves - 1) + } + done spec); + m = mat.concatHorizontal spec; // println "binFrequencies = \(cq.kernel.binFrequencies)"; // println "binForFreq \(f) = \(binForFreq f)"; var colno = 0; success = all id - (map do c: + (rightSize :: map do c: // The test passes for this column if: // // * the max bin is the expected one, or