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

remove edge_width for points layer #167

Merged
merged 3 commits into from
Apr 15, 2024

Conversation

McHaillet
Copy link
Contributor

@McHaillet McHaillet commented Apr 14, 2024

While trying the nightly build I got the following bug when trying to open blik:

napari -w blik -- manual_annotation/tomo_particles_tm.star manual_annotation/tomos/*
Traceback (most recent call last):
  File "/home/marten/miniconda3/envs/blik_nightly/lib/python3.12/site-packages/napari/components/viewer_model.py", line 1471, in _add_layer_from_data
    layer = add_method(data, **(meta or {}))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: add_points() got an unexpected keyword argument 'edge_width'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/marten/miniconda3/envs/blik_nightly/lib/python3.12/site-packages/napari/components/viewer_model.py", line 1280, in _open_or_raise_error
    added = self._add_layers_with_plugins(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/marten/miniconda3/envs/blik_nightly/lib/python3.12/site-packages/napari/components/viewer_model.py", line 1398, in _add_layers_with_plugins
    added.extend(self._add_layer_from_data(*_data))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/marten/miniconda3/envs/blik_nightly/lib/python3.12/site-packages/napari/components/viewer_model.py", line 1476, in _add_layer_from_data
    raise TypeError(
TypeError: _add_layer_from_data received an unexpected keyword argument ('edge_width') for layer type points

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/marten/miniconda3/envs/blik_nightly/lib/python3.12/site-packages/napari/_qt/qt_viewer.py", line 985, in _qt_open
    self.viewer.open(
  File "/home/marten/miniconda3/envs/blik_nightly/lib/python3.12/site-packages/napari/components/viewer_model.py", line 1180, in open
    layers = self._open_or_raise_error(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/marten/miniconda3/envs/blik_nightly/lib/python3.12/site-packages/napari/components/viewer_model.py", line 1289, in _open_or_raise_error
    raise ReaderPluginError(
napari.errors.reader_errors.ReaderPluginError: Tried opening with blik, but failed.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/marten/miniconda3/envs/blik_nightly/bin/napari", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/marten/miniconda3/envs/blik_nightly/lib/python3.12/site-packages/napari/__main__.py", line 574, in main
    _run()
  File "/home/marten/miniconda3/envs/blik_nightly/lib/python3.12/site-packages/napari/__main__.py", line 344, in _run
    viewer._window._qt_viewer._qt_open(
  File "/home/marten/miniconda3/envs/blik_nightly/lib/python3.12/site-packages/napari/_qt/qt_viewer.py", line 993, in _qt_open
    handle_gui_reading(
  File "/home/marten/miniconda3/envs/blik_nightly/lib/python3.12/site-packages/napari/_qt/dialogs/qt_reader_dialog.py", line 190, in handle_gui_reading
    readers = prepare_remaining_readers(paths, plugin_name, error)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/marten/miniconda3/envs/blik_nightly/lib/python3.12/site-packages/napari/_qt/dialogs/qt_reader_dialog.py", line 245, in prepare_remaining_readers
    raise ReaderPluginError(
napari.errors.reader_errors.ReaderPluginError: Tried to read [manual_annotation/tomo_particles_tm.star, ...] with plugin blik, because it was associated with that file extension/because it is the only plugin capable of reading that path, but it gave an error. Try associating a different plugin or installing a different plugin for this kind of file.

The traceback suggested that edge_width is not an available keyword for the points layer in napari (I guess changed in latest napari?), so I made a fork and removed it. This fixes the issue for me and therefore made a pr in case you want to merge it.

I didn't look into what changed in Napari or whether the option is fully removed or changed name.

@brisvag
Copy link
Owner

brisvag commented Apr 15, 2024

Thanks for writing here! Yeah, it changed name to border_width along with a few other kwargs that referenced edge; I actually have these changes locally, but haven't pushed ^^' You can change to border_width if you like, and then I'll merge! Otherwise, I can close this and open another :)

@McHaillet
Copy link
Contributor Author

Sure, I can update it!

@McHaillet
Copy link
Contributor Author

Updated!

Copy link
Owner

@brisvag brisvag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx!

@McHaillet
Copy link
Contributor Author

Clashes with the napari version in the tests it seems :/

@brisvag
Copy link
Owner

brisvag commented Apr 15, 2024

Right, this will fail with anything below napari==0.5.0... We need a little version guard like the one for the projection mode:

**({"projection_mode": "all"} if NAPARI_050 else {}),

except it should pass a different key depending on the version!

@McHaillet
Copy link
Contributor Author

McHaillet commented Apr 15, 2024

I understand. Is it the exact same version (0.5.0a) as for the projection mode?

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 42.00%. Comparing base (753bc79) to head (b051cf4).
Report is 8 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #167   +/-   ##
=======================================
  Coverage   42.00%   42.00%           
=======================================
  Files          10       10           
  Lines         500      500           
=======================================
  Hits          210      210           
  Misses        290      290           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@brisvag brisvag merged commit 5fc51ea into brisvag:main Apr 15, 2024
11 of 12 checks passed
@brisvag
Copy link
Owner

brisvag commented Apr 15, 2024

Thanks, looks good! :)

@McHaillet
Copy link
Contributor Author

Great!

@McHaillet McHaillet deleted the bug_points_edge_width branch April 15, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants