Mercurial > hg > webaudioevaluationtool
diff scripts/timeline_view.py @ 283:a1c1f032ff0a
Scripts: show which and how many markers not clicked or moved; option to plot timelines against 'audioholder time' (default) or 'total test time' (previously the only possibility)
author | Brecht De Man <b.deman@qmul.ac.uk> |
---|---|
date | Mon, 10 Aug 2015 18:45:45 +0200 |
parents | 4345ba8a1b6e |
children | f32e58635091 |
line wrap: on
line diff
--- a/scripts/timeline_view.py Fri Jul 24 18:59:39 2015 +0100 +++ b/scripts/timeline_view.py Mon Aug 10 18:45:45 2015 +0200 @@ -31,6 +31,9 @@ # Colormap for to cycle through colormap = ['b', 'r', 'g', 'c', 'm', 'y', 'k'] +# x-axis shows time per audioholder, not total test time +show_audioholder_time = True + # CODE @@ -45,6 +48,8 @@ root = tree.getroot() subject_id = file[:-4] # drop '.xml' + time_offset = 0 # test starts at zero + # ONE TIMELINE PER PAGE - make new plot per page # get list of all page names @@ -78,25 +83,30 @@ listen_events = audioelement.findall("./metric/metricresult/[@name='elementListenTracker']/event") for event in listen_events: # get testtime: start and stop - start_time = event.find('testtime').get('start') - stop_time = event.find('testtime').get('stop') + start_time = float(event.find('testtime').get('start')) + stop_time = float(event.find('testtime').get('stop')) # event lines: - plt.plot([start_time, start_time], # x-values + plt.plot([start_time-time_offset, start_time-time_offset], # x-values [0, N_audioelements+1], # y-values color='k' ) - plt.plot([stop_time, stop_time], # x-values + plt.plot([stop_time-time_offset, stop_time-time_offset], # x-values [0, N_audioelements+1], # y-values color='k' ) # plot time: - plt.plot([start_time, stop_time], # x-values + plt.plot([start_time-time_offset, stop_time-time_offset], # x-values [N_audioelements-increment, N_audioelements-increment], # y-values color=colormap[increment%len(colormap)], linewidth=6 ) increment+=1 + + # subtract total audioholder length from subsequent audioholder event times + audioholder_time = audioholder.find("./metric/metricresult/[@id='testTime']") + if audioholder_time is not None and show_audioholder_time: + time_offset = float(audioholder_time.text) #TODO: if 'nonsensical' or unknown: dashed line until next event #TODO: Vertical lines for fragment looping point