annotate yeti/test.yeti @ 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 27007f8302f4
rev   line source
c@37 1
c@37 2 program test;
c@37 3
c@65 4 { runTests } = load may.test;
c@65 5
c@60 6 // We want to test:
c@60 7 //
c@60 8 // Kernel design -- check size (number of bins, number of atoms);
c@60 9 // check an example kernel against known data
c@60 10 //
c@60 11 // Time alignment -- feed a dirac train, check that peaks in all bins
c@60 12 // align
c@60 13 //
c@60 14 // Frequency discrimination -- feed a sinusoid, check peaks
c@60 15 //
c@60 16 // Latency compensation -- for dirac at 0, check peak can be found at
c@60 17 // 0 plus the declared latency
c@60 18 //
c@60 19 // Signal-noise ratio
c@60 20 //
c@60 21 // Specimen output for simple test case
c@60 22
c@65 23 tests = [
c@65 24 "kernel" : load test_cqtkernel,
c@65 25 "frequency" : load test_frequency,
c@65 26 ];
c@59 27
c@65 28 bad = sum (mapHash do name testHash: runTests name testHash done tests);
c@59 29
c@65 30 if (bad > 0) then
c@65 31 println "\n** \(bad) test(s) failed!";
c@65 32 threadExit 1
c@65 33 else
c@65 34 ()
c@65 35 fi
c@59 36
c@59 37
c@59 38
c@59 39
c@59 40 /*
c@37 41 //testStream = manipulate.withDuration 96000 (syn.sinusoid 48000 500);
c@37 42 //testStream = manipulate.withDuration 96000 (syn.pulseTrain 48000 4);
c@44 43 testStream = af.open "sweep-48000.wav";
c@37 44 //testStream = af.open "sweep.wav";
c@37 45
c@43 46 // So the stream is [ 0, 1, 0, -1, 0, 1, 0, -1, ... ] :
c@44 47 //testStream = manipulate.withDuration 64 (syn.sinusoid 8 2);
c@38 48
c@56 49 testStream = manipulate.withDuration 32 (syn.pulseTrain 8 0.001);
c@37 50
c@37 51 eprintln "have test stream";
c@37 52
c@44 53 cq = cqt { maxFreq = testStream.sampleRate/2, minFreq = 50, binsPerOctave = 24 } testStream;
c@37 54
c@40 55 eprintln "bin frequencies: \(cq.kernel.binFrequencies)";
c@40 56
c@40 57 bigM = mat.concatHorizontal (map cm.magnitudes cq.output);
c@37 58
c@38 59 eprintln "overall output size = \(mat.size bigM)";
c@38 60
c@39 61 mat.print bigM;
c@38 62
c@38 63 //\() (plot.plot [Contour bigM]);
c@56 64 \() (plot.plot [Grid bigM]);
c@59 65 */
c@65 66 //()
c@37 67