-
Notifications
You must be signed in to change notification settings - Fork 119
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
Update abstract.jl solves #1045 #1059
Conversation
The culprit behind JuliaDynamics#1045 was the use of poly! for user defined polygons. As a first step, I replaced it with `scatter!(p, p.pos; p.color, p.marker, p.markersize, p.agentsplotkwargs...)` and generating the plot with the custom polygon worked. In that case I think the whole if else statement is no longer necessary so I removed it. ``` if user_used_polygons(p.agent_marker[], p.marker[]) poly!(p, p.marker; p.color, p.marker, p.markersize, p.agentsplotkwargs...) else scatter!(p, p.pos; p.color, p.marker, p.markersize, p.agentsplotkwargs...) end ```
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1059 +/- ##
===========================================
+ Coverage 70.12% 86.53% +16.41%
===========================================
Files 42 39 -3
Lines 2718 2578 -140
===========================================
+ Hits 1906 2231 +325
+ Misses 812 347 -465 ☔ View full report in Codecov by Sentry. |
I just realized that while this change removes the error that abmvideo was throwing, the end result is not quite right; the generated video seems to show only part of the space. This is despite the fact that the x and y axes suggest that the dimensions are correct. I make a model with 100 agents but see only few of them and it is also clear that they don't reappear where you'd expect them to given a periodic space. I do not understand what is going on here. |
I didn't test anything but I feel like removing |
ah also, thanks for your help on this :-) |
unfortunately i have to agree, removing I suspect that this code needs to stay as is, with if user_used_polygons(p.agent_marker[], p.marker[])
poly!(p, p.marker; p.color, p.marker, p.markersize, p.agentsplotkwargs...)
else
scatter!(p, p.pos; p.color, p.marker, p.markersize, p.agentsplotkwargs...)
end but what needs to be done is that we cannot blindly propagate |
@Tortar here is the full error message with the original code. This is the model where I encountered the problem. @Datseris scatter! does actually plot the polygons. The first picture is a screenshot with the PR code, the next one is with the agent_marker argument in abmvideo commented out. This is the strange behavior I described earlier, both cases have 100 agents but the first looks zoomed into a part of the space for some reason. |
Don't do that, it doesn't make sense at the moment. So we don't have to spend resources figuring out what commenting this out does. I didn't know that const bird_polygon = Makie.Polygon(5 .* Point2f[(-1, -1), (2, 0), (-1, 1)])
function bird_marker(b::Bird)
φ = atan(b.vel[2], b.vel[1]) #+ π/2 + π
rotate_polygon(bird_polygon, φ)
end (notice Are the polygons larger in size in |
I tried your model, and with the last commit I pushed everything works fine, we don't propagate to |
Great! Thanks a lot! |
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.
Alright, please go into top-level Project.toml and increment the patch version (3rd number) by one. Then we can merge and immediatelly tag a new release.
The culprit behind #1045 was the use of poly! for user defined polygons. As a first step, I replaced it with
scatter!(p, p.pos; p.color, p.marker, p.markersize, p.agentsplotkwargs...)
and generating the plot with the custom polygon worked. In that case I think the whole if else statement is no longer necessary so I removed it.