# HG changeset patch # User Brecht De Man # Date 1474311756 -7200 # Node ID 096bdb64d116cd9080e048e561d2247c47ecc14b # Parent 172c76d9414b845867238e9ae762f2d877ad98f1 Python scripts: allow 'python [path to python folder]/generate_report.py ...'; fix bug in timeline visualisation. diff -r 172c76d9414b -r 096bdb64d116 python/generate_report.py --- a/python/generate_report.py Thu Sep 08 16:20:18 2016 +0100 +++ b/python/generate_report.py Mon Sep 19 21:02:36 2016 +0200 @@ -116,9 +116,10 @@ # generate images for later use if render_figures: - subprocess.call("python timeline_view_movement.py '"+folder_name+"'", shell=True) - subprocess.call("python score_parser.py '"+folder_name+"'", shell=True) - subprocess.call("python score_plot.py '"+folder_name+"ratings/'", shell=True) + script_path = os.path.dirname(os.path.realpath(__file__)) # where is generate_report.py? + subprocess.call("python " +script_path+"/timeline_view_movement.py '"+folder_name+"'", shell=True) + subprocess.call("python " +script_path+"/score_parser.py '"+folder_name+"'", shell=True) + subprocess.call("python " +script_path+"/score_plot.py '"+folder_name+"ratings/'", shell=True) # make array of text and array of dates body_array = [] diff -r 172c76d9414b -r 096bdb64d116 python/timeline_view_movement.py --- a/python/timeline_view_movement.py Thu Sep 08 16:20:18 2016 +0100 +++ b/python/timeline_view_movement.py Mon Sep 19 21:02:36 2016 +0200 @@ -124,9 +124,10 @@ stop_times_global = [] 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) + if event.find('testtime') is not None: + # 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) # display fragment name at start plt.text(0,initial_position+0.02,audio_id,color=colormap[increment%len(colormap)]) #,rotation=45