Mercurial > hg > may
changeset 565:4d287bb157e4
Test that all convolution methods produce the same output for a longer stream
author | Chris Cannam |
---|---|
date | Mon, 12 May 2014 11:24:47 +0100 |
parents | 4d08613cc9a2 |
children | 8651089f9d1c |
files | src/may/stream/test/test_convolve.yeti |
diffstat | 1 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/may/stream/test/test_convolve.yeti Mon May 12 11:24:24 2014 +0100 +++ b/src/may/stream/test/test_convolve.yeti Mon May 12 11:24:47 2014 +0100 @@ -130,6 +130,30 @@ done convolutionOptions); ), +"parameterInvariance": \( + // convolution by any method should give identical results + rate = 8000; + irlen = 500; + siglen = 1500; + ir = (syn.whiteNoise rate).read irlen; + params = [ + [ Fast true, Framesize 256 ], + [ Fast true, Framesize 512 ], + [ Fast false, Framesize 256 ], + [ Fast false, Framesize 512 ] + ]; + signals = manip.duplicated (length params) + (manip.withDuration siglen (syn.whiteNoise rate)); + convolved = map2 do s p: + mat.getRow 0 + ((convolve.convolvedWith p ir s).read (siglen + irlen - 1)); + done signals params; + diffs = map do c: + vec.max (vec.subtract c (head convolved)) + done convolved; + all id (map (compareUsing do a b: abs (a - b) < 1e-12 done (head diffs)) diffs); +), + ]); knowns = makeTests "known" false;