changeset 3112:b67d33da3867

Merge branch 'vnext' into Dev_main
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Sat, 14 Jul 2018 15:30:48 +0100
parents db3b7c9ca398 (current diff) 9ac4f490a1d8 (diff)
children e9d16f8ea673
files tests/examples/timeline.xml
diffstat 9 files changed, 128 insertions(+), 134 deletions(-) [+]
line wrap: on
line diff
--- a/index.html	Mon May 21 18:20:31 2018 +0100
+++ b/index.html	Sat Jul 14 15:30:48 2018 +0100
@@ -27,11 +27,14 @@
         <h1><a target="_blank" href="https://github.com/BrechtDeMan/WebAudioEvaluationTool">Web Audio Evaluation Toolbox (v1.2.3)</a></h1>
         <h2>Start menu </h2>
         <ul>
+            <li><a href="test.html?url=tests/examples/AB_example.xml" target="_blank">AB interface test example</a></li>
+            <li><a href="test.html?url=tests/examples/ABX_example.xml" target="_blank">ABX interface test example</a></li>
             <li><a href="test.html?url=tests/examples/APE_example.xml" target="_blank">APE interface test example</a></li>
+            <li><a href="test.html?url=tests/examples/horizontal_example.xml" target="_blank">Horizontal interface test example</a></li>
             <li><a href="test.html?url=tests/examples/mushra_example.xml" target="_blank">MUSHRA interface test example</a></li>
-            <li><a href="test.html?url=tests/examples/AB_example.xml" target="_blank">AB interface test example</a></li>
-            <li><a href="test.html?url=tests/examples/horizontal_example.xml" target="_blank">Horizontal interface test example</a></li>
+            <li><a href="test.html?url=tests/examples/ordinal_example.xml" target="_blank">Ordinal interface test example</a></li>
             <li><a href="test.html?url=tests/examples/radio_example.xml" target="_blank">Radio interface test example</a></li>
+            <li><a href="test.html?url=tests/examples/timeline_example.xml" target="_blank">Timeline (waveform annotation) test example</a></li>
             <li><a href="test_create.html" target="_blank">Test creator</a></li>
             <li><a href="analyse.html" target="_blank">Analysis and diagnostics of results</a></li>
         </ul>
--- a/interfaces/mushra.css	Mon May 21 18:20:31 2018 +0100
+++ b/interfaces/mushra.css	Sat Jul 14 15:30:48 2018 +0100
@@ -1,6 +1,6 @@
 /*
  * Hold any style information for MUSHRA interface. Customise if you like to make the interface your own!
- * 
+ *
  */
 
 body {
@@ -80,49 +80,49 @@
     padding: 0 5px;
     color: rgb(255, 144, 144);
 }
-input[type=range]::-webkit-slider-runnable-track {
+input[type=range][orient=vertical]::-webkit-slider-runnable-track {
     width: 8px;
     cursor: pointer;
     background: #fff;
     border-radius: 4px;
     border: 1px solid #000;
 }
-input[type=range]::-moz-range-track {
+input[type=range][orient=vertical]::-moz-range-track {
     width: 8px;
     cursor: pointer;
     background: #fff;
     border-radius: 4px;
     border: 1px solid #000;
 }
-input[type=range]::-ms-track {
+input[type=range][orient=vertical]::-ms-track {
     cursor: pointer;
     background: #fff;
     border-radius: 4px;
     border: 1px solid #000;
 }
-input.track-slider-not-moved[type=range]::-webkit-slider-runnable-track {
+input.track-slider-not-moved[type=range][orient=vertical]::-webkit-slider-runnable-track {
     background: #aaa;
 }
-input.track-slider-not-moved[type=range]::-moz-range-track {
+input.track-slider-not-moved[type=range][orient=vertical]::-moz-range-track {
     background: #aaa;
 }
-input[type=range]::-moz-range-thumb {
+input[type=range][orient=vertical]::-moz-range-thumb {
     margin-left: -7px;
     cursor: pointer;
     margin-top: -1px;
     box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
 }
-input[type=range]::-webkit-slider-thumb {
+input[type=range][orient=vertical]::-webkit-slider-thumb {
     cursor: pointer;
     margin-top: -1px;
     margin-left: -4px;
 }
-input[type=range]::-ms-thumb {
+input[type=range][orient=vertical]::-ms-thumb {
     cursor: pointer;
     margin-top: -1px;
     margin-left: -4px;
 }
-input[type=range]::-ms-tooltip {
+input[type=range][orient=vertical]::-ms-tooltip {
     visibility: hidden;
 }
 input.track-slider-range-disabled {}
--- a/python/score_parser.py	Mon May 21 18:20:31 2018 +0100
+++ b/python/score_parser.py	Sat Jul 14 15:30:48 2018 +0100
@@ -4,6 +4,7 @@
 import os
 import sys
 import csv
+import re
 
 # COMMAND LINE ARGUMENTS
 
@@ -60,9 +61,12 @@
             if storage.get(page_name) == None:
                 storage[page_name] = {'header':[], 'axis':{}} # add to the store
             
+            # strip repetitions
+            page_name_root = re.sub('-repeat-.$', '', page_name)
+
             # Get the axis names
-            pageConfig = root.find('./waet/page/[@id="'+page_name+'"]')
-            for interface in pageConfig.findall('./interface'):    # Get the <interface> noeds
+            pageConfig = root.find('./waet/page/[@id="'+page_name_root+'"]')
+            for interface in pageConfig.findall('./interface'):    # Get the <interface> nodes
                 interfaceName = interface.get("name"); # Get the axis name
                 if interfaceName == None:
                     interfaceName = "default"   # If name not set, make name 'default'
--- a/python/timeline_view_movement.py	Mon May 21 18:20:31 2018 +0100
+++ b/python/timeline_view_movement.py	Sat Jul 14 15:30:48 2018 +0100
@@ -5,7 +5,7 @@
 import sys # command line arguments
 import matplotlib.pyplot as plt # plots
 import matplotlib.patches as patches # rectangles
-
+import re # regular expressions
 
 # COMMAND LINE ARGUMENTS
 
@@ -74,10 +74,6 @@
             if page_name is None: # ignore 'empty' audio_holders
                 print("Skipping empty page name from "+subject_id+".")
                 break
-            
-            if page.get("state") != "complete":
-                print("Skipping non-completed page "+page_name+" from "+subject_id+".")
-                break
                 
             # subtract total page length from subsequent page event times
             page_time_temp = page.find("./metric/metricresult/[@id='testTime']")
@@ -112,25 +108,22 @@
                 if audioelement is not None: # Check it exists
                     audio_id = str(audioelement.get('ref'))
                     
-                    # break if outside-reference
-                    if audioelement.get("type") == "outside-reference":
-                        break;
-                    
-                    # break if no initial position....
+                    # break if no initial position or move events registered
                     initial_position_temp = audioelement.find("./metric/metricresult/[@name='elementInitialPosition']")
                     if initial_position_temp is None:
                         print("Skipping "+page_name+" from "+subject_id+": does not have initial positions specified.")
                         break
-                    # ... or move events registered
-                    movements = audioelement.find("./metric/metricresult[@name='elementTrackerFull']")
-                    if movements is None:
-                        print("Skipping "+page_name+" from "+subject_id+": does not have trackers.")
-                        break
-                    
-                    # get move events, initial and eventual position
-                    initial_position = float(initial_position_temp.text)
-                    move_events = audioelement.findall("./metric/metricresult/[@name='elementTrackerFull']/movement")
-                    final_position = float(audioelement.find("./value").text)
+
+                    # if reference, only display 'listen' events
+                    if audioelement.get('type')=="outside-reference":
+                        initial_position = 1.0
+                        move_events = []
+                        final_position = 1.0
+                    else:
+                        # get move events, initial and eventual position
+                        initial_position = float(initial_position_temp.text)
+                        move_events = audioelement.findall("./metric/metricresult/[@name='elementTrackerFull']/movement")
+                        final_position = float(audioelement.find("./value").text)
                     
                     # get listen events
                     start_times_global = []
@@ -305,27 +298,21 @@
 
                 # Y axis title and tick labels as specified in 'setup'
                 # for corresponding page
-                page_setup = root.find("./waet/page[@id='"+page_name+"']") 
+                page_name_root = re.sub('-repeat-.$', '', page_name)
+                page_setup = root.find("./waet/page[@id='"+page_name_root+"']") 
                     # 'ref' of page is 'id' in page setup
 
                 # Different plots for different axes
                 interfaces = page_setup.findall("./interface")
                 interface_title = interfaces[0].find("./title")
                 scales = interfaces[0].findall("./scales") # get first interface by default
-                
+                scalelabels = scales[0].findall("./scalelabel") # get first scale by default
+
                 labelpos = [] # array of scalelabel positions
                 labelstr = [] # array of strings at labels
-                
-                # No scales given. Use normal floats
-                if len(scales) is 0:
-                    labelpos = [0.0, 1.0]
-                    labelstr = ["0", "100"]
-                else:
-                    scalelabels = scales[0].findall("./scalelabel") # get first scale by default
-                
-                    for scalelabel in scalelabels:
-                        labelpos.append(float(scalelabel.get('position'))/100.0)
-                        labelstr.append(scalelabel.text)
+                for scalelabel in scalelabels:
+                    labelpos.append(float(scalelabel.get('position'))/100.0)
+                    labelstr.append(scalelabel.text)
 
                 # use interface name as Y axis label
                 if interface_title is not None:
--- a/tests/examples/ABX_example.xml	Mon May 21 18:20:31 2018 +0100
+++ b/tests/examples/ABX_example.xml	Sat Jul 14 15:30:48 2018 +0100
@@ -32,7 +32,7 @@
                 <option name="great">Great</option>
             </surveyradio>
             <surveystatement id="test-thank-you">
-                <statement>Thank you for taking this listening test. Please click 'submit' and your results will appear in the 'saves/' folder.</statement>
+                <statement>Thank you for taking this listening test. Please click 'Submit' and your results will appear in the 'saves/' folder.</statement>
             </surveystatement>
         </survey>
         <metric>
--- a/tests/examples/AB_example.xml	Mon May 21 18:20:31 2018 +0100
+++ b/tests/examples/AB_example.xml	Sat Jul 14 15:30:48 2018 +0100
@@ -32,7 +32,7 @@
                     <option name="great">Great</option>
                 </surveyradio>
                 <surveystatement id="test-thank-you">
-                    <statement>Thank you for taking this listening test. Please click 'submit' and your results will appear in the 'saves/' folder.</statement>
+                    <statement>Thank you for taking this listening test. Please click 'Submit' and your results will appear in the 'saves/' folder.</statement>
                 </surveystatement>
             </survey>
             <metric>
--- a/tests/examples/mushra_example.xml	Mon May 21 18:20:31 2018 +0100
+++ b/tests/examples/mushra_example.xml	Sat Jul 14 15:30:48 2018 +0100
@@ -33,7 +33,7 @@
                 <option name="great">Great</option>
             </surveyradio>
             <surveystatement id="thankyou">
-                <statement>Thank you for taking this listening test. Please click 'submit' and your results will appear in the 'saves/' folder.</statement>
+                <statement>Thank you for taking this listening test. Please click 'Submit' and your results will appear in the 'saves/' folder.</statement>
             </surveystatement>
         </survey>
         <metric>
--- a/tests/examples/timeline.xml	Mon May 21 18:20:31 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<waet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test-schema.xsd">
-    <setup interface="timeline" projectReturn="save.php">
-        <metric>
-            <metricenable>testTimer</metricenable>
-            <metricenable>elementTimer</metricenable>
-            <metricenable>elementInitialPosition</metricenable>
-            <metricenable>elementTracker</metricenable>
-            <metricenable>elementFlagListenedTo</metricenable>
-            <metricenable>elementFlagMoved</metricenable>
-            <metricenable>elementListenTracker</metricenable>
-        </metric>
-        <interface>
-            <interfaceoption type="check" name="fragmentPlayed" />
-            <interfaceoption type="check" name="scalerange" min="25" max="75" />
-            <interfaceoption type="show" name="volume" />
-            <interfaceoption type="show" name='playhead' />
-            <interfaceoption type="show" name="page-count" />
-            <interfaceoption type="show" name="comments" />
-        </interface>
-    </setup>
-    <page id='test-0' hostURL="media/example/" randomiseOrder='true' repeatCount='4' loop='true' loudness="-23">
-        <title>My Test</title>
-        <interface>
-            <scales>
-                <scalelabel position="0">(1) Very Annoying</scalelabel>
-                <scalelabel position="25">(2) Annoying</scalelabel>
-                <scalelabel position="50">(3) Slightly Annoying</scalelabel>
-                <scalelabel position="75">(4) Audible but not Annoying</scalelabel>
-                <scalelabel position="100">(5) Inaudible</scalelabel>
-            </scales>
-        </interface>
-        <audioelement url="0.wav" id="track-1" image="https://upload.wikimedia.org/wikipedia/commons/0/0a/Drumkit-icon.png" />
-        <audioelement url="1.wav" id="track-2" image="https://upload.wikimedia.org/wikipedia/commons/0/0a/Drumkit-icon.png" />
-        <commentquestions>
-            <commentradio id="preference">
-                <statement>Please enter your overall preference</statement>
-                <option name="worst">Very Bad</option>
-                <option name="bad"></option>
-                <option name="OK">OK</option>
-                <option name="Good"></option>
-                <option name="Great">Great</option>
-            </commentradio>
-            <commentcheckbox id="character">
-                <statement>Please describe the overall character</statement>
-                <option name="funky">Funky</option>
-                <option name="mellow">Mellow</option>
-                <option name="laidback">Laid back</option>
-                <option name="heavy">Heavy</option>
-            </commentcheckbox>
-        </commentquestions>
-    </page>
-    <page id='test-1' hostURL="media/example/" randomiseOrder='true' repeatCount='4' loop='true' loudness="-23">
-        <title>My Test</title>
-        <interface>
-            <scales>
-                <scalelabel position="0">(1) Very Annoying</scalelabel>
-                <scalelabel position="25">(2) Annoying</scalelabel>
-                <scalelabel position="50">(3) Slightly Annoying</scalelabel>
-                <scalelabel position="75">(4) Audible but not Annoying</scalelabel>
-                <scalelabel position="100">(5) Inaudible</scalelabel>
-            </scales>
-        </interface>
-        <audioelement url="0.wav" id="track-3" image="https://upload.wikimedia.org/wikipedia/commons/0/0a/Drumkit-icon.png" />
-        <audioelement url="1.wav" id="track-4" image="https://upload.wikimedia.org/wikipedia/commons/0/0a/Drumkit-icon.png" />
-        <commentquestions>
-            <commentradio id="preference1">
-                <statement>Please enter your overall preference</statement>
-                <option name="worst">Very Bad</option>
-                <option name="bad"></option>
-                <option name="OK">OK</option>
-                <option name="Good"></option>
-                <option name="Great">Great</option>
-            </commentradio>
-            <commentcheckbox id="character1">
-                <statement>Please describe the overall character</statement>
-                <option name="funky">Funky</option>
-                <option name="mellow">Mellow</option>
-                <option name="laidback">Laid back</option>
-                <option name="heavy">Heavy</option>
-            </commentcheckbox>
-        </commentquestions>
-    </page>
-</waet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/examples/timeline_example.xml	Sat Jul 14 15:30:48 2018 +0100
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<waet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test-schema.xsd">
+    <setup interface="timeline" projectReturn="save.php">
+        <metric>
+            <metricenable>testTimer</metricenable>
+            <metricenable>elementTimer</metricenable>
+            <metricenable>elementInitialPosition</metricenable>
+            <metricenable>elementTracker</metricenable>
+            <metricenable>elementFlagListenedTo</metricenable>
+            <metricenable>elementFlagMoved</metricenable>
+            <metricenable>elementListenTracker</metricenable>
+        </metric>
+        <interface>
+            <interfaceoption type="check" name="fragmentPlayed" />
+            <interfaceoption type="check" name="scalerange" min="25" max="75" />
+            <interfaceoption type="show" name="volume" />
+            <interfaceoption type="show" name='playhead' />
+            <interfaceoption type="show" name="page-count" />
+            <interfaceoption type="show" name="comments" />
+        </interface>
+    </setup>
+    <page id='test-0' hostURL="media/example/" randomiseOrder='true' repeatCount='4' loop='true' loudness="-23">
+        <title>My Test</title>
+        <interface>
+            <scales>
+                <scalelabel position="0">(1) Very Annoying</scalelabel>
+                <scalelabel position="25">(2) Annoying</scalelabel>
+                <scalelabel position="50">(3) Slightly Annoying</scalelabel>
+                <scalelabel position="75">(4) Audible but not Annoying</scalelabel>
+                <scalelabel position="100">(5) Inaudible</scalelabel>
+            </scales>
+        </interface>
+        <audioelement url="0.wav" id="track-1" image="https://upload.wikimedia.org/wikipedia/commons/0/0a/Drumkit-icon.png" />
+        <audioelement url="1.wav" id="track-2" image="https://upload.wikimedia.org/wikipedia/commons/0/0a/Drumkit-icon.png" />
+        <commentquestions>
+            <commentradio id="preference">
+                <statement>Please enter your overall preference</statement>
+                <option name="worst">Very Bad</option>
+                <option name="bad"></option>
+                <option name="OK">OK</option>
+                <option name="Good"></option>
+                <option name="Great">Great</option>
+            </commentradio>
+            <commentcheckbox id="character">
+                <statement>Please describe the overall character</statement>
+                <option name="funky">Funky</option>
+                <option name="mellow">Mellow</option>
+                <option name="laidback">Laid back</option>
+                <option name="heavy">Heavy</option>
+            </commentcheckbox>
+        </commentquestions>
+    </page>
+    <page id='test-1' hostURL="media/example/" randomiseOrder='true' repeatCount='4' loop='true' loudness="-23">
+        <title>My Test</title>
+        <interface>
+            <scales>
+                <scalelabel position="0">(1) Very Annoying</scalelabel>
+                <scalelabel position="25">(2) Annoying</scalelabel>
+                <scalelabel position="50">(3) Slightly Annoying</scalelabel>
+                <scalelabel position="75">(4) Audible but not Annoying</scalelabel>
+                <scalelabel position="100">(5) Inaudible</scalelabel>
+            </scales>
+        </interface>
+        <audioelement url="0.wav" id="track-3" image="https://upload.wikimedia.org/wikipedia/commons/0/0a/Drumkit-icon.png" />
+        <audioelement url="1.wav" id="track-4" image="https://upload.wikimedia.org/wikipedia/commons/0/0a/Drumkit-icon.png" />
+        <commentquestions>
+            <commentradio id="preference1">
+                <statement>Please enter your overall preference</statement>
+                <option name="worst">Very Bad</option>
+                <option name="bad"></option>
+                <option name="OK">OK</option>
+                <option name="Good"></option>
+                <option name="Great">Great</option>
+            </commentradio>
+            <commentcheckbox id="character1">
+                <statement>Please describe the overall character</statement>
+                <option name="funky">Funky</option>
+                <option name="mellow">Mellow</option>
+                <option name="laidback">Laid back</option>
+                <option name="heavy">Heavy</option>
+            </commentcheckbox>
+        </commentquestions>
+    </page>
+</waet>