- Notifications
You must be signed in to change notification settings - Fork22
added a Feature Histogram Widget#148
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
PS:@dstansby I didn't see that there was ongoing work on a different PR because it wasn't linked to the issue. Feel free to treat this as stale for while. |
fb47952
to91f6d16
CompareCo-Authored-By: Marcelo Zoccoler <26173597+zoccoler@users.noreply.github.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.
Looking good - a few major changes to make though. I have time to revise this myself, or I can leave you to do it- let me know either way!
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Hi@dstansby , thanks a lot for taking the time to review this! I think I can definitely get those changes done myself. I'll be on vacation in the coming week so PR should come sometime in the second-to-next week. |
Co-authored-by: David Stansby <dstansby@gmail.com>
Co-authored-by: David Stansby <dstansby@gmail.com>
Co-authored-by: David Stansby <dstansby@gmail.com>
…/napari-matplotlib into add-feature-histogram
524fdbd
to83747f9
Compare…/napari-matplotlib into add-feature-histogram
added parent to init
jo-mueller commentedJun 26, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hi@dstansby , I added your suggestions from above and replaced the magicgui widgets with pyqt code as has been done in the scatter widget in the meantime. Also sorry for the messy commit history - let me know if I should put the changes on a clean branch and re-start the PR. |
dstansby commentedJun 26, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
pre-commit.ci autofix |
for more information, seehttps://pre-commit.ci
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! I've left one requst for a change. In addition, could you add a figure test? Hopefully the other test files help with that, but let me know if you need any pointers.
Otherwise I'm 👍 to merge.
Uh oh!
There was an error while loading.Please reload this page.
Hi@dstansby , I'm not sure what you mean by figure test? I did add the following to the tests. This adds two points layers to the viewer with two sets of features assigned to each. I check whether the figure in the widget changes upon changing the key for the histogram and whether the plot changes as it should when the selected layer is changed. n_points=1000random_points=np.random.random((n_points,3))*10feature1=np.random.random(n_points)feature2=np.random.normal(size=n_points)viewer=make_napari_viewer()viewer.add_points(random_points,properties={"feature1":feature1,"feature2":feature2},name="points1", )viewer.add_points(random_points,properties={"feature1":feature1,"feature2":feature2},name="points2", )widget=FeaturesHistogramWidget(viewer)viewer.window.add_dock_widget(widget)# Check whether changing the selected key changes the plotwidget._set_axis_keys("feature1")fig1=deepcopy(widget.figure)widget._set_axis_keys("feature2")assert_figures_not_equal(widget.figure,fig1)# check whether selecting a different layer produces the same plotviewer.layers.selection.clear()viewer.layers.selection.add(viewer.layers[1])assert_figures_equal(widget.figure,fig1) |
ed8fc0a
to9d6988e
Compareremoved `reset_choices()` statementRevert "removed `reset_choices()` statement"This reverts commited8fc0a.removed `reset_choices()` from feature histogram
For a figure test, see e.g.,
This using the |
For the figure test: So |
No, you'll need to generate the new test image - seehttps://github.com/matplotlib/pytest-mpl#usage for instructions. |
Ok, I added the baseline image, but for some reason, the generated baseline is not detected by the test...Sorry for the back and forth, I'm not so familiar with these testing schemes 🙈 Just as a sidenote: Setting everything up for |
No worries! If you don't mind, I'd be happy to pick this up and get the test working? |
Not at all! Would be cool though if it were documented somewhere for future contributions 👍 |
dstansby commentedAug 25, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Looks like the test image was just in the wrong directory :) I also did a few other minor fixes, will merge this and do a new release of napari-matplotlib if the tests pass. Thanks a lot for the contribution, and sorry for how long it took me to merge it... |
Looks like it's just code coverage failing |
Linked to issue#58
New features:
This PR introduces a new widget to create Histograms from feature data in Labels/Points/Shapes/Tracks/Vectors layers. It's strongly based off of the ScatterWidget. I wasn't sure whether
scatter.py
was the right place to put it, but it felt like a better fit thanhistogram.py
, which essentially just works with image intensity data rather than tabular data.Example code snippet
This code snipped demonstrates what it does:
This code is essentially also what I added to the tests (tests are passing locally).
Looking forward to hear your thoughts on this! :)