ShowBragg widget for interactive Bragg-vector analysis - #236
Open
henryhng wants to merge 9 commits into
Open
Conversation
|
This PR is 1 commit behind Fetch that remote and update local |
|
Collaborator
|
Thanks Henry. I think this widget is in the direction. Unlike other widgets like Show2D or Show4DSTEM, this is primarily based on algorithm. Do you have strong tests on those and real-data? We probably also need float precision and algo speed matters too. |
Collaborator
|
Also let's make sure we work with our colleague who would need this widget first. We always want to discuss first either vis github issue or slsck to align in usage so that time for PR effort can be saved |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this solve?
quantem.diffraction.BraggVectorsis a Bragg disk analysis pipeline, but tuning each of those 6 stages requires a manual notebook loop in choosing and adjusting parameters.ShowBraggchanges that workflow and makes it an interactive widget. Lightweight operations like template generation and basis selection update immediately as controls change, while more expensive operations such as disk detection and lattice fitting are triggered by buttons.A live demo of the ShowBragg widget can be found here.
This makes a 4D-STEM dataset and a fitted
BraggVectorsobject interactive in that they can be used to construct aStrainMap, while keeping the scientific workflow in the Python analysis layer.What should reviewer(s) do?
Confirm that a
Dataset4dstemcan be tuned, detected, fitted through the widget.Confirm no scientific state duplicatation (see
src/quantem/widget/showbragg.py)peaks,bvm, andbasisproxy directly towidget.bragginstead of keeping their own widget side copies.Check automatic candidate selection
num_candidates=0derives the candidate count from the data rather than falling back to a fixed value such as 100, which is a change from what was implemented inside quantem.Check mouse dragging
Dragging a basis marker should update local React preview state while the pointer is moving, and commit the new basis to the kernel once on pointer release, as to avoid rerunning
choose_basis_vectorsandindex_peaksfor every pointer event.Verification
Automated tests
PYTHONPATH=src pytest -q tests/showbragg tests/test_choose_lattice.py— 20 passednpm run build— passnpx tsc --noEmit— passnpx vitest run— 169 passedReal-data validation
Tested on a twinned Ag nanowire 4D-STEM dataset:
(100, 30, 144, 144); Dtype:uint8; Scan dimensions: approximately12.5 × 10 nmSelected basis:
g1 = (-2, -11)g2 = (14, -5)Interactive validation
Not yet verified:
Additional changes
While checking the widget against the project UI and performance conventions, this PR also:
subtract mean: oncontrol with a Subtract Mean switch.Scope
This PR adds the interactive
ShowBraggworkflow together with its supporting tests, documentation, and frontend implementation.It does not add a tutorial notebook or corresponding experimental data, or a standalone HTML export. It also does not include new Bragg-detection or lattice-fititng algorithms. The tutorial notebook is planned as a follow-up once the nanowire dataset is available through HuggingFace repository
This PR follows the scikit-package workflow for reproducible scientific software.