Skip to content

Commit

Permalink
Merge pull request #29 from ihmeuw/feature/sim.run
Browse files Browse the repository at this point in the history
ENH: add .run method to to interactive context
  • Loading branch information
collijk committed Jun 14, 2018
2 parents c49ba35 + 3e2caab commit d047248
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vivarium/interface/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ def reset(self):
self.population._population = self._initial_population
self.clock._time = self._start_time

def run(self, with_logging=True):
return self.run_until(self.clock.stop_time, with_logging=with_logging)

def run_for(self, duration, with_logging=True):
return self.run_until(self.clock.time + duration, with_logging=with_logging)

Expand All @@ -37,7 +40,7 @@ def run_until(self, end_time, with_logging=True):
assert self.clock.time - self.clock.step_size < end_time <= self.clock.time
return iterations

def step(self, step_size=None):
def step(self, step_size=None): # TODO: consider renaming to take_step for similarity with sim.take_steps
old_step_size = self.clock.step_size
if step_size is not None:
if not isinstance(step_size, type(self.clock.step_size)):
Expand Down

0 comments on commit d047248

Please sign in to comment.