Conversation
sanika-n
commented
Feb 8, 2025
|
|
||
| for mark in np.unique(marker): | ||
| mark_mask = marker == mark | ||
| for mark in set(marker): |
Collaborator
Author
There was a problem hiding this comment.
I changed it to a set here because np.unique only works on similar datatypes as far as I know. And if we have a mix of tuples and the normal strings, np.unique wont work
|
Performance benchmarks:
|
quaquel
reviewed
Feb 15, 2025
Member
There was a problem hiding this comment.
This is a good way to test hybrid markers. Nice!
quaquel
approved these changes
Feb 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
In agent portrayal, the marker is supposed to be able to take on all matplotlib marker types. But the tuple way of defining markers is currently not compatible in MESA. This issue can be replicated by replacing the marker in any one of the examples (here I have taken boid_flockers) with say (3, 0, 30). This is supposed to convert the agents to a 3 sided polygon tilted by 30 degrees, if we replaced 3 with 4 we will get a square instead.
The main reason for the error was that during agent data collection, numpy was turning the tuples into arrays. I have fixed the issue in this PR.
I just ran boid_flockers using tuples in the following code after the fix:
I am not exactly sure, but I was wondering if merging this fix will help us later implement a solution to #1150, I can try working on that for boid_draw if it is feasible...