Skip to content

Fix incorrect parameter documentation in VoronoiGrid - #3765

Merged
quaquel merged 1 commit into
mesa:mainfrom
eeshsaxena:fix/voronoi-docstring
Jun 30, 2026
Merged

quaquel merged 1 commit into
mesa:mainfrom
eeshsaxena:fix/voronoi-docstring

Conversation

@eeshsaxena

Copy link
Copy Markdown
Contributor

Summary

The VoronoiGrid.__init__ docstring (mesa/discrete_space/voronoi.py) documented a capacity_function parameter, but capacity_function is a local variable inside __init__, not an argument. The actual capacity parameter is typed int | Callable | None and already covers that behaviour.

This drops the nonexistent capacity_function entry and documents that capacity may be an int or a callable computing a cell's capacity from its polygon area.

Documentation-only change.

The VoronoiGrid.__init__ docstring documented a 'capacity_function'
parameter, but that is a local variable, not an argument. The actual
'capacity' parameter accepts an int or a Callable; document that instead
and drop the nonexistent 'capacity_function' entry.
@github-actions

Copy link
Copy Markdown

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 +2.5% [+1.9%, +3.1%] 🔵 +1.3% [+1.1%, +1.4%]
BoltzmannWealth large 🔵 +2.7% [+2.0%, +3.4%] 🔴 +10.0% [+7.3%, +13.2%]
Schelling small 🔵 +1.6% [+1.0%, +2.1%] 🔵 +1.2% [+0.4%, +2.0%]
Schelling large 🔵 -0.5% [-1.8%, +0.9%] 🔵 -2.0% [-5.2%, +1.2%]
WolfSheep small 🔵 -1.5% [-2.0%, -0.9%] 🔵 +2.4% [-1.5%, +6.6%]
WolfSheep large 🔵 -1.0% [-2.4%, +0.4%] 🔵 -1.3% [-3.9%, +1.0%]
SugarscapeG1mt small 🔵 -2.6% [-3.4%, -1.7%] 🔵 +0.8% [-1.0%, +2.6%]
SugarscapeG1mt large 🔵 +0.2% [-0.9%, +1.4%] 🔵 -0.5% [-2.9%, +1.8%]
BoidFlockers small 🔵 +0.4% [-0.1%, +0.9%] 🔵 +0.9% [+0.5%, +1.4%]
BoidFlockers large 🔵 -0.5% [-1.1%, +0.1%] 🔵 -0.5% [-0.7%, -0.2%]

@dietcoke-17 dietcoke-17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, LGTM

@quaquel
quaquel merged commit 193a232 into mesa:main Jun 30, 2026
12 checks passed
EwoutH pushed a commit that referenced this pull request Oct 28, 2026
The VoronoiGrid.__init__ docstring documented a 'capacity_function'
parameter, but that is a local variable, not an argument. The actual
'capacity' parameter accepts an int or a Callable; document that instead
and drop the nonexistent 'capacity_function' entry.

(cherry picked from commit 193a232)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants