mpl-extensions / mpl-interactions

Sliders to control matplotlib and other interactive goodies. Works in any interactive backend and even uses ipywidgets when in a Jupyter notebook
https://mpl-interactions.rtfd.io
BSD 3-Clause "New" or "Revised" License
132 stars 20 forks source link

ipywidgets v8 #224

Closed swelborn closed 2 years ago

swelborn commented 2 years ago

This work is really great - I am making heavy use of your library in a jupyter GUI.

I am currently using ipywidgets 8.0.0a6, and everything seems to be working. Are there plans to eventually relax the requirements for ipywidgets < 8? Is there a more rigorous way to go about testing this?

ianhi commented 2 years ago

Thanks for reporting! I think I added that back when it was less clear what changes 8 would contain. I think I remember seeing somewhere that the default float slider is no longer stepped, which may not play nicely with some parts of this library (e.g. when passing a manually generated slider) but if it works well for you then thats a good sign!

Are there plans to eventually relax the requirements for ipywidgets < 8? Is there a more rigorous way to go about testing this?

Absolutely. And the most rigorous way to test is to manually go through all the examples and test that they behave as expected (the automated tests in notebooks aren't perfect for capturing what outputs look like), but short of that the automated tests should catch any failures to run.

  • I am making heavy use of your library in a jupyter GUI.

:heart: I love to hear that! If it's open source or otherwise shareable I'd love to see it if possible, otherwise totally understand.

ianhi commented 2 years ago

Closed by https://github.com/ianhi/mpl-interactions/pull/225

@all-contributors please add @samwelborn for userTesting

allcontributors[bot] commented 2 years ago

@ianhi

I've put up a pull request to add @samwelborn! :tada:

ianhi commented 2 years ago

should be working in version 0.20.0 which is now on pypi

swelborn commented 2 years ago

Thanks for your quick reply. I will go through the tests soon.

Now that you say that about the float slider - this is actually an issue, you can see in my gif below. Since I just started using your package yesterday, I didn't think too much of it and just dealt with the slider callback (to set another widget's value) in a different, albeit roundabout, way. Sorry for forgetting this before posting - been a long few days trying to solve other small problems....

I am still working on docs/rearranging/cleaning for my GUI, but here is a preview: centering

I think this example of using your hyperslicer in combination with your interactive histogram could be useful for people. It attempts to mirror this. I didn't show this in the gif, but you can use those xlim/ylim range sliders to change the range of the histogram.

The GUI uses tomopy, a tomography reconstruction package, as a backend.

ianhi commented 2 years ago

that's super neat!

Have you seen this example as well? https://mpl-interactions.readthedocs.io/en/stable/examples/range-sliders.html#using-a-rangeslider-for-scalar-arguments-thresholding-an-image

Also, I love using notebooks and find hyperslicer to be really helpful there (we - really almost entirely @jrussell25 - developed it for microscopy data) but I really can't recommend napari enough. I now mostly use hyperslicer for quickly looking at data in notbeook, but for all stuff where I want really good responsivity I always use napari.

While the gifs on their homepage https://napari.org/ don't really do it justice I think it is absolutely the best in class image viewer for hi dimensional data - gpu backed (fast!) - big dev team workign hard on it - tons of features and plugins - easy enough to make your own plugin. There are two downsides to it:

  1. It doesn't flow as nicely into a notebook as ipympl does
  2. It is definitely easier to get a gui going in ipywidgets then in napari

but that said if you learn a little bit of pyqt it's actually quite easy to slap together a basic gui https://github.com/Hekstra-Lab/napari-labeller#napari-labeller or for a more complex example https://github.com/tlambert03/napari-micromanager#napari-micromanager

Whenever you do put your code up let me know! I'm curious to look at it and happy to look over the matplotlib/mpl-interactions parts to see if there are any optimizations.

swelborn commented 2 years ago

Just added you to my private repo, just in case you want to check it out sooner rather than later. I am an experimentalist/just learned python a month or so ago... excuse the hacking in my code. Install instructions probably don't work for you right now, either - still updating them + docs.

Thanks for the recommendation on napari. Looks like a great tool. In my application, we don't really need fast responsiveness - it's only to check out the data quickly/do some basic things in a notebook before running an algorithm on it on the backend. Then, we use dragonfly for reconstruted data analysis/segmentation, which also runs on gpu.

If you don't mind, I planned to snag your docs template. Looks great....

ianhi commented 2 years ago

Just added you to my private repo, just in case you want to check it out sooner rather than later. I am an experimentalist/just learned python a month or so ago...

Rad! I'm actually traveling in india at the moment so may a be a little bit before I look but definitely curious to. Also on a first pass it looks good, especially for only hav eused python for a month!

If you don't mind, I planned to snag your docs template. Looks great....

@redeboer gets the credit for overhauling the docs structure - it's from their work on https://github.com/ComPWA/ampform#ampform I htink.

I also have a cookiecutter that generates a package and docs automatically if you're interested: https://github.com/ianhi/pyrepo-cookiecutter

swelborn commented 2 years ago

thanks for the heads up, I am using your cookiecutter now.

lots of changes within the past day or so...

swelborn commented 2 years ago

https://tomopyui.readthedocs.io/en/latest/

Check the docs out here. Thanks @ianhi and @redeboer !