Skip to content

Commit a9575ec

Browse files
committed
Update batchrunner, datacollector and solara to use model.steps
instead of model._steps
1 parent ba341ca commit a9575ec

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

mesa/batchrunner.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ def _model_run_func(
132132
"""
133133
run_id, iteration, kwargs = run
134134
model = model_cls(**kwargs)
135-
while model.running and model._steps <= max_steps:
135+
while model.running and model.steps <= max_steps:
136136
model.step()
137137

138138
data = []
139139

140-
steps = list(range(0, model._steps, data_collection_period))
141-
if not steps or steps[-1] != model._steps - 1:
142-
steps.append(model._steps - 1)
140+
steps = list(range(0, model.steps, data_collection_period))
141+
if not steps or steps[-1] != model.steps - 1:
142+
steps.append(model.steps - 1)
143143

144144
for step in steps:
145145
model_data, all_agents_data = _collect_data(model, step)

mesa/datacollection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def _record_agents(self, model):
180180
rep_funcs = self.agent_reporters.values()
181181

182182
def get_reports(agent):
183-
_prefix = (agent.model._steps, agent.unique_id)
183+
_prefix = (agent.model.steps, agent.unique_id)
184184
reports = tuple(rep(agent) for rep in rep_funcs)
185185
return _prefix + reports
186186

@@ -216,7 +216,7 @@ def collect(self, model):
216216

217217
if self.agent_reporters:
218218
agent_records = self._record_agents(model)
219-
self._agent_records[model._steps] = list(agent_records)
219+
self._agent_records[model.steps] = list(agent_records)
220220

221221
def add_table_row(self, table_name, row, ignore_missing=False):
222222
"""Add a row dictionary to a specific table.

mesa/visualization/solara_viz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def do_step():
244244
"""Advance the model by one step."""
245245
model.step()
246246
previous_step.value = current_step.value
247-
current_step.value = model._steps
247+
current_step.value = model.steps
248248

249249
def do_play():
250250
"""Run the model continuously."""

0 commit comments

Comments
 (0)