Skip to content

Commit

Permalink
Add super().__init__() to Mesa model initalization (#175)
Browse files Browse the repository at this point in the history
When inheriting from a Mesa Model you always need to initialize it by calling super().__init__(). This commit fixes that in two gis models.
  • Loading branch information
EwoutH authored Aug 25, 2024
1 parent 49342ea commit 4fe5c71
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions gis/geo_schelling/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class GeoSchelling(mesa.Model):
"""Model class for the Schelling segregation model."""

def __init__(self, density=0.6, minority_pc=0.2, export_data=False):
super().__init__()
self.density = density
self.minority_pc = minority_pc
self.export_data = export_data
Expand Down
1 change: 1 addition & 0 deletions gis/geo_sir/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(
:param infection_risk: Probability of agent to become infected,
if it has been exposed to another infected
"""
super().__init__()
self.schedule = mesa.time.BaseScheduler(self)
self.space = mg.GeoSpace(warn_crs_conversion=False)
self.steps = 0
Expand Down

0 comments on commit 4fe5c71

Please sign in to comment.