Mercurial > hg > may
changeset 232:67ff37b03856
Plot the (first few) values and difference from the audiofile read test when they aren't within tolerance
author | Chris Cannam |
---|---|
date | Fri, 17 May 2013 20:24:44 +0100 |
parents | a8c84f59f7c0 |
children | 545a32830886 |
files | yetilab/plot/plot.yeti yetilab/stream/test/test_audiofile.yeti |
diffstat | 2 files changed, 20 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/yetilab/plot/plot.yeti Sun May 12 21:12:54 2013 +0100 +++ b/yetilab/plot/plot.yeti Fri May 17 20:24:44 2013 +0100 @@ -49,11 +49,11 @@ chart#getScene()#getGraph()#add(surface); ()); -plotCurve chart curve is ~Chart -> 'a -> () = +plotCurve chart depth curve is ~Chart -> number -> 'a -> () = (scene = chart#getScene(); xx = map (.time) curve; yy = map (.value) curve; - line = new FlatLine2d(xx as ~float[], yy as ~float[], 1); + line = new FlatLine2d(xx as ~float[], yy as ~float[], depth); line#setWireframeDisplayed(true); line#setWireframeColor(Color#BLACK); line#setWireframeWidth(2); @@ -70,11 +70,11 @@ */ ()); -plotSeries chart { start, step, values } is ~Chart -> 'a -> () = +plotSeries chart depth { start, step, values } is ~Chart -> number -> 'a -> () = (scene = chart#getScene(); xx = map do i: start + step * i done [0..length values - 1]; yy = list values; - line = new FlatLine2d(xx as ~float[], yy as ~float[], 0); + line = new FlatLine2d(xx as ~float[], yy as ~float[], depth); line#setWireframeDisplayed(true); line#setWireframeColor(Color#BLACK); line#setWireframeWidth(2); @@ -93,17 +93,20 @@ plot structures = (chart = new Chart(Quality#Nicest); - for structures - \case of + var depth = 0; + for structures do s: + case s of Grid matrix: plotMatrix chart matrix; Curve curve: - plotCurve chart curve; + plotCurve chart depth curve; Series series: - plotSeries chart series; + plotSeries chart depth series; other: failWith "Unable to plot \(other)"; esac; + depth := depth + 1; + done; ChartLauncher#openChart(chart); chart);
--- a/yetilab/stream/test/test_audiofile.yeti Sun May 12 21:12:54 2013 +0100 +++ b/yetilab/stream/test/test_audiofile.yeti Fri May 17 20:24:44 2013 +0100 @@ -5,6 +5,7 @@ vec = load yetilab.vector.vector; mat = load yetilab.matrix.matrix; bf = load yetilab.vector.blockfuncs; +pl = load yetilab.plot.plot; ref = load yetilab.stream.test.audiofile_reference; @@ -55,6 +56,14 @@ println " channel \(ch): ok"; else println " channel \(ch): not ok"; +// This isn't really simple enough! + seriesFor m = + Series { + start = 0, + step = 1, + values = take 1000 (vec.list (mat.getRow ch m)) + }; + \() (pl.plot (map seriesFor [ test, ref, mat.scaled 10000 (mat.difference test ref) ])); fi; done; false