-
Notifications
You must be signed in to change notification settings - Fork 916
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
UI layout #1825
UI layout #1825
Conversation
Ha, funny, I was experimenting today with the exact same ideas. The only change I would suggest is putting the controls into the main area and not the sidebar. On small screens and thus often in Notebooks the sidebar is collapsed by default and doesn't stay open, so this makes it hard to control the model. But otherwise this is very nice 👍 |
mesa/experimental/jupyter_viz.py
Outdated
solara.Markdown(name) | ||
UserInputs(user_params, on_change=handle_change_model_params) | ||
ModelController(model, play_interval, current_step, set_current_step, reset_counter) | ||
with solara.AppBarTitle(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with solara.AppBarTitle(): | |
solara.Title(name) |
This also sets the tab title
I have added a check that allows us to identify Jupyter from normal. And based on this we can change the UI layout. |
mesa/experimental/jupyter_viz.py
Outdated
import mesa | ||
|
||
# Avoid interactive backend | ||
plt.switch_backend("agg") | ||
plt.rcParams["figure.figsize"] = (7, 7) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't set the figure size globally, because this affects both the space/grid and the plots. Needs to be more fine-grained. This comments applies to #1820 as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will resolve this by tomorrow, thanks for pointing this out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I need an explanation on why this hasn't been acted on in 3 weeks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has been removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know. It took 3 weeks. What is the explanation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at the moment -- No.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1821 is simple to implement, orthogonal to your existing 2 PRs. Waiting for #1825 is not a sufficient justification for not working on it. If you don't want to do it, please say sooner. It is a needed feature that needs to be delivered soon. I will just do it.
#1820 is needed because this PR only handles the total space visualization with, and doesn't fix the overlapping markers.
I am appalled by your responses here so far. No replies on #1820, then suddenly you decided to not work on it for a reason that you think it is irrelevant, and which it is not justifiable either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am very sorry for my comments and the lack of understanding of how you allocate time for your workflow, given that you are busy with classes as well. It was uncalled for. I haven't said earlier that you should have communicated your thoughts that #1820 is unnecessary. But it would be great next time to tell this and so we can discuss about it. Thank you for what you have done so far, and hope we can get this done by CSSSA.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1825 +/- ##
==========================================
- Coverage 79.12% 78.27% -0.86%
==========================================
Files 15 17 +2
Lines 915 962 +47
Branches 194 214 +20
==========================================
+ Hits 724 753 +29
- Misses 168 183 +15
- Partials 23 26 +3
☔ View full report in Codecov by Sentry. |
@ankitk50 Thanks, very excited about these updates. To merge can you:
Again very cool. Excited to get this into mesa. |
mesa/experimental/jupyter_viz.py
Outdated
|
||
# render layout and plot | ||
|
||
if "ipykernel" in sys.argv[0]: # jupyter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you split the following if-else into 2 components each defined in a function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
component forces re-render of Cards , for now I have moved these to two functions
mesa/experimental/jupyter_viz.py
Outdated
@@ -281,7 +221,17 @@ def portray(g): | |||
out["c"] = c | |||
return out | |||
|
|||
space_ax.scatter(**portray(space)) | |||
|
|||
# figure(figsize=(50, 50), dpi=80) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
introduced by automated merge, should be resolved
mesa/experimental/jupyter_viz.py
Outdated
|
||
# figure(figsize=(50, 50), dpi=80) | ||
space_fig = Figure() | ||
space_ax = space_fig.subplots() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function already has space_ax
in the argument, so these 2 lines are unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upon reading further, the whole new change from this line to L234 are duplicate of make_space
. Please remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
introduced by automated merge, should be resolved
My feedback with the current PR is that I have to review line by line comparing with the old version, because there could be unexpected changes being slipped in. This is more time consuming that necessary. And indeed there are: #1825 (comment). |
on_click=do_reset, | ||
) | ||
|
||
# with solara.Row(gap="10px", justify="center"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is another line that needs to be removed.
I have found another line slipped in https://github.com/projectmesa/mesa/pull/1825/files#r1375915733, and having to review from scratch every line changed is taxing for me. Can you open a new PR that does the splitting of |
Sure |
The major changes related to the UI has been moved to #1854. I will create a separate PR for restructuring / reorganising. |
This PR will focus on changes to the UI layout. Below is the initial proposal.