diff --git a/.pylintrc b/.pylintrc index b75e321b..aefc7ce9 100644 --- a/.pylintrc +++ b/.pylintrc @@ -77,5 +77,5 @@ attr-rgx=^[a-z_][a-z0-9]*((_[a-z0-9]+)*)?$ variable-rgx=^[a-z][a-z0-9]*((_[a-z0-9]+)*)?$ argument-rgx=^[a-z][a-z0-9]*((_[a-z0-9]+)*)?$ include-naming-hint=yes -max-statements=65 +max-statements=70 max-nested-blocks=6 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c5c7ed2..18899887 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## v1.6.3 * (#237) Add tests for MongoDB emitter and fix related bugs +* (#238) apply `global_time_precision` to the `emit_time` ## v1.6.2 * (#236) Add data key to breakdown documents if missing diff --git a/vivarium/core/engine.py b/vivarium/core/engine.py index 61a71701..20450082 100644 --- a/vivarium/core/engine.py +++ b/vivarium/core/engine.py @@ -922,6 +922,8 @@ def run_for( """ end_time = self.global_time + interval emit_time = self.global_time + self.emit_step + if self.global_time_precision is not None: + emit_time = round(emit_time, self.global_time_precision) while self.global_time < end_time or force_complete: full_step = math.inf @@ -1024,6 +1026,9 @@ def run_for( while emit_time <= self.global_time: self._emit_store_data() emit_time += self.emit_step + if self.global_time_precision is not None: + emit_time = round(emit_time, + self.global_time_precision) else: # all processes have run past the interval