Multiple scan XY API Change#51
Conversation
… validation and initial delay handling
… sphinx-tabs for improved layout
…out client.stop_acquisition in test setup
…alidate single frame result
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR updates the deapi client protocol and test suite to better support advanced scanning workflows, most notably multiple XY scan patterns and (commandVer 16) virtual image buffer retrieval, along with documentation and test reliability improvements.
Changes:
- Extend the client scan-pattern API (
set_xy_array) to accept multiple patterns and broaden input handling/validation. - Add client + simulated server support for virtual image buffer metadata/data retrieval (GET_VIRTUAL_IMAGE_INFO / GET_VIRTUAL_IMAGE) and expose
VirtualImageInfo. - Update docs and tests (Sphinx tabs, new scan design doc, fixture scoping, reduced sleeps, skip flaky/slow file tests).
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Add Windows-only dependency and adjust optional test/doc extras. |
| doc/reference/scan_design.rst | New design document describing scan/XY pattern behavior and usage examples. |
| doc/reference/index.rst | Include design document section in reference toctree. |
| doc/conf.py | Enable sphinx_tabs extension for tabbed code examples. |
| deapi/version.py | Change commandVersion definition (now hard-coded). |
| deapi/tests/test_utils/test_utils.py | Refactor gain-reference setup into a session fixture; reduce sleeps/poll instead. |
| deapi/tests/test_scanning/test_continual_scanning.py | Add comprehensive “continual scanning” server tests for repeated/multi-pattern scans and timing edge cases. |
| deapi/tests/test_scanning/init.py | Package marker for scanning tests. |
| deapi/tests/test_file_saving/test_scan_pattern_saving.py | Skip slow/broken scan saving test. |
| deapi/tests/test_file_saving/test_file_loading_rsciio.py | Skip slow/broken RSCIO loading test; remove an extra sleep. |
| deapi/tests/test_file_saving/test_file_loading_libertem.py | Move libertem import into test function. |
| deapi/tests/test_client.py | Adjust fixtures/state handling; update timings and a few property interactions. |
| deapi/tests/conftest.py | Make client fixture session-scoped and remove teardown sleep. |
| deapi/simulated_server/fake_server.py | Implement fake handlers for virtual image buffer info/data commands. |
| deapi/data_types.py | Add VirtualImageInfo type for virtual image buffer metadata/dtype mapping. |
| deapi/client.py | Add virtual image buffer APIs, queue flags in start_acquisition, boolean property normalization, enhance set_xy_array, default pixel_format to AUTO. |
| deapi/init.py | Export VirtualImageInfo from package root. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…e version handling
…ove continual scanning tests
|
Preview for PR #51 |
CoolFanyu
left a comment
There was a problem hiding this comment.
At start_acquisition, need to consider back compatible.
| self.START_ACQUISITION, | ||
| None, | ||
| [number_of_acquisitions, request_movie_buffer], | ||
| [number_of_acquisitions, request_movie_buffer] + vb, |
There was a problem hiding this comment.
Only need to add vb if command versions are greater than 15. Otherwise, it will send more information to the old server which does not support this feature
This pull request introduces several improvements and bug fixes to the
deapiclient and its test suite. The most significant changes are focused on enhancing the flexibility and robustness of scan pattern handling, improving test reliability and performance, and refining property and acquisition management. Below is a summary of the most important changes, grouped by theme.Scan Pattern Handling and Client Improvements:
set_xy_arrayindeapi/client.pyto support lists of numpy arrays, handle both 2D and 3D input, ensure integer types, validate shapes, and correctly compute scan dimensions. This improves flexibility and error handling for scan pattern input.pixel_formatinget_resultto"AUTO"for better compatibility.Test Suite Reliability and Performance:
scope="session"for theclientfixture, reducing setup/teardown overhead and improving test performance.time.sleepcalls and replaced them with more robust idle-waiting logic (e.g.,wait_for_idle(client)), leading to more reliable and faster tests. [1] [2] [3]Test Coverage and Robustness:
File Saving and Loading Tests:
@pytest.mark.skip(reason="Slow and broken")to improve test suite reliability and focus on stable tests. [1] [2]libertem.apiinto the test function to avoid unnecessary imports and potential issues when the library is not available.