changeset 16:0f7c8b9410ef sonic-annotator-0.2

* update tests
author Chris Cannam
date Fri, 20 Mar 2009 17:31:40 +0000
parents b742272097ca
children 63567be5d83b
files tests/expected/transforms-summaries-percussiononsets-from-rdf.n3 tests/test-summaries.sh
diffstat 2 files changed, 34 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/tests/expected/transforms-summaries-percussiononsets-from-rdf.n3	Fri Mar 20 12:11:00 2009 +0000
+++ b/tests/expected/transforms-summaries-percussiononsets-from-rdf.n3	Fri Mar 20 17:31:40 2009 +0000
@@ -10,9 +10,11 @@
 @prefix vamp: <http://purl.org/ontology/vamp/> .
 
 :transform_0_onsets
+    vamp:block_size "1024"^^xsd:int ;
     vamp:output <http://vamp-plugins.org/rdf/plugins/vamp-example-plugins#percussiononsets_output_onsets> ;
     vamp:plugin <http://vamp-plugins.org/rdf/plugins/vamp-example-plugins#percussiononsets> ;
     vamp:sample_rate "44100"^^xsd:float ;
+    vamp:step_size "512"^^xsd:int ;
     a vamp:Transform .
 
     a mo:AudioFile .
@@ -52,11 +54,11 @@
     a af:Onset .
 
 :transform_5_detectionfunction
-    vamp:block_size "4096"^^xsd:int ;
+    vamp:block_size "1024"^^xsd:int ;
     vamp:output <http://vamp-plugins.org/rdf/plugins/vamp-example-plugins#percussiononsets_output_detectionfunction> ;
     vamp:plugin <http://vamp-plugins.org/rdf/plugins/vamp-example-plugins#percussiononsets> ;
     vamp:sample_rate "44100"^^xsd:float ;
-    vamp:step_size "2048"^^xsd:int ;
+    vamp:step_size "512"^^xsd:int ;
     vamp:summary_type "mean" ;
     a vamp:Transform .
 
@@ -73,7 +75,7 @@
         tl:onTimeLine :signal_timeline_1 ;
         a tl:Interval
     ] ;
-    af:feature "668.509" ;
+    af:feature "162.123" ;
     vamp:computed_by :transform_5_detectionfunction ;
     a :event_type_6 ;
     rdfs:label "(mean value, continuous-time average)" .
@@ -84,7 +86,7 @@
     vamp:plugin <http://vamp-plugins.org/rdf/plugins/vamp-example-plugins#percussiononsets> ;
     vamp:sample_rate "44100"^^xsd:float ;
     vamp:step_size "512"^^xsd:int ;
-    vamp:summary_type "mean" ;
+    vamp:summary_type "median" ;
     a vamp:Transform .
 
 :event_type_9
@@ -100,16 +102,18 @@
         tl:onTimeLine :signal_timeline_1 ;
         a tl:Interval
     ] ;
-    af:feature "162.123" ;
+    af:feature "168" ;
     vamp:computed_by :transform_8_detectionfunction ;
     a :event_type_9 ;
-    rdfs:label "(mean value, continuous-time average)" .
+    rdfs:label "(median value, continuous-time average)" .
 
 :transform_11_detectionfunction
+    vamp:block_size "1024"^^xsd:int ;
     vamp:output <http://vamp-plugins.org/rdf/plugins/vamp-example-plugins#percussiononsets_output_detectionfunction> ;
     vamp:plugin <http://vamp-plugins.org/rdf/plugins/vamp-example-plugins#percussiononsets> ;
     vamp:sample_rate "44100"^^xsd:float ;
-    vamp:summary_type "median" ;
+    vamp:step_size "512"^^xsd:int ;
+    vamp:summary_type "mode" ;
     a vamp:Transform .
 
 :event_type_12
@@ -125,16 +129,18 @@
         tl:onTimeLine :signal_timeline_1 ;
         a tl:Interval
     ] ;
-    af:feature "168" ;
+    af:feature "0" ;
     vamp:computed_by :transform_11_detectionfunction ;
     a :event_type_12 ;
-    rdfs:label "(median value, continuous-time average)" .
+    rdfs:label "(modal value, continuous-time average)" .
 
 :transform_14_detectionfunction
+    vamp:block_size "4096"^^xsd:int ;
     vamp:output <http://vamp-plugins.org/rdf/plugins/vamp-example-plugins#percussiononsets_output_detectionfunction> ;
     vamp:plugin <http://vamp-plugins.org/rdf/plugins/vamp-example-plugins#percussiononsets> ;
     vamp:sample_rate "44100"^^xsd:float ;
-    vamp:summary_type "mode" ;
+    vamp:step_size "2048"^^xsd:int ;
+    vamp:summary_type "mean" ;
     a vamp:Transform .
 
 :event_type_15
@@ -150,8 +156,8 @@
         tl:onTimeLine :signal_timeline_1 ;
         a tl:Interval
     ] ;
-    af:feature "0" ;
+    af:feature "668.509" ;
     vamp:computed_by :transform_14_detectionfunction ;
     a :event_type_15 ;
-    rdfs:label "(modal value, continuous-time average)" .
+    rdfs:label "(mean value, continuous-time average)" .
 
--- a/tests/test-summaries.sh	Fri Mar 20 12:11:00 2009 +0000
+++ b/tests/test-summaries.sh	Fri Mar 20 17:31:40 2009 +0000
@@ -6,8 +6,10 @@
 infile=$mypath/audio/3clicks8.wav
 tmpfile=$mypath/tmp_1_$$
 tmpcanonical=$mypath/tmp_2_$$
+tmpcmp1=$mypath/tmp_3_$$
+tmpcmp2=$mypath/tmp_4_$$
 
-trap "rm -f $tmpfile $tmpcanonical" 0
+trap "rm -f $tmpfile $tmpcanonical $tmpcmp1 $tmpcmp2" 0
 
 fail() {
     echo "Test failed: $1"
@@ -28,6 +30,14 @@
     exit 1
 }
 
+compare() {
+    a=$1
+    b=$2
+    sort $a > $tmpcmp1
+    sort $b > $tmpcmp2
+    cmp -s $tmpcmp1 $tmpcmp2
+}
+
 # transform to which we have to add summarisation on command line
 transform=$mypath/transforms/transforms-nosummaries-percussiononsets-detectionfunction.n3 
 expected=$mypath/expected/transforms-summaries-percussiononsets
@@ -38,25 +48,25 @@
 $r -t $transform -w csv --csv-stdout $infile > $tmpfile 2>/dev/null || \
     fail "Fails to run transform $transform"
 
-cmp -s $tmpfile ${expected}.csv || \
+compare $tmpfile ${expected}.csv || \
     fail "Output mismatch for transform $transform" $tmpfile ${expected}.csv
 
 $r -t $transform -w csv --csv-stdout -S mean $infile > $tmpfile 2>/dev/null || \
     fail "Fails to run transform $transform with summary type mean"
 
-cmp -s $tmpfile ${expected}-with-mean.csv || \
+compare $tmpfile ${expected}-with-mean.csv || \
     fail "Output mismatch for transform $transform with summary type mean" $tmpfile ${expected}-with-mean.csv
 
 $r -t $transform -w csv --csv-stdout -S min -S max -S mean -S median -S mode -S sum -S variance -S sd -S count --summary-only $infile > $tmpfile 2>/dev/null || \
     fail "Fails to run transform $transform with all summary types and summary-only"
 
-cmp -s $tmpfile ${expected}-all-summaries-only.csv || \
+compare $tmpfile ${expected}-all-summaries-only.csv || \
     fail "Output mismatch for transform $transform with all summary types and summary-only" $tmpfile ${expected}-all-summaries-only.csv
 
 $r -t $stransform -w csv --csv-stdout $infile > $tmpfile 2>/dev/null || \
     fail "Fails to run transform $stransform with CSV output"
 
-cmp -s $tmpfile ${sexpected}.csv || \
+compare $tmpfile ${sexpected}.csv || \
     fail "Output mismatch for transform $stransform" $tmpfile ${sexpected}.csv
 
 $r -t $stransform -w rdf --rdf-stdout $infile > $tmpfile 2>/dev/null || \
@@ -65,7 +75,7 @@
 rapper -i turtle $tmpfile -o turtle 2>/dev/null | grep -v '^@prefix :' | grep -v 'file:/' > $tmpcanonical ||
     fail "Fails to produce parseable RDF/TTL for transform $stransform"
 
-cmp -s $tmpcanonical ${sexpected}.n3 || \
+compare $tmpcanonical ${sexpected}.n3 || \
     fail "Output mismatch for canonicalised version of transform $stransform" $tmpcanonical ${sexpected}.n3
 
 exit 0