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

Cannot continue drawing a non-existent type of agents #2658

Open
SongshGeo opened this issue Feb 3, 2025 · 3 comments
Open

Cannot continue drawing a non-existent type of agents #2658

SongshGeo opened this issue Feb 3, 2025 · 3 comments

Comments

@SongshGeo
Copy link

When there isn't any specific type of agent, the visualization by solara would raise error because draw_orthogonal_grid (I suppose other drawing methods are the same) cannot parse the arguments generated from the function collect_agent_data. Take the orthogonal space as an example, the error is like:

  File "/Users/songshgeo/Documents/VSCode/SC-20230710-SCE/.venv/lib/python3.11/site-packages/mesa/visualization/mpl_space_drawing.py", line 575, in _scatter
    x = loc[:, 0]
        ~~~^^^^^^
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

This bug is mainly due to the lack of consideration of the scenario where a type of agent completely disappears. I am willing to open a PR to fix this bug for an orthogonal grid. However, I have not tested in higher-dimensional spaces.

@quaquel
Copy link
Member

quaquel commented Feb 3, 2025

Yes this is a known issue. See #2642.

@SongshGeo
Copy link
Author

Woop, sorry, I didn't search the existing issue with the correct keywords. I looked at your discussion and just realized that my local solution for a 2D grid cannot be applied to other high-dimensional spaces. So, yes, I agree with redesigning the API.

Thanks for your prompt reply.

@quaquel
Copy link
Member

quaquel commented Feb 3, 2025

No worries; the fact that several people have reported a version of this issue in recent weeks highlights the importance of addressing it.

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

No branches or pull requests

2 participants