diff options
author | Martin Peres <martin.peres@linux.intel.com> | 2015-07-27 14:41:39 +0300 |
---|---|---|
committer | Martin Peres <martin.peres@linux.intel.com> | 2015-07-27 14:55:20 +0300 |
commit | 4e1e559d85970f81839f02ffbefa44fd3fbd0f4e (patch) | |
tree | eff9867c3a4f1d209abbd1e4b3f9d03171baac91 /stats | |
parent | 7b00adca4212b4bc5586814eee80f3b98c3f59c6 (diff) |
stats/gen_report: fail more gently when the image generation failed
Diffstat (limited to 'stats')
-rwxr-xr-x | stats/gen_report.py | 71 |
1 files changed, 37 insertions, 34 deletions
diff --git a/stats/gen_report.py b/stats/gen_report.py index 310a6e5..faf0857 100755 --- a/stats/gen_report.py +++ b/stats/gen_report.py @@ -228,40 +228,43 @@ print("Generating the runs' output image",end="",flush=True) for c in range (0, len(commits)): commit = commits[c] for r in range (0, len(commit.results)): - result = commit.results[r] - f = plt.figure(figsize=(19.5, 4)) - gs = gridspec.GridSpec(2, 2, width_ratios=[4, 1]) - x = array(result.data) - ax1 = plt.subplot(gs[0]) - plt.title("Time series across all the runs") - plt.xlabel('Run #') - plt.ylabel('FPS') - ax1.plot(x, label="cur.") - if c > 0: - ax1.plot(commits[c - 1].results[r].data, label="prev.") - plt.legend() - - ax2 = plt.subplot(gs[1]) - plt.title("FPS distribution") - plt.xlabel('FPS') - x_grid = linspace(amin(x) * 0.95, amax(x) * 1.05, 1000) - for bandwidth in [0.2]: - ax2.plot(x_grid, kde_scipy(x, x_grid, bandwidth=bandwidth), - label='bw={0}'.format(bandwidth), linewidth=1, alpha=1) - ax2.hist(x, 100, fc='gray', histtype='stepfilled', alpha=0.3, normed=True, label='histogram') - - ax3 = plt.subplot(gs[2]) - plt.title("Time series of the runs") - plt.xlabel('FPS sample') - plt.ylabel('FPS') - - for i in range(0, len(result.runs)): - ax3.plot(result.runs[i], label="{0}".format(i)) - plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3, - ncol=25, mode="expand", borderaxespad=0.) - - plt.tight_layout() - plt.savefig(result.img_src_name, bbox_inches='tight') + try: + result = commit.results[r] + f = plt.figure(figsize=(19.5, 4)) + gs = gridspec.GridSpec(2, 2, width_ratios=[4, 1]) + x = array(result.data) + ax1 = plt.subplot(gs[0]) + plt.title("Time series across all the runs") + plt.xlabel('Run #') + plt.ylabel('FPS') + ax1.plot(x, label="cur.") + if c > 0: + ax1.plot(commits[c - 1].results[r].data, label="prev.") + plt.legend() + + ax2 = plt.subplot(gs[1]) + plt.title("FPS distribution") + plt.xlabel('FPS') + x_grid = linspace(amin(x) * 0.95, amax(x) * 1.05, 1000) + for bandwidth in [0.2]: + ax2.plot(x_grid, kde_scipy(x, x_grid, bandwidth=bandwidth), + label='bw={0}'.format(bandwidth), linewidth=1, alpha=1) + ax2.hist(x, 100, fc='gray', histtype='stepfilled', alpha=0.3, normed=True, label='histogram') + + ax3 = plt.subplot(gs[2]) + plt.title("Time series of the runs") + plt.xlabel('FPS sample') + plt.ylabel('FPS') + + for i in range(0, len(result.runs)): + ax3.plot(result.runs[i], label="{0}".format(i)) + plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3, + ncol=25, mode="expand", borderaxespad=0.) + + plt.tight_layout() + plt.savefig(result.img_src_name, bbox_inches='tight') + except Exception as e: + print("Failed to generate {filename}: {error}".format(filename=result.img_src_name, error=str(e))) plt.close() print('.',end="",flush=True) print(" DONE") |