changeset 2487:b0ef31a58ec5

timeline_view_movement: show playback; generate_report: added demo survey stats
author Brecht De Man <b.deman@qmul.ac.uk>
date Mon, 08 Aug 2016 12:24:40 +0200
parents a6820a146469
children f377350e7259 4c83eaacf002
files python/generate_report.py python/timeline_view_movement.py
diffstat 2 files changed, 15 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/python/generate_report.py	Mon Aug 08 11:37:57 2016 +0200
+++ b/python/generate_report.py	Mon Aug 08 12:24:40 2016 +0200
@@ -83,7 +83,7 @@
           \usepackage[parfill]{parskip} % empty line instead of indent
           \usepackage{graphicx}         % figures
           \usepackage[space]{grffile}   % include figures with spaces in paths
-          \usepackage{hyperref}
+          \usepackage[pdfpagelabels]{hyperref}
           \usepackage{tikz}             % pie charts
           \usepackage{float}            % place figures 'here'
           \title{Report}
@@ -98,7 +98,7 @@
           \maketitle
           This is an automatically generated report using the `generate\_report.py' Python script 
           included with the Web Audio Evaluation Tool \cite{WAET} distribution which can be found 
-          at \texttt{code.soundsoftware.ac.uk/projects/webaudioevaluationtool}.
+          at \texttt{\href{https://github.com/BrechtDeMan/WebAudioEvaluationTool}{github.com/BrechtDeMan/WebAudioEvaluationTool}}.
           \tableofcontents
           
           '''
@@ -152,7 +152,7 @@
         body = '\n\section{'+day+' '+month_array[int(month)]+' '+year+' '+hour+':'+minute+':'+second+'}\n'
 
         # file name
-        body += '\t\t'+file[:-4]+'\\\\ \n'
+        body += '\t\tFile: '+file[:-4]+'\\\\ \n'
 
         # reset for new subject
         total_duration = 0
@@ -163,16 +163,21 @@
         
         # DEMO survey stats
         # get gender
-        this_subjects_gender = root.find("./posttest/radio/[@id='gender']")
+        post_survey = root.find("./survey/[@location='post']")
+        this_subjects_gender = post_survey.find("./surveyresult/[@ref='gender']/response")
         if this_subjects_gender is not None:
             gender.append(this_subjects_gender.get("name"))
         else:
             gender.append('UNAVAILABLE')
         # get age
-        this_subjects_age = root.find("./posttest/number/[@id='age']")
+        this_subjects_age = post_survey.find("./surveyresult/[@ref='age']/response")
         if this_subjects_age is not None:
             age.append(this_subjects_age.text)
-        #TODO add plot of age
+        if this_subjects_gender is not None:
+            body += 'Details: '+this_subjects_gender.get("name")
+            if this_subjects_age is not None:
+                body += ', ' + this_subjects_age.text
+            body += '\\\\ \n'
                 
         # get list of all page names
         for page in root.findall("./page"):   # iterate over pages
--- a/python/timeline_view_movement.py	Mon Aug 08 11:37:57 2016 +0200
+++ b/python/timeline_view_movement.py	Mon Aug 08 12:24:40 2016 +0200
@@ -62,7 +62,7 @@
         subject_id = file[:-4] # drop '.xml'
         
         previous_page_time = 0 # time spent before current page
-        time_offset = 0 # test starts at zero
+        #time_offset = 0 # test starts at zero
         
         # ONE TIMELINE PER PAGE - make new plot per page
 
@@ -125,8 +125,8 @@
                     listen_events = audioelement.findall("./metric/metricresult/[@name='elementListenTracker']/event")
                     for event in listen_events:
                         # get testtime: start and stop
-                        start_times_global.append(float(event.find('testtime').get('start'))-time_offset)
-                        stop_times_global.append(float(event.find('testtime').get('stop'))-time_offset)
+                        start_times_global.append(float(event.find('testtime').get('start')))#-time_offset)
+                        stop_times_global.append(float(event.find('testtime').get('stop')))#-time_offset)
                     
                     # display fragment name at start
                     plt.text(0,initial_position+0.02,audio_id,color=colormap[increment%len(colormap)]) #,rotation=45
@@ -279,7 +279,7 @@
                 increment+=1 # to next audioelement
             
             last_page_duration = page_time #-time_offset
-            time_offset = page_time
+            #time_offset = page_time
             
             if not plot_empty: # if plot is not empty, show and/or store
                 # set plot parameters
@@ -298,4 +298,3 @@
             
                 plt.savefig(timeline_folder+subject_id+"-"+page_name+".pdf", bbox_inches='tight')
                 plt.close()
-