X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=06-tour-shapes%2Ftour-shape-plots.py;h=af9e3564113f635008007f6f67177f8a8847f0af;hb=787b6246ddfd5d1eaa228cdd11c537096362eb2f;hp=a32f4cd00db4594f2965bdbec488998f0dc6b821;hpb=60fe51325266d0c3eb208b4f12294eda9d6d1297;p=ou-summer-of-code-2017.git diff --git a/06-tour-shapes/tour-shape-plots.py b/06-tour-shapes/tour-shape-plots.py index a32f4cd..af9e356 100644 --- a/06-tour-shapes/tour-shape-plots.py +++ b/06-tour-shapes/tour-shape-plots.py @@ -497,10 +497,20 @@ def heart_tour_func(): return heart_tour # meta.add_text('Description', tour) # im.save(filename, 'PNG', pnginfo=meta) -with open('tours-open.txt') as f: +# with open('tours-open.txt') as f: +# for i, tour_s in enumerate(f.readlines()): +# tour = tour_s.strip() +# filename = 'tour-{:03}-s{:04}-m{:03}-open.png'.format(i, len(tour), len(mistake_positions(trace_tour(tour)))) +# plot_trace(trace_tour(tour), filename=filename) +# im = Image.open(filename) +# meta = PngImagePlugin.PngInfo() +# meta.add_text('Description', tour) +# im.save(filename, 'PNG', pnginfo=meta) + +with open('tours-random-walk.txt') as f: for i, tour_s in enumerate(f.readlines()): tour = tour_s.strip() - filename = 'tour-{:03}-s{:04}-m{:03}-open.png'.format(i, len(tour), len(mistake_positions(trace_tour(tour)))) + filename = 'tour-{:03}-s{:04}-m{:03}-walk.png'.format(i, len(tour), len(mistake_positions(trace_tour(tour)))) plot_trace(trace_tour(tour), filename=filename) im = Image.open(filename) meta = PngImagePlugin.PngInfo()