changeset 159:237ccacbb85e labfile

Add omit-filename option to CSV writer (and test it while testing lab writer)
author Chris Cannam
date Wed, 15 Oct 2014 10:38:17 +0100
parents a2310369b2cc
children 2a399bed0184
files .hgsubstate runner/LabFeatureWriter.cpp tests/test-lab-writer/test-lab-writer.sh
diffstat 3 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Wed Oct 15 10:18:13 2014 +0100
+++ b/.hgsubstate	Wed Oct 15 10:38:17 2014 +0100
@@ -1,3 +1,3 @@
 d16f0fd6db6104d87882bc43788a3bb1b0f8c528 dataquay
 879bdc878826bebec67130326f99397c430419b1 sv-dependency-builds
-51bf067de517cc9ce385c013315e0b92d2dac114 svcore
+c2316a3bbb814eb70f817bd0ed30543f00a68352 svcore
--- a/runner/LabFeatureWriter.cpp	Wed Oct 15 10:18:13 2014 +0100
+++ b/runner/LabFeatureWriter.cpp	Wed Oct 15 10:38:17 2014 +0100
@@ -42,7 +42,7 @@
 string
 LabFeatureWriter::getDescription() const
 {
-    return "Write features in .lab, a tab-separated columnar format. The first column is always the feature start time in seconds. If the features have duration, the second column will be the feature end time in seconds. Remaining columns are the feature values (if any) and finally the feature label (if any). There is no identification of the audio file or the transform, so confusion will result if features from different audio or transforms are mixed. For more control over the output, consider using the CSV writer.";
+    return "Write features in .lab, a tab-separated columnar format. The first column is always the feature start time in seconds. If the features have duration, the second column will be the feature end time in seconds. Remaining columns are the feature values (if any) and finally the feature label (if any). There is no identification of the audio file or the transform, so confusion will result if features from different audio or transforms are mixed. (For more control over the output, consider using the more general CSV writer.)";
 }
 
 LabFeatureWriter::ParameterList
--- a/tests/test-lab-writer/test-lab-writer.sh	Wed Oct 15 10:18:13 2014 +0100
+++ b/tests/test-lab-writer/test-lab-writer.sh	Wed Oct 15 10:38:17 2014 +0100
@@ -26,5 +26,28 @@
 	faildiff "Output differs from expected for output $output and $flag flag" "$tmplab" "$mypath/expected/$output-$flag.lab"
 done
 
+# Do it all over again, but using the CSV writer. The Lab writer is
+# actually redundant, it's equivalent to -w csv --csv-separator '\t'
+# --csv-end-times --csv-omit-filename
+
+for output in notes-regions curve-vsr; do
+
+    flag=""
+
+    $r -d "$testplug:$output" -w csv --csv-separator '\t' --csv-end-times --csv-omit-filename --csv-stdout "$infile" 2>/dev/null > "$tmplab" || \
+	fail "Failed to run for plugin $testplug and CSV writer with output $output and no additional flags"
+
+    csvcompare "$tmplab" "$mypath/expected/$output-no-flags.lab" || \
+	faildiff "Output differs from expected for CSV writer with output $output and no additional flags" "$tmplab" "$mypath/expected/$output-no-flags.lab"
+
+    flag=fill-ends
+
+    $r -d "$testplug:$output" -w csv --csv-separator '\t' --csv-end-times --csv-omit-filename --csv-$flag --csv-stdout "$infile" 2>/dev/null > "$tmplab" || \
+	fail "Failed to run for plugin $testplug and CSV writer with output $output and $flag flag"
+
+    csvcompare "$tmplab" "$mypath/expected/$output-$flag.lab" || \
+	faildiff "Output differs from expected for CSV writer with output $output and $flag flag" "$tmplab" "$mypath/expected/$output-$flag.lab"
+done
+
 exit 0