Skip to content

Commit

Permalink
Fix output directories.
Browse files Browse the repository at this point in the history
  • Loading branch information
fergalwalsh committed May 13, 2016
1 parent 817c4a7 commit cdd3fe7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
if __name__ == '__main__':
filename = sys.argv[1]
coords = json.load(open(filename))
plotter = Plotter(width=910, height=800, margin=(50, 100), step_size=1, max_segment=1)
sim = Simulator(plotter_width=plotter.width, plotter_height=plotter.height, margin=plotter.margin, output_directory='/Users/fergal/Desktop/hipoplot/')
plotter = Plotter(width=910, height=800, margin=(50, 100), step_size=10, max_segment=10)
sim = Simulator(plotter_width=plotter.width, plotter_height=plotter.height, margin=plotter.margin, output_directory='output')
cx, cy = (plotter.width / 2), (plotter.height / 2)
plotter.set_initial_position(cx, cy)
log('set initial lengths: %s, %s' % (plotter.m1.string_length, plotter.m2.string_length))
Expand Down
7 changes: 6 additions & 1 deletion simulator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import os

from PIL import Image
from PIL import ImageDraw, ImageFont
Expand All @@ -13,6 +14,10 @@ def __init__(self, plotter_width, plotter_height, margin, skip_frames=100, outpu
self.i = 0
self.skip_frames = skip_frames
self.output_directory = output_directory
try:
os.makedirs(output_directory)
except os.error:
pass
self.height = 400
self.scale_factor = self.height / float(plotter_height)
self.width = int(plotter_width * self.scale_factor)
Expand Down Expand Up @@ -83,7 +88,7 @@ def render_test(self, coords):


if __name__ == '__main__':
sim = Simulator(plotter_width=910, plotter_height=800, margin=(50, 100), skip_frames=10, output_directory='/Users/fergal/Desktop/hipoplot/')
sim = Simulator(plotter_width=910, plotter_height=800, margin=(50, 100), skip_frames=10, output_directory='output')
sim.left_string_length, sim.right_string_length = 605, 605
sim.step_size = 5
sim.run(sys.stdin.readlines())

0 comments on commit cdd3fe7

Please sign in to comment.