comparison scripts/timeline_view.py @ 287:4fb6448759a9

Scripts: timeline_view_movement with 'playing' areas highlighted
author Brecht De Man <b.deman@qmul.ac.uk>
date Wed, 12 Aug 2015 10:31:10 +0200
parents 4a8b99d1b032
children a00d0c8d5c74
comparison
equal deleted inserted replaced
286:4a8b99d1b032 287:4fb6448759a9
103 103
104 # for this audioelement, loop over all listen events 104 # for this audioelement, loop over all listen events
105 listen_events = audioelement.findall("./metric/metricresult/[@name='elementListenTracker']/event") 105 listen_events = audioelement.findall("./metric/metricresult/[@name='elementListenTracker']/event")
106 for event in listen_events: 106 for event in listen_events:
107 # get testtime: start and stop 107 # get testtime: start and stop
108 start_time = float(event.find('testtime').get('start')) 108 start_time = float(event.find('testtime').get('start'))-time_offset
109 stop_time = float(event.find('testtime').get('stop')) 109 stop_time = float(event.find('testtime').get('stop'))-time_offset
110 # event lines: 110 # event lines:
111 ax.plot([start_time-time_offset, start_time-time_offset], # x-values 111 ax.plot([start_time, start_time], # x-values
112 [0, N_audioelements+1], # y-values 112 [0, N_audioelements+1], # y-values
113 color='k' 113 color='k'
114 ) 114 )
115 ax.plot([stop_time-time_offset, stop_time-time_offset], # x-values 115 ax.plot([stop_time, stop_time], # x-values
116 [0, N_audioelements+1], # y-values 116 [0, N_audioelements+1], # y-values
117 color='k' 117 color='k'
118 ) 118 )
119 # plot time: 119 # plot time:
120 ax.add_patch( 120 ax.add_patch(
121 patches.Rectangle( 121 patches.Rectangle(
122 (start_time-time_offset, N_audioelements-increment-bar_height/2), # (x, y) 122 (start_time, N_audioelements-increment-bar_height/2), # (x, y)
123 stop_time - start_time, # width 123 stop_time - start_time, # width
124 bar_height, # height 124 bar_height, # height
125 color=colormap[increment%len(colormap)] # colour 125 color=colormap[increment%len(colormap)] # colour
126 ) 126 )
127 ) 127 )