Fix/423 playback fps label#877
Fix/423 playback fps label#877Tushar7012 wants to merge 2 commits intoneuroinformatics-unit:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a read-only Playback FPS indicator to the napari plugin UI so users can distinguish napari’s playback speed from the acquisition FPS shown elsewhere, and also introduces new Zarr I/O documentation/tests alongside a small integration-test fixture refactor.
Changes:
- Add
PlaybackFPSWidgetthat displaysget_settings().application.playback_fpsand updates reactively on settings changes. - Integrate the widget into
MovementMetaWidgetas a second (non-collapsible) section. - Add Zarr save/load integration tests and corresponding user-guide documentation; refactor shared integration fixtures into
tests/test_integration/conftest.py.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
movement/napari/loader_widgets.py |
Adds PlaybackFPSWidget that subscribes to napari settings events and updates a label. |
movement/napari/meta_widget.py |
Embeds PlaybackFPSWidget into the plugin meta container. |
tests/test_unit/test_napari_plugin/test_data_loader_widget.py |
Adds unit tests for Playback FPS label initialization and reactive updates. |
tests/test_integration/test_zarr.py |
Adds integration coverage for Zarr roundtrip I/O via xarray. |
tests/test_integration/test_netcdf.py |
Removes locally-defined fixtures in favor of shared integration fixtures. |
tests/test_integration/conftest.py |
Adds shared integration fixtures (processed/derived/datetime-index datasets). |
docs/source/user_guide/input_output.md |
Adds a new user-guide section describing Zarr save/load usage. |
docs/source/conf.py |
Updates Sphinx linkcheck ignore list for Zarr/xarray docs domains. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| new_fps = 42 | ||
| get_settings().application.playback_fps = new_fps | ||
|
|
||
| label = widget.findChild(QLabel, "playback_fps_label") | ||
| assert label is not None, "playback_fps_label widget not found." | ||
| assert label.text() == f"Playback FPS: {new_fps}" |
There was a problem hiding this comment.
This test mutates the global napari setting get_settings().application.playback_fps but never restores the previous value. That can make other tests order-dependent (they may see a non-default playback_fps). Save the original playback_fps at the start of the test and restore it in a finally block (or use a fixture) after the assertion.
| new_fps = 42 | |
| get_settings().application.playback_fps = new_fps | |
| label = widget.findChild(QLabel, "playback_fps_label") | |
| assert label is not None, "playback_fps_label widget not found." | |
| assert label.text() == f"Playback FPS: {new_fps}" | |
| original_fps = get_settings().application.playback_fps | |
| new_fps = 42 | |
| try: | |
| get_settings().application.playback_fps = new_fps | |
| label = widget.findChild(QLabel, "playback_fps_label") | |
| assert label is not None, "playback_fps_label widget not found." | |
| assert label.text() == f"Playback FPS: {new_fps}" | |
| finally: | |
| get_settings().application.playback_fps = original_fps |
tests/test_integration/conftest.py
Outdated
| periods=ds.sizes["time"], | ||
| freq=pd.Timedelta(seconds=1), | ||
| ) | ||
| ds.assign_coords(time=timestamps) |
There was a problem hiding this comment.
xarray.Dataset.assign_coords(...) returns a new Dataset and does not modify ds in-place. As written, this fixture returns the original dataset without a DateTimeIndex time coordinate, so the integration tests are not actually exercising the intended datetime-index case. Reassign the result (e.g., ds = ds.assign_coords(...)) before returning.
| ds.assign_coords(time=timestamps) | |
| ds = ds.assign_coords(time=timestamps) |
| (target-zarr)= | ||
| ## Saving and loading with Zarr | ||
|
|
||
| [Zarr](https://zarr.readthedocs.io/en/stable/) is an open format for storing | ||
| chunked, compressed N-dimensional arrays. It is particularly well-suited | ||
| for large datasets and cloud or remote storage. | ||
| Like netCDF, Zarr is natively supported by xarray. | ||
|
|
There was a problem hiding this comment.
This PR is scoped/described as adding a napari Playback FPS label, but this hunk introduces a new Zarr I/O section in the user guide. If Zarr documentation is intended, it should be called out explicitly in the PR description/title (or split into a separate PR) to keep review and release notes accurate.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #877 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 38 38
Lines 2284 2297 +13
=========================================
+ Hits 2284 2297 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
03541c0 to
c3102bf
Compare
c3102bf to
36f0383
Compare
|



Description
What is this PR?
Why is this PR needed?
Users of the napari plugin were confused between two different FPS values:
at which video/pose data was recorded
There was no visual indicator of the current playback fps, causing users to
mistake the acquisition fps as the playback speed. This was raised in Issue #423
and sparked from a discussion during PR #393 review.
What does this PR do?
Adds a new read-only
PlaybackFPSWidgetto the napari plugin that:get_settings().application.playback_fpson init to display thecurrent playback FPS
get_settings().application.events.playback_fpstoreactively update the label whenever the user changes playback speed
QLabelwithobjectName="playback_fps_label"for testabilityMovementMetaWidgetReferences
How has this PR been tested?
Two new unit tests added in
test_data_loader_widget.py:test_playback_fps_widget_instantiationget_settings()on widget creationtest_playback_fps_label_updates_on_fps_changeplayback_fpsfires the event and label text updates correctlyFull verification results:
ruff check movement/napari/pytest -k "fps"(7 tests)pytest tests/test_unit/test_napari_plugin/(102 tests)get_settings()APIIs this a breaking change?
No. This PR only adds a new widget. No existing functionality has been
modified or removed. The acquisition FPS spinbox in the Load panel remains
completely unchanged.
Does this PR require an update to the documentation?
Yes. The user guide should be updated to:
more prominently so users are not confused
Files Changed
movement/napari/loader_widgets.pyPlaybackFPSWidgetclassmovement/napari/meta_widget.pyPlaybackFPSWidgettests/test_unit/test_napari_plugin/test_data_loader_widget.pytests/test_unit/test_napari_plugin/test_meta_widget.pylen == 2Checklist