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

Updated docs and check_model param #2510

Merged
merged 20 commits into from
Dec 9, 2024
Merged

Conversation

nissu99
Copy link
Contributor

@nissu99 nissu99 commented Nov 16, 2024

Summary

This PR adds documentation for the SolaraViz instantiation and adds a new test case to handle arguments and keyword arguments in solaraviz.

Bug / Issue

SolaraViz docs #2494

Implementation

changes in docs and explicit check in _check_model_params.

Testing

Screenshot from 2024-11-17 16-30-08

Additional Notes

Copy link

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 -0.9% [-2.9%, +1.2%] 🔵 -0.2% [-0.3%, +0.0%]
BoltzmannWealth large 🔵 -0.4% [-0.9%, +0.2%] 🔵 +0.1% [-0.5%, +0.8%]
Schelling small 🔵 -1.3% [-1.6%, -1.0%] 🔵 -0.4% [-0.7%, -0.1%]
Schelling large 🔵 -1.2% [-1.6%, -0.7%] 🔵 -0.6% [-1.1%, -0.0%]
WolfSheep small 🔵 -1.0% [-1.3%, -0.7%] 🔵 -0.4% [-0.5%, -0.2%]
WolfSheep large 🔵 -1.1% [-1.6%, -0.6%] 🔵 -0.2% [-1.1%, +0.9%]
BoidFlockers small 🔵 -0.2% [-0.7%, +0.4%] 🔵 -0.3% [-1.4%, +0.8%]
BoidFlockers large 🔵 -0.8% [-1.2%, -0.4%] 🔵 +0.5% [+0.0%, +1.0%]

@EwoutH
Copy link
Member

EwoutH commented Nov 16, 2024

Thanks for your PR!

Could you format your PR following our bug template? That makes it readable on its own, helps us review and serves as a historical reference if we ever need to revisit it.

@EwoutH EwoutH requested review from Corvince and quaquel November 16, 2024 23:50
@EwoutH EwoutH added the docs Release notes label label Nov 16, 2024
Copy link
Member

@quaquel quaquel left a comment

Choose a reason for hiding this comment

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

I have left a few suggestions and 1 big point. However, some of these suggestions might have knock-on consequences elsewhere in the code. Also, you should most likely have to change the signature of MoneyModel to keyword arguments only.

The big thing is that the check in solara_viz.py is not doing what you think it is doing. It would be good to explicitly add a test to test_solara_viz.py which checks that the appropriate exception is raised if you try to use SolaraViz with a model that has arguments and keyword arguments.

docs/getting_started.md Outdated Show resolved Hide resolved
docs/migration_guide.md Outdated Show resolved Hide resolved
"source": [
"# Create initial model instance\n",
"model1 = MoneyModel(50, 10, 10)\n",
"model1 = MoneyModel(n=50, width=10, height=10) #keyword arguments\n",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"model1 = MoneyModel(n=50, width=10, height=10) #keyword arguments\n",
"model = MoneyModel(n=50, width=10, height=10) #keyword arguments\n",

Copy link
Member

Choose a reason for hiding this comment

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

Needs to be model not model1

docs/tutorials/visualization_tutorial.ipynb Outdated Show resolved Hide resolved
docs/tutorials/visualization_tutorial.ipynb Outdated Show resolved Hide resolved
docs/tutorials/visualization_tutorial.ipynb Outdated Show resolved Hide resolved
mesa/visualization/solara_viz.py Outdated Show resolved Hide resolved
@nissu99 nissu99 requested a review from quaquel November 19, 2024 06:18
@nissu99
Copy link
Contributor Author

nissu99 commented Nov 22, 2024

@quaquel ,i have added the test case.

@quaquel
Copy link
Member

quaquel commented Nov 22, 2024

@quaquel ,i have added the test case.

I'll try to review this asap, but it might be somewhere next week before I get to it because I am traveling for work atm.

@tpike3
Copy link
Member

tpike3 commented Nov 23, 2024

@nissu99 Thanks for ding this and the fact you updated tests, migration guide, and tutorial is very cool!

I had one comment and will defer to @quaquel for final review.

@EwoutH
Copy link
Member

EwoutH commented Dec 6, 2024

@tpike3 @quaquel what's the state of this PR, and what's steps are needed to get it merged?

@quaquel
Copy link
Member

quaquel commented Dec 6, 2024

I think all that is left is the last point on the failing read the docs built. It should be an easy fix that I had hoped to do today (but life intervened)

@nissu99
Copy link
Contributor Author

nissu99 commented Dec 6, 2024

@quaquel @EwoutH will make the required changes today .

@nissu99 nissu99 requested a review from tpike3 December 8, 2024 09:00
Copy link
Member

@tpike3 tpike3 left a comment

Choose a reason for hiding this comment

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

@nissu99 Thanks again for doing this! As indicated in #2535 this is needed

It is passing the build but I found some other model1 that need to be changed to model

For the solara_viz I would get rid of VAR_KEYWORD all together. I also made the value error more explicit as we have some users new to python and coding. Feel free to further improve

As soon as you get this done we will get it merged!

@nissu99 nissu99 requested a review from tpike3 December 8, 2024 16:59
@nissu99
Copy link
Contributor Author

nissu99 commented Dec 8, 2024

@tpike3 thanks for all the instructive comments ,i have made the changes.

Copy link
Member

@tpike3 tpike3 left a comment

Choose a reason for hiding this comment

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

Thanks @nissu99!

@tpike3 tpike3 dismissed quaquel’s stale review December 9, 2024 10:35

Concerns addressed

@tpike3 tpike3 merged commit bf6ab9e into projectmesa:main Dec 9, 2024
11 checks passed
@EwoutH
Copy link
Member

EwoutH commented Dec 9, 2024

Great work, thanks!

@EwoutH
Copy link
Member

EwoutH commented Dec 12, 2024

@tpike3 could you please Squash and merge when merging PRs? That keeps our commits on the main branch clean. Clean commits can be easier backported or reverted if needed.

image

@nissu99 nissu99 deleted the mesa_docsUpdate branch December 13, 2024 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Release notes label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants