-
Notifications
You must be signed in to change notification settings - Fork 939
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
Add render interval slider to control visualization update frequency #2596
Conversation
sliders created for step interval to display graph after specified number of steps
for more information, see https://pre-commit.ci
Performance benchmarks:
|
forgot to commit changes ofsolara_viz.py in previous commit
for more information, see https://pre-commit.ci
@HMNS19 thanks for the PR! Is it already ready for a first round of review? |
@EwoutH The work is almost ready for the first round of review. For the most part, the execution speed has improved, but it’s not as fast as expected for a few models. I’m currently working on optimizing those. I should have it ready in a day or two. Let me know if you'd like me to proceed with the review or wait until it's fully optimized. |
Thanks for working on it and providing an update. One thing I notice is that you change every example model. Ideally, I would like a generalized solution, directly in SolaraViz. Like in this PR: |
Understood, will work on it. Thank you for the feedback and the reference! |
Performance benchmarks:
|
Thanks, code looks good, have you tested it? I will review later today. |
Yes, I have tested the example models, and they are working as expected. Most of them respond with very minimal latency after clicking the step button. However, the Epstein model takes around 2 seconds of latency when the step interval is set to a high value like 100. I suspect this might be due to factors unrelated to the slider feature. |
Revert unintended changes to mesa\visualization\components\__init__.py
This works perfect, and is really useful! Glad to see it could be done the same way as in #2540. I do find the naming currently not the most intuitive, both of |
Maybe |
Sure, renaming Would you like me to proceed with any changes based on this? |
I would like to call it |
I've made the necessary changes and renamed it to render_interval as you suggested. Let me know if any other changes are needed! |
@HMNS19 Looks good! I cleaned up the PR a little bit (you changed some unrelated files) and updated the PR title and description. Finally, could you a screenshot of how the slider now looks to the PR description? |
Summary
This PR adds a render interval slider to the SolaraViz visualization system, allowing users to control how frequently plots and visualizations are updated during model simulation. This feature significantly improves performance when working with complex visualizations or multiple plots.
Motive
When running models with multiple or complex visualizations, plotting components (especially Matplotlib) can become a performance bottleneck. This enhancement allows users to reduce visualization update frequency while maintaining full simulation speed, addressing the performance issues raised in #2579.
Implementation
render_interval
parameter toSolaraViz
that defaults to 1do_step()
function in bothModelController
andSimulatorController
to:Usage Examples
The render interval slider appears automatically in the visualization interface.
Additional Notes