changeset 3049:aa86f045d338

Merge branch 'vnext' into Dev_main # Conflicts: # python/score_parser.py
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Tue, 17 Oct 2017 17:03:10 -0400
parents f83b364d3d4b (current diff) ab52da8becbe (diff)
children 9dc50ba0c13f
files python/generate_report.py python/score_parser.py test_create.html
diffstat 4 files changed, 20 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Wed Sep 27 13:20:34 2017 +0100
+++ b/README.md	Tue Oct 17 17:03:10 2017 -0400
@@ -32,7 +32,7 @@
 
 When using the Web Audio Evaluation Tool, please acknowledge the authors and cite 
 
-> Nicholas Jillings, Brecht De Man, David Moffat and Joshua D. Reiss, "[Web Audio Evaluation Tool: A Browser-Based Listening Test Environment](http://www.brechtdeman.com/publications/smc10.pdf)," [12th Sound and Music Computing Conference](http://www.maynoothuniversity.ie/smc15/), July 2015.
+> Nicholas Jillings, Brecht De Man, David Moffat and Joshua D. Reiss, "[Web Audio Evaluation Tool: A Browser-Based Listening Test Environment](http://smcnetwork.org/system/files/SMC2015_submission_88.pdf)," [12th Sound and Music Computing Conference](http://www.maynoothuniversity.ie/smc15/), July 2015.
 
 BibTeX: 
 
--- a/python/generate_report.py	Wed Sep 27 13:20:34 2017 +0100
+++ b/python/generate_report.py	Tue Oct 17 17:03:10 2017 -0400
@@ -152,9 +152,14 @@
         second = time_node.get("secs")
         date_array.append((int(year),int(month),int(day),\
             int(hour),int(minute),int(second)))
+
+        # prepend zero if needed
+        minute_string = str(minute) if int(minute)>9 else "0"+str(minute)
+        second_string = str(second) if int(second)>9 else "0"+str(second)
         
         # date as section title
-        body = '\n\section{'+day+' '+month_array[int(month)-1]+' '+year+' '+hour+':'+minute+':'+second+'}\n'
+        body = '\n\section{'+day+' '+month_array[int(month)-1]+' '+year+' '+hour+':'+\
+                    minute_string+':'+second_string+'}\n'
 
         # file name
         body += '\t\tFile: '+file[:-4]+'\\\\ \n'
@@ -448,7 +453,7 @@
 plt.savefig(folder_name+"subjects_per_page.pdf", bbox_inches='tight')
 plt.close()
 
-# SHOW both figures
+# SHOW these figures
 body += r'''
         \begin{figure}[htbp]
         \begin{center}
@@ -487,14 +492,15 @@
 #TODO layout of figures
 
 # SHOW boxplot per page (in alphabetical order of page name)
+#TODO get scale names (now hardcoded 'preference' automatically)
 body += '\t\t\\clearpage \n\t\\subsection*{Ratings per page}\n'
 for page_name in sorted(page_names): # get each name
     # plot boxplot if exists (not so for the 'alt' names)
-    if os.path.isfile(folder_name+'ratings/'+page_name+'-ratings-box.pdf'):
+    if os.path.isfile(folder_name+'ratings/'+page_name+'-preference-ratings-box.pdf'):
         body += r'''\begin{figure}[H]
         \begin{center}
         \includegraphics[width=.65\textwidth]{'''+\
-         folder_name+"ratings/"+page_name+'-ratings-box.pdf'+\
+         folder_name+"ratings/"+page_name+'-preference-ratings-box.pdf'+\
         r'''}
         \caption{Box plot of ratings for page '''+\
         page_name+' ('+str(subject_count[real_page_names.index(page_name)])+\
--- a/python/score_parser.py	Wed Sep 27 13:20:34 2017 +0100
+++ b/python/score_parser.py	Tue Oct 17 17:03:10 2017 -0400
@@ -58,16 +58,17 @@
             
             # Check if page in the store
             if storage.get(page_name) == None:
-                storage[page_name] = {'header':[], 'axis':{"default": {}}} # add to the store
+                storage[page_name] = {'header':[], 'axis':{}} # add to the store
             
             # Get the axis names
             pageConfig = root.find('./waet/page/[@id="'+page_name+'"]')
             for interface in pageConfig.findall('./interface'):    # Get the <interface> noeds
                 interfaceName = interface.get("name"); # Get the axis name
-                if interfaceName == None or interfaceName == "null":
+                if interfaceName == None:
                     interfaceName = "default"   # If name not set, make name 'default'
-                if interfaceName not in storage[page_name]['axis'].keys():
+                if storage[page_name]['axis'].get(interfaceName) == None:
                     storage[page_name]['axis'][interfaceName] = {}  # If not in store for page, add empty dict
+                storage[page_name]['axis'][interfaceName][subject_id] = [] # Add the store for the session
                     
             # header: fragment IDs in 'alphabetical' order
             # go to fragment column, or create new column if it doesn't exist yet
@@ -75,7 +76,7 @@
             # get alphabetical array of fragment IDs from this subject's XML
             fragmentnamelist = []    # make empty list
             for audioelement in page.findall("./audioelement"): # iterate over all audioelements
-                if audioelement.get("type") != "outside-reference":
+                if audioelement is not None and audioelement.get('type') != "outside-reference":
                     fragmentnamelist.append(audioelement.get('ref')) # add to list
             
             fragmentnamelist = sorted(fragmentnamelist);    # Sort the list
@@ -87,17 +88,11 @@
                     axisName = value.get('interface-name')
                     if axisName == None or axisName == "null":
                         axisName = 'default'
-                    print(storage[page_name]['axis'])
                     axisStore = storage[page_name]['axis'][axisName]
-                    try:
-                        subjectStore = axisStore[subject_id]
-                    except KeyError:
-                        axisStore[subject_id] = []
-                        subjectStore = axisStore[subject_id]
                     if hasattr(value, 'text'):
-                        subjectStore.append(value.text)
+                        axisStore[subject_id].append(value.text)
                     else:
-                        subjectStore.append('')
+                        axisStore[subject_id].append('')
 
 # Now create the individual files
 for page_name in storage:
@@ -121,4 +116,4 @@
             for value in storage[page_name]['axis'][axis_name][subject_id]:
                 entry.append(value)
             filewriter.writerow(entry)
-        writefile.close()
\ No newline at end of file
+        writefile.close()
--- a/test_create.html	Wed Sep 27 13:20:34 2017 +0100
+++ b/test_create.html	Tue Oct 17 17:03:10 2017 -0400
@@ -38,7 +38,7 @@
             </div>
             <div class="alert alert-success" role="alert" ng-switch-when="true">
                 <button type="button" class="close" data-dismiss="alert" aria-label="Close" ng-click="hideValidationMessages"><span aria-hidden="true">&times;</span></button>
-                <strong>Validates!</strong><span>Well done, you can export this specification!</span>
+                <strong>Validates! </strong><span>Well done, you can export this specification!</span>
             </div>
         </div>
         <div id="setupNode" class="node" ng-controller="setup">