Skip to content
Myr

Improve plot_progression.py script

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Peter · committed by David Peter · parent a75dca9 · Browse files · 1 file+29 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+29 added−13 removed

  • other:+29 added−13 removed

1 file+29 added−13 removed

modified:scripts/plot_progression.py+29 added-13 removed
28 unmodified lines
29 type=int,30 metavar="num_runs",31 help="Width of the moving-average window (default: N/5)",32)33parser.add_argument(34 "--no-moving-average",35 action="store_true",36 help="Do not show moving average curve",37)383940args = parser.parse_args()4142with open(args.file) as f:43 results = json.load(f)["results"]4445for result in results:39label = results[0]["command"]40times = results[0]["times"]41num = len(times)42nums = range(num)46 label = result["command"]47 times = result["times"]48 num = len(times)49 nums = range(num)5044plt.scatter(x=nums, y=times, marker=".", color="orange")45plt.ylim([0, None])46plt.xlim([-1, num])51 plt.scatter(x=nums, y=times, marker=".")52 plt.ylim([0, None])53 plt.xlim([-1, num])5455 if not args.no_moving_average:48moving_average_width = (49 num // 5 if args.moving_average_width is None else args.moving_average_width50)56 moving_average_width = (57 num // 5 if args.moving_average_width is None else args.moving_average_width58 )5952moving_average = moving_average(times, moving_average_width)53plt.plot(nums, moving_average, "-", color="blue")60 average = moving_average(times, moving_average_width)61 plt.plot(nums, average, "-")6263if args.title:64 plt.title(args.title)57plt.legend(labels=[label], loc="best", fontsize="medium")6566legend = []67for result in results:68 legend.append(result["command"])69 if not args.no_moving_average:70 legend.append("moving average")71plt.legend(legend)7273plt.ylabel("Time [s]")7475if args.output:76 plt.savefig(args.output)77else:78 plt.show()