Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct emit_time for the global_time_precision #238

Merged
merged 4 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading