# HG changeset patch # User Chris Cannam # Date 1368818684 -3600 # Node ID 67ff37b03856d2640d92030b51bc117ff12105e1 # Parent a8c84f59f7c0f666574afd77ed1806e1029bf356 Plot the (first few) values and difference from the audiofile read test when they aren't within tolerance diff -r a8c84f59f7c0 -r 67ff37b03856 yetilab/plot/plot.yeti --- 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); diff -r a8c84f59f7c0 -r 67ff37b03856 yetilab/stream/test/test_audiofile.yeti --- 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