-
-
Notifications
You must be signed in to change notification settings - Fork 592
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
Add more features and clarification to Animators #3504
Conversation
Thanks for the pull request @Cadair! Everything looks great! |
Hello @Cadair! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2019-11-21 18:12:40 UTC |
Sounds potentially powerful. Would have to see a demo to fully understand though. |
b2f9e9a
to
0b4cf63
Compare
Rebase conflicted for me (I suspect something is off with my repo) so I just merged in master. |
58d261b
to
abf57f6
Compare
Not sure how the figs failed when they passed on my machine?! |
abf57f6
to
c2cb415
Compare
be67da1
to
3d524f2
Compare
* Pass the animator object to the button callback function. * Make button labels default to the names of the functions if not specified.
c5378f3
to
7108cfc
Compare
There appears to be a codecov issue with uploading coverage on the py38-online build, so that test is not representative. |
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 to me, left some suggestions that you can take or leave as you please.
@@ -0,0 +1,19 @@ | |||
Glue - multidimensional data exploration |
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.
Maybe worth a note here referencing the file it is needed for?
@@ -0,0 +1,351 @@ | |||
""" | |||
Modification of Chris Beaumont's mpl-modest-image package to allow the use of |
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.
Has this gone upstream/if not is it worth going upstream?
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.
That you would have to ask @astrofrog
are skipped. | ||
|
||
The interface of ModestImage is the same as AxesImage. However, it | ||
does not currently support setting the 'extent' property. There |
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.
Change this bit of docstring, since this implementation does allow extent
?
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 don't really want to change this file as it's in extern, I just want to be able to copy it out of Glue if there are updates there?
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.
And the reason we aren't just importing it from glue is...? I imagine it saves us a dependency but also means we have to update manually. Or I am not understanding externs?
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.
yeah, it means we don't have to depend on glue, which is a large dependency with a lot of qt and other things, really not worth it.
@@ -1,5 +1,5 @@ | |||
[tox] | |||
envlist = py{36,37,38}-{offline,online,astropydev,numpydev,astropy31},build_docs,figure,conda | |||
envlist = py{36,37,38}-{offline,online,astropydev,numpydev,astropy31},build_docs,figure,figure_astropydev,conda |
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.
Why this change?
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.
We forgot to add the new env to tox.ini
in #3407
Co-Authored-By: David Stansby <dstansby@gmail.com>
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.
So long as the questions I have raise no concerns, this looks fine to me.
are skipped. | ||
|
||
The interface of ModestImage is the same as AxesImage. However, it | ||
does not currently support setting the 'extent' property. There |
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.
And the reason we aren't just importing it from glue is...? I imagine it saves us a dependency but also means we have to update manually. Or I am not understanding externs?
base_kwargs = { | ||
'slider_functions': [self.update_plot] * self.num_sliders, | ||
'slider_ranges': [[0, dim] for dim in np.array(data.shape)[self.slider_axes]] | ||
'slider_functions': ([self.update_plot] * self.num_sliders) + slider_functions, |
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.
So does this mean the slider functions specified by the user in the slider_ranges
kwargs are only extra slider functions, e.g. for a colourbar? Data axes' sliders are still derived internally?
Same for slider_ranges
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, indeed it does.
extra_slider_labels = [] | ||
if "slider_functions" in kwargs and "slider_labels" not in kwargs: | ||
extra_slider_labels = [a.__name__ for a in kwargs['slider_functions']] | ||
|
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.
Too many empty lines.
This is a direct follow on from #3407 it adds the following functionality / cleanups:
Use
modest_image
from Glue to improve rendering of images inArrayAnimatorWCS
by reading less of the array. (Especially useful with dask arrays or memmapped arrays).Allow passing through extra slider functions in the
ArrayAnimator
constructor, this lets you provide extra sliders for controlling the colourbar limits for instance.Make the specification of button labels optional, by default it will use the function names.
Wire in an existing keyword argument to
BaseFuncAnimator
which allows the specification of a function to setup the plot as keyword argument.Modify the call signature of the button call back functions so that they get passed the animator object, so that they can easily do things that modify the plot.
Add optional slider labels to
BaseFuncAnimator
and set them by default inArrayAnimatorWCS
to the world axis names if present or the world axis physical types if not.