Skip to content
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

Vispy 0.12: per-point symbol and several bugfixes #5312

Merged
merged 23 commits into from Dec 13, 2022

Conversation

brisvag
Copy link
Contributor

@brisvag brisvag commented Nov 8, 2022

Description

Bump vispy to 0.12. This fixes several bugs that we fixed upstream, and introduces some new functionality. In short:

  • symbol is now per-point, just like size, color and and so on. I added a small example to showcase this:
multi_symbol.mp4

Type of change

  • Bug-fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

@github-actions github-actions bot added the qt Relates to qt label Nov 8, 2022
@github-actions github-actions bot added the tests Something related to our tests label Nov 8, 2022
@brisvag
Copy link
Contributor Author

brisvag commented Nov 9, 2022

Turns out there was a bug in vispy 0.12. Will push 0.12.1 soon with a fix.

@codecov
Copy link

codecov bot commented Nov 14, 2022

Codecov Report

Merging #5312 (ccae493) into main (58c0ca8) will increase coverage by 0.00%.
The diff coverage is 95.65%.

❗ Current head ccae493 differs from pull request most recent head 52804a1. Consider uploading reports for the commit 52804a1 to get more accurate results

@@           Coverage Diff           @@
##             main    #5312   +/-   ##
=======================================
  Coverage   89.01%   89.02%           
=======================================
  Files         594      594           
  Lines       50237    50277   +40     
=======================================
+ Hits        44719    44758   +39     
- Misses       5518     5519    +1     
Impacted Files Coverage Δ
napari/_vispy/visuals/points.py 100.00% <ø> (ø)
napari/_vispy/visuals/volume.py 100.00% <ø> (ø)
napari/layers/image/image.py 95.30% <66.66%> (-0.44%) ⬇️
napari/_qt/layer_controls/qt_points_controls.py 92.05% <90.90%> (+0.10%) ⬆️
napari/layers/points/points.py 98.83% <94.59%> (-0.24%) ⬇️
napari/_qt/_tests/test_qt_viewer.py 94.45% <100.00%> (+0.02%) ⬆️
...i/_qt/layer_controls/_tests/test_qt_image_layer.py 100.00% <100.00%> (ø)
napari/_tests/test_mouse_bindings.py 94.07% <100.00%> (+0.16%) ⬆️
napari/_tests/test_notebook_display.py 100.00% <100.00%> (ø)
napari/_tests/test_viewer.py 96.37% <100.00%> (+0.01%) ⬆️
... and 17 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions github-actions bot added the task label Dec 7, 2022
@brisvag
Copy link
Contributor Author

brisvag commented Dec 12, 2022

Yes; check this ci run for an example failure. Unfortuantley, I don't know how to get more info than this :/

@andy-sweet
Copy link
Member

Yes; check this ci run for an example failure. Unfortuantley, I don't know how to get more info than this :/

I don't a see a segfault there - instead an InvocationError from tox? I'm going to create a py38 env on my windows machine then run all the tests through tox to see if I can reproduce.

@andy-sweet
Copy link
Member

I don't a see a segfault there - instead an InvocationError from tox?

Ah, I guess tox is running pytest in another subprocess and that process is ending with a segfault? The exit code in the CI logs is 3221225477, which I don't understand, even with the docs from tox.

I'm going to create a py38 env on my windows machine then run all the tests through tox to see if I can reproduce.

I have some issues getting tox to work in my py38 environment. But the tests skipped here work with direct calls to pytest in such an environment, so that's more good news :)

Still not particularly happy about skipping tests without well understood reasons, but it's not enough to block this PR, which we should get in soon to start exercising vispy 0.12.

@Czaki
Copy link
Collaborator

Czaki commented Dec 12, 2022

3221225477

this looks like a memory violatation error based on fast google.

@brisvag
Copy link
Contributor Author

brisvag commented Dec 13, 2022

I don't a see a segfault there - instead an InvocationError from tox?

Right, my bad: unfortunately when you run tox with -v, somehow you lose some of these deep tracebacks. Here's a failure where you can see some more details about the errors. It's indeed an access violation, and googling around that error code did not really bring me anywhere.

Still not particularly happy about skipping tests without well understood reasons

Yeah I feel the same, but if the tests block us completely rather than finding real errors, they're counterproductive.

@andy-sweet
Copy link
Member

Yeah I feel the same, but if the tests block us completely rather than finding real errors, they're counterproductive.

Like I said, I don't think this PR is blocked, so you should feel free to merge. I may dig a little deeper and follow up with some findings later though, as the error is pretty clearly related to the new vispy version (though it's still unclear if it's only Windows CI where that can happen).

@brisvag brisvag merged commit 3e9cb4e into napari:main Dec 13, 2022
@brisvag brisvag deleted the vispy-0.12 branch December 13, 2022 18:23
aganders3 pushed a commit to aganders3/napari that referenced this pull request Dec 20, 2022
@andy-sweet andy-sweet mentioned this pull request Dec 21, 2022
7 tasks
melissawm pushed a commit to melissawm/napari that referenced this pull request Jan 11, 2023
@brisvag brisvag mentioned this pull request Feb 22, 2023
4 tasks
@Czaki Czaki mentioned this pull request Jun 7, 2023
@melonora melonora added this to the 0.4.18 milestone Jun 15, 2023
jni added a commit that referenced this pull request Jun 22, 2023
# Description
With vispy 0.12 (#5312) we introduced some changes to how point sizes
are computed. Specifically, the `scale` is no longer used to determine
the size.

The initial reason was #2213. For a long explanation (with all the
caveats and complications), see vispy/vispy#2453 (specifically, [this
comment has a summary of the
behaviour](vispy/vispy#2453 (comment))).

While the current state not ideal (and we're trying to figure out over
at vispy if we can solve it), this at least solves nasty problems like
#2213. However, it means that a size of `10` is still `10` even if the
scale of the layer is `5` (and not `50`).

This may "break" some code that relies on this transformation; in
napari, one of the consequences is that the `new points layer` button on
the viewer gui will now create tiny (or massive) points if the scale is
different.

To test, try this:

```py
import napari
import numpy as np

v = napari.Viewer()
v.add_image(np.random.rand(100, 100), scale=[10, 10])
```

then click the "new points" button and try to annotate some points
manually. On `main`, they'll be so small that they're invisible.

---

This also exposed another issue (which became the main point of this
PR): while point sizes are currently anisotropic, this information is
not properly used in many places (visualisation being the primary); not
only it's mostly unused, but it's handwaved in a few places (we
arbitrarily take the average size over each dimension to determine the
visualised size, we only allow setting isotropic sizes from gui and the
`current_size`, and so on).

Ultimately, we decided that we can't reasonably support anisotropic
sizes, so we should do away with them. Most changes in this PR have to
do with that.

## Type of change
<!-- Please delete options that are not relevant. -->
- [x] Bug-fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

---------

Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>
Co-authored-by: Wouter-Michiel Vierdag <w-mv@hotmail.com>
Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>
Czaki pushed a commit that referenced this pull request Jun 22, 2023
With vispy 0.12 (#5312) we introduced some changes to how point sizes
are computed. Specifically, the `scale` is no longer used to determine
the size.

The initial reason was #2213. For a long explanation (with all the
caveats and complications), see vispy/vispy#2453 (specifically, [this
comment has a summary of the
behaviour](vispy/vispy#2453 (comment))).

While the current state not ideal (and we're trying to figure out over
at vispy if we can solve it), this at least solves nasty problems like
scale of the layer is `5` (and not `50`).

This may "break" some code that relies on this transformation; in
napari, one of the consequences is that the `new points layer` button on
the viewer gui will now create tiny (or massive) points if the scale is
different.

To test, try this:

```py
import napari
import numpy as np

v = napari.Viewer()
v.add_image(np.random.rand(100, 100), scale=[10, 10])
```

then click the "new points" button and try to annotate some points
manually. On `main`, they'll be so small that they're invisible.

---

This also exposed another issue (which became the main point of this
PR): while point sizes are currently anisotropic, this information is
not properly used in many places (visualisation being the primary); not
only it's mostly unused, but it's handwaved in a few places (we
arbitrarily take the average size over each dimension to determine the
visualised size, we only allow setting isotropic sizes from gui and the
`current_size`, and so on).

Ultimately, we decided that we can't reasonably support anisotropic
sizes, so we should do away with them. Most changes in this PR have to
do with that.

<!-- Please delete options that are not relevant. -->
- [x] Bug-fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

---------

Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>
Co-authored-by: Wouter-Michiel Vierdag <w-mv@hotmail.com>
Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>
@brisvag brisvag mentioned this pull request Jun 30, 2023
melissawm pushed a commit to melissawm/napari that referenced this pull request Jul 3, 2023
# Description
With vispy 0.12 (napari#5312) we introduced some changes to how point sizes
are computed. Specifically, the `scale` is no longer used to determine
the size.

The initial reason was napari#2213. For a long explanation (with all the
caveats and complications), see vispy/vispy#2453 (specifically, [this
comment has a summary of the
behaviour](vispy/vispy#2453 (comment))).

While the current state not ideal (and we're trying to figure out over
at vispy if we can solve it), this at least solves nasty problems like
napari#2213. However, it means that a size of `10` is still `10` even if the
scale of the layer is `5` (and not `50`).

This may "break" some code that relies on this transformation; in
napari, one of the consequences is that the `new points layer` button on
the viewer gui will now create tiny (or massive) points if the scale is
different.

To test, try this:

```py
import napari
import numpy as np

v = napari.Viewer()
v.add_image(np.random.rand(100, 100), scale=[10, 10])
```

then click the "new points" button and try to annotate some points
manually. On `main`, they'll be so small that they're invisible.

---

This also exposed another issue (which became the main point of this
PR): while point sizes are currently anisotropic, this information is
not properly used in many places (visualisation being the primary); not
only it's mostly unused, but it's handwaved in a few places (we
arbitrarily take the average size over each dimension to determine the
visualised size, we only allow setting isotropic sizes from gui and the
`current_size`, and so on).

Ultimately, we decided that we can't reasonably support anisotropic
sizes, so we should do away with them. Most changes in this PR have to
do with that.

## Type of change
<!-- Please delete options that are not relevant. -->
- [x] Bug-fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

---------

Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>
Co-authored-by: Wouter-Michiel Vierdag <w-mv@hotmail.com>
Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>
brisvag added a commit that referenced this pull request Jul 20, 2023
# Description
Bump vispy to 0.13 to get some extra features. Relevant changes are:

- vispy/vispy#2465, which can improve performance dramatically for
`mip`-style projections in volumes by stopping the ray cast early if the
max clim was already reached
- a couple improvements to touchaped gestures (vispy/vispy#2456,
vispy/vispy#2483)

Reverted defaults of `Markers.scaling` also mean that we need to add a
couple lines in napari to maintain the same behaviour ( see
vispy/vispy#2359 and #5312 if you want to dive deeper).

cc @aganders3 who did much of the vispy work :)

---------

Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
Co-authored-by: napari-bot <napari-bot@users.noreply.github.com>
Czaki pushed a commit that referenced this pull request Oct 17, 2023
Bump vispy to 0.13 to get some extra features. Relevant changes are:

- vispy/vispy#2465, which can improve performance dramatically for
`mip`-style projections in volumes by stopping the ray cast early if the
max clim was already reached
- a couple improvements to touchaped gestures (vispy/vispy#2456,
vispy/vispy#2483)

Reverted defaults of `Markers.scaling` also mean that we need to add a
couple lines in napari to maintain the same behaviour ( see
vispy/vispy#2359 and #5312 if you want to dive deeper).

cc @aganders3 who did much of the vispy work :)

---------

Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
Co-authored-by: napari-bot <napari-bot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
qt Relates to qt tests Something related to our tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsist size of Point when rotate in 3d
4 participants