Closed NoaSut closed 5 months ago
When this bottom right dialog pop up, click on it and then click "View Traceback" and copy the traceback here.
When this bottom right dialog pop up, click on it and then click "View Traceback" and copy the traceback here.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
File ~\PycharmProjects\Cell-iSCAT\.venv\Lib\site-packages\napari_animation\_qt\animation_widget.py:152, in AnimationWidget._on_slider_moved(self=<napari_animation._qt.animation_widget.AnimationWidget object>, event=13)
150 if frame_index < len(self.animation._frames):
151 with self.animation.key_frames.selection.events.active.blocker():
--> 152 self.animation.set_movie_frame_index(frame_index)
frame_index = 13
self.animation = <napari_animation.animation.Animation object at 0x000001C80496A650>
self = <napari_animation._qt.animation_widget.AnimationWidget object at 0x000001C80EA47F40>
File ~\PycharmProjects\Cell-iSCAT\.venv\Lib\site-packages\napari_animation\animation.py:122, in Animation.set_movie_frame_index(self=<napari_animation.animation.Animation object>, index=13)
119 if self.key_frames.selection.active != key_frame:
120 self.key_frames.selection.active = key_frame
--> 122 self._frames.set_movie_frame_index(self.viewer, index)
index = 13
self.viewer = Viewer(camera=Camera(center=(0.0, 96.0, 110.0), zoom=5.188502647611456, angles=(0.0, 0.0, 90.0), perspective=0.0, mouse_pan=True, mouse_zoom=True), cursor=Cursor(position=(235.0, 203.44910573666454, 266.69259840866886), scaled=True, size=1, style=<CursorStyle.STANDARD: 'standard'>), dims=Dims(ndim=3, ndisplay=2, last_used=0, range=((0.0, 500.0, 1.0), (0.0, 193.0, 1.0), (0.0, 221.0, 1.0)), current_step=(235, 96, 110), order=(0, 1, 2), axis_labels=('0', '1', '2')), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[<Image layer 'iSCAT' at 0x1c786d31490>, <Tracks layer 'tracks' at 0x1c789161a10>, <Points layer 'Localizations' at 0x1c7ff1e4490>, <Image layer 'HeatMap_D' at 0x1c8018589d0>, <Image layer 'HeatMap_Alpha' at 0x1c80e725e10>], help='use <2> for transform', status={'layer_base': 'iSCAT_Stack.tiff', 'source_type': 'plugin', 'plugin': 'napari builtins', 'coordinates': ' [235 203 267]'}, tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_over_canvas=True, mouse_move_callbacks=[], mouse_drag_callbacks=[], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x000001C7FD5A4D60>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, keymap={'Alt-F': <bound method AnimationWidget._capture_keyframe_callback of <napari_animation._qt.animation_widget.AnimationWidget object at 0x000001C80EA47F40>>, 'Alt-R': <bound method AnimationWidget._replace_keyframe_callback of <napari_animation._qt.animation_widget.AnimationWidget object at 0x000001C80EA47F40>>, 'Alt-D': <bound method AnimationWidget._delete_keyframe_callback of <napari_animation._qt.animation_widget.AnimationWidget object at 0x000001C80EA47F40>>, 'Alt-A': <function AnimationWidget._add_keybind_callbacks.<locals>.<lambda> at 0x000001C8246D3560>, 'Alt-B': <function AnimationWidget._add_keybind_callbacks.<locals>.<lambda> at 0x000001C8246D0C20>})
self = <napari_animation.animation.Animation object at 0x000001C80496A650>
self._frames = <napari_animation.frame_sequence.FrameSequence object at 0x000001C804954E10>
123 self._current_frame = index
125 except KeyError:
File ~\PycharmProjects\Cell-iSCAT\.venv\Lib\site-packages\napari_animation\frame_sequence.py:161, in FrameSequence.set_movie_frame_index(self=<napari_animation.frame_sequence.FrameSequence object>, viewer=Viewer(camera=Camera(center=(0.0, 96.0, 110.0), ...lbacks.<locals>.<lambda> at 0x000001C8246D0C20>}), index=13)
160 def set_movie_frame_index(self, viewer: napari.viewer.Viewer, index: int):
--> 161 self[index].apply(viewer)
index = 13
viewer = Viewer(camera=Camera(center=(0.0, 96.0, 110.0), zoom=5.188502647611456, angles=(0.0, 0.0, 90.0), perspective=0.0, mouse_pan=True, mouse_zoom=True), cursor=Cursor(position=(235.0, 203.44910573666454, 266.69259840866886), scaled=True, size=1, style=<CursorStyle.STANDARD: 'standard'>), dims=Dims(ndim=3, ndisplay=2, last_used=0, range=((0.0, 500.0, 1.0), (0.0, 193.0, 1.0), (0.0, 221.0, 1.0)), current_step=(235, 96, 110), order=(0, 1, 2), axis_labels=('0', '1', '2')), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[<Image layer 'iSCAT' at 0x1c786d31490>, <Tracks layer 'tracks' at 0x1c789161a10>, <Points layer 'Localizations' at 0x1c7ff1e4490>, <Image layer 'HeatMap_D' at 0x1c8018589d0>, <Image layer 'HeatMap_Alpha' at 0x1c80e725e10>], help='use <2> for transform', status={'layer_base': 'iSCAT_Stack.tiff', 'source_type': 'plugin', 'plugin': 'napari builtins', 'coordinates': ' [235 203 267]'}, tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_over_canvas=True, mouse_move_callbacks=[], mouse_drag_callbacks=[], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x000001C7FD5A4D60>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, keymap={'Alt-F': <bound method AnimationWidget._capture_keyframe_callback of <napari_animation._qt.animation_widget.AnimationWidget object at 0x000001C80EA47F40>>, 'Alt-R': <bound method AnimationWidget._replace_keyframe_callback of <napari_animation._qt.animation_widget.AnimationWidget object at 0x000001C80EA47F40>>, 'Alt-D': <bound method AnimationWidget._delete_keyframe_callback of <napari_animation._qt.animation_widget.AnimationWidget object at 0x000001C80EA47F40>>, 'Alt-A': <function AnimationWidget._add_keybind_callbacks.<locals>.<lambda> at 0x000001C8246D3560>, 'Alt-B': <function AnimationWidget._add_keybind_callbacks.<locals>.<lambda> at 0x000001C8246D0C20>})
self = <napari_animation.frame_sequence.FrameSequence object at 0x000001C804954E10>
162 self._current_index = index
File ~\PycharmProjects\Cell-iSCAT\.venv\Lib\site-packages\napari_animation\viewer_state.py:58, in ViewerState.apply(self=ViewerState(camera={'center': (0.0, 96.0, 110.0)...el_2d': <class 'numpy.ndarray'> (1, 1) float32}}), viewer=Viewer(camera=Camera(center=(0.0, 96.0, 110.0), ...lbacks.<locals>.<lambda> at 0x000001C8246D0C20>}))
56 original_value = layer_attributes[attribute_name]
57 # Only set if value differs to avoid expensive redraws
---> 58 if not np.array_equal(original_value, value):
value = {'string': {'constant': <class 'numpy.ndarray'> () <U1, 'encoding_type': 'ConstantStringEncoding'}, 'color': {'constant': <class 'numpy.ndarray'> (4,) float32, 'encoding_type': 'ConstantColorEncoding'}, 'visible': True, 'size': 12, 'blending': <Blending.TRANSLUCENT: 'translucent'>, 'anchor': <Anchor.CENTER: 'center'>, 'translation': <class 'numpy.ndarray'> () float64, 'rotation': 0.0}
original_value = {'string': {'constant': <class 'numpy.ndarray'> () <U1, 'encoding_type': 'ConstantStringEncoding'}, 'color': {'constant': <class 'numpy.ndarray'> (4,) float32, 'encoding_type': 'ConstantColorEncoding'}, 'visible': True, 'size': 12, 'blending': <Blending.TRANSLUCENT: 'translucent'>, 'anchor': <Anchor.CENTER: 'center'>, 'translation': <class 'numpy.ndarray'> () float64, 'rotation': 0.0}
np.array_equal = <function array_equal at 0x000001C7B82701F0>
np = <module 'numpy' from 'C:\\Users\\nosutter\\PycharmProjects\\Cell-iSCAT\\.venv\\Lib\\site-packages\\numpy\\__init__.py'>
59 setattr(layer, attribute_name, value)
File ~\PycharmProjects\Cell-iSCAT\.venv\Lib\site-packages\numpy\core\numeric.py:2439, in array_equal(a1=<class 'numpy.ndarray'> () object, a2=<class 'numpy.ndarray'> () object, equal_nan=False)
2437 return False
2438 if not equal_nan:
-> 2439 return bool(asarray(a1 == a2).all())
a1 = <class 'numpy.ndarray'> () object
a2 = <class 'numpy.ndarray'> () object
2440 # Handling NaN values if equal_nan is True
2441 a1nan, a2nan = isnan(a1), isnan(a2)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Looks like a bug that need to be solved in napari animation. This package is released much more often than napari
itself so trace this issue.
It looks like wrong equal operator is used.
I think this should have been fixed by: https://github.com/napari/napari-animation/pull/181
We just haven't made a release.
Can you try to installing the main branch from here via:
python -m pip install "git+https://github.com/napari/napari-animation.git
If that doesn't work then we'll need a bit more info about the layers or ideally some code to reproduce.
We just haven't made a release.
We really need to push a release ^^'
We just haven't made a release.
We really need to push a release ^^'
I'm happy to do this (and write down the process for future maintainers), if that helps?
It looks like a v0.0.8
tag needs to be pushed to the main branch, then the github workflow scripts will automatically upload a new release to PyPI and update the docs website. Is there anything else that needs to happen as well?
I don't see a place for release notes. Maybe there aren't any? This PR might be a deprecation https://github.com/napari/napari-animation/pull/178, but all the others since the last release look like maintenance or bugfixes.
Thanks @GenevieveBuckley; yeah, I'm not really sure which things we should wrap up for release. We could reuse napari's CI tricks for release notes, but I don't think it's worth the effort.
Probably just tag! @psobolewskiPhD was there some outstanding PR/issue you wanted to wrap up?
I think the recent issues are fixed and just due to lack of release? I'm not sure layers with pandas properties will work properly. I was going to look into it, but haven't come around to it. Not sure that should block anything, I think a release is way over-due. I'm not sure how releasing something like this works (or napari for that matter)--i guess i need to do some googling. I know on zulip there was some question regarding trusted publishing...
0.0.8 should be live https://pypi.org/project/napari-animation/ Hopefully this fixes your issue, if not please re-open!
Hi, I want to use Napari-animation (wizard) to generate an animation that contains different layers. Such layers are: -Points layer. -Tracks layer. -3 Image layers (2 of them containing NaN values)
The Image stacks are not particularly long (500 frames).
As soon as I want to save the animation I get an error: "ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()". However, if I only use a single layer it works.
What could be reasons and solutions to solve this problem?