-
Notifications
You must be signed in to change notification settings - Fork 5
Fix scatter3d so it handles updates to positions #484
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
Draft
nvaytet
wants to merge
15
commits into
main
Choose a base branch
from
update-positions-scatter3d
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
47cbf9b
if positions have changed, remove point cloud and make a new one
nvaytet 2f824d7
add option to disable potentially expensive check
nvaytet 8209f1c
add tests
nvaytet a853e59
get rid of expensive check and check shape instead
nvaytet 8f1a28c
Update src/plopp/backends/pythreejs/scatter3d.py
nvaytet 810c14d
only update positions if needed
nvaytet 666a0fb
use stack instead of np.array().T
nvaytet 5ba1867
reduce the number of times colors are updated
nvaytet f74eb45
change logic in updates and use renderer.hold() to avoid flickering o…
nvaytet a024c38
formatting
nvaytet 90fbccd
remove idiotic mechanism with count in finalize function
nvaytet c8be01c
improved logic and improved tests
nvaytet 8524902
notify artists also when autoscale is false
nvaytet 3e33713
change 3d clipping mechanism to use static nodes instead of dynamical…
nvaytet c521ef4
cleanup
nvaytet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
How long does this take approximately? Is it as fast as updating a 2d plot?
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.
It depends on the number of points. I did some basic timings: it's about 0.01s for 100_000 points, and ~0.04s for 500_000 points.
But this is only run if the updated values have a different shape than the existing ones, which I am guessing is not super common.
A more relevant question is probably how long does it take to update the positions every time?
We are now running
on every update, which is potentially quite a large allocation?
Before, we only have one array of floats for the colors, now we have 4 (colors + 3 positions).
We could only update if the coords have changed, but we would have to check something like
I need to check the timings of such a check, maybe it's fast enough?
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.
Yes, check it before you optimise too much! 0.04s seems fine. I don't think anyone expects 60fps.
Just a guess, but maybe you can make the big allocation slightly cheaper by using
np.stackor any of its variants instead ofnp.array([..]).T.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.
The check can actually be pretty fast (10x or more) compared to setting the position, so I added it in.