Skip to content

Commit

Permalink
Merge pull request #238 from vivarium-collective/emit-time-precision
Browse files Browse the repository at this point in the history
correct emit_time for the global_time_precision
  • Loading branch information
eagmon authored Feb 21, 2024
2 parents f92aa65 + 893f22c commit 2157be8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions vivarium/core/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2157be8

Please sign in to comment.