-
Notifications
You must be signed in to change notification settings - Fork 31
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
Animation #146
Animation #146
Conversation
…nto side-panel
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.
Looks good, thanks so much Kalen. I've made a few comments but they are all fairly minor.
empress/_plot.py
Outdated
@@ -78,6 +78,22 @@ def plot(output_dir: str, | |||
.to_dataframe().filter(feature_table.index, axis=0) \ | |||
.to_dict(orient='index') | |||
|
|||
# TODO: Empress is currently sorting all metadata as strings. This is |
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 sample metadata is in general fine loaded as a string. Have you encountered any issues?
empress/support_files/js/drawer.js
Outdated
this.cam = cam; | ||
this.VERTEX_SIZE = 5; | ||
|
||
// sets empress to night mode | ||
// TODO: make this a customizable parameter |
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.
This looks great @kwcantrell! I suggested a few changes -- some of these might take a nontrivial amount of work, so if you'd prefer to defer some to new issues on GitHub that's totally fine. (Or if you disagree with anything, just let me know :)
I'll try to get that big insertion tree animated through here later today and will let you all know how that goes.
|
||
// dont show next button on last frame | ||
if (this.animator.onLastFrame()) { | ||
this.nextFrameBtn.classList.add("hidden"); |
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.
A slight problem with this approach is that the buttons are positioned such that, when the Next Frame
button is hidden, the Previous Frame
button is shifted over to where this button previously was:
Second-from-last frame in an animation
This means that, for people who are manually clicking through the animation, they'll likely accidentally press Previous Frame
when they get to the final frame. Not a big deal, but an annoyance nonetheless.
IMO it would be better to absolutely position these buttons, to attempt to stave off this problem.
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.
Nice catch! I'll update the PR to disable the prev/next button when on the first/last frame instead of hiding them.
this.startBtn.classList.add("hidden"); | ||
this.resumeBtn.classList.add("hidden"); | ||
this.prevFrameBtn.classList.add("hidden"); | ||
this.nextFrameBtn.classList.add("hidden"); |
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.
In my opinion at least :), it would be nice to have the prev/next-frame buttons present from the start of the animation -- it wasn't clear to me initially that these buttons were even available until I pressed Pause
. For users who want to step through the animations at their own pace (either to go slower or faster), I suspect these buttons will be preferable.
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.
@fedarko thanks for the suggestion! My goal with the GUI is to make things as intuitive and easy to use. One way I try to accomplish this is by only presenting options to the user that can be applied at that moment. Since the prev/next features can only be used when the animation is paused, I decided to hide those options unless the user pauses the animation.
Instead of hiding those buttons, I can disable them while the animation is running and enable them when the animation is paused. Also, I can start the animation is the pause state instead of the run state so users who wanted to manually step through the animation could do so without having to first pause the animation first.
@ElDeveloper how does Emperor handle this?
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.
In emperor we disable the buttons and still leave them visible (instead of hiding them).
<label for="animate-trajectory">Trajectory</label> | ||
<label class="select-container"> | ||
<select id="animate-trajectory"></select> | ||
</label> |
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.
Not really needed for this PR, but I'm just going to tag #138 here -- this would be a great place to add tooltips in the future explaining what exactly Gradient
and Trajectory
mean, for new users and/or for folks who haven't used the animation functionality in Emperor before.
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.
Great suggestion!
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.
Great suggestion @fedarko, I suggest doing that now using the title=
attribute.
@@ -31,7 +31,7 @@ | |||
</p> | |||
<p> | |||
<label for="sample-line-width">Line Width</label> | |||
<input id="sample-line-width" type="number" value="1"> | |||
<input id="sample-line-width" type="number" value="4"> |
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.
Not clear why the default is switched to 4
here? As #144 describes, line widths this large can start to look pretty jumbled when you inspect details of the tree. I would suggest keeping 1
as the default (it's also easier to see colored lines on a white background, IMO; another reason to keep light mode as the default)
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 ties into the comment I posted on #144. The main issue comes from how line widths are calculate in empress. To create new lines, a rectangle is created (in tree space) whose width is 2*line_width. So, a line width of 4 can appear larger/smaller depending on how much space the tree spans.
I set the default to 4 before #144 came up because the tree I, when testing the animation feature, a line width of 4 looked the best. I guess I forgot to switch it back.
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.
Understood! That makes sense to me. We'll probably have to reevaluate stuff for #144, but until then I guess the defaults don't matter too much.
//draw tree | ||
this.empress.resetTree(); | ||
this.empress._colorTree(obs, this.cm); | ||
this.empress.thickenSameSampleLines(this.lWidth); |
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 behavior differs from the normal sample coloring behavior -- in SidePanel.prototype._updateSample()
, the call made is
if (lWidth !== 1) {
this.empress.thickenSameSampleLines(lWidth - 1);
}
This inconsistency means that the same line width will result in differently-drawn rectangles between the sample coloring stuff and between the animation stuff:
Animation drawn with line width = 1:
Normal sample coloring, with line width = 1:
(Notice how the top screenshot's lines are drawn as being notably thicker than the bottom screenshot's.)
I would strongly suggest making this consistent (one way or another). That being said, we'll probably come back to this stuff when we get around to #144, so not a huge issue.
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.
Good catch! SidePanel (which probably should be renamed to SampleColorer or something like) should not be responsible for adjusting the line width as that operation should be handled by the thickenSameSampleLines (which also should be renamed since it is thickens all colored branches not same sample lines).
I'll update #144 to include this.
// TODO: add total percentage of tree colored by each category | ||
// old method was not correct. |
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's still not really clear how the previous method was incorrect from looking at #148. Not urgent or anything, but describing the bug somewhere would be nice (if nothing else, so that someone unfamiliar with it like me doesn't accidentally make the same mistake again :P)
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Marcus Fedarko <[email protected]> Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
Co-Authored-By: Yoshiki Vázquez Baeza <[email protected]>
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.
All looks good to me, except for the tooltips. If those are added and @fedarko's comments are all addressed, I think this is good to be merged.
} | ||
|
||
// convert result to array and sort | ||
values = [...values]; |
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 number of samples can be up to hundreds of thousands. Not sure what method might be better these days, but I think Array.from might be better.
empress/support_files/js/drawer.js
Outdated
|
||
// sets empress to night mode | ||
// TODO: make this a customizable parameter | ||
this.CLR_COL = 0; |
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.
Let's keep the light background until this can be user-modifiable.
<label for="animate-trajectory">Trajectory</label> | ||
<label class="select-container"> | ||
<select id="animate-trajectory"></select> | ||
</label> |
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.
Great suggestion @fedarko, I suggest doing that now using the title=
attribute.
Thanks everyone! 🎆 🚀 🎥 |
No description provided.