Skip to content

add Show4DSTEM to_showdiffraction handoff - #211

Draft
henryhng wants to merge 3 commits into
electronmicroscopy:mainfrom
henryhng:handoff
Draft

add Show4DSTEM to_showdiffraction handoff#211
henryhng wants to merge 3 commits into
electronmicroscopy:mainfrom
henryhng:handoff

Conversation

@henryhng

@henryhng henryhng commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Show4DSTEM - to_showdiffraction(source="current", **kwargs) hands the currently displayed diffraction pattern, or the mean pattern over the scan, to a ShowDiffraction widget for indexing and ring/spot detection.

Verification

  • Checks run: pytest tests/test_show4dstem_handoff.py -q -> 2 passed
  • User workflow: build a Show4DSTEM from a synthetic scan, set a scan position, call to_showdiffraction() and to_showdiffraction(source="mean"), transfer k_pixel_size, the k_calibrated flag, and passthrough constructor kwarg
  • Data: synthetic, shape (3, 4, 32, 32), float32, Poisson noise with an injected bright disk, ~49 kB.
  • Backend and hardware: CPU, Python 3.14, linux aarch64. No GPU
  • Load/render/interaction timing: n/a,
  • Evidence artifacts or screenshots: n/a.

Checklist

  • Focused tests added in tests/test_show4dstem_handoff.py covering both sources, calibration transfer, kwarg passthrough, and the invalid-source error. npm run build n/a - no frontend code changed.
  • Before committing, inspect git status --short and git diff --stat; 4 files, +114/-0. No generated HTML, docs builds, screenshots, local notebooks, private data, or machine-specific notes.
  • Only the sections below that this PR touches are kept; the rest are deleted from this description.
Python API and docs — new widget, loader, or API change
  • to_showdiffraction has a NumPy-style docstring with Parameters, Returns, Raises, and Examples, matching the set_path convention in the same module, plus a return annotation. No (row, col) wording is needed; the method exposes no coordinates.
  • Recorded under Unreleased in CHANGELOG.md. Export and README-catalog items are n/a - this adds a method to an already-exported widget, not a new public widget.
  • Documented in docs/api/show4dstem.md under Handing a pattern to ShowDiffraction, and picked up automatically by the autoclass :members: reference block on the same page. A new tutorial notebook is n/a - no new widget or loader is added.
  • n/a.
  • n/a.

@bobleesj

Copy link
Copy Markdown
Collaborator

thanks for this but not recommended in general to bridge within widgets, unless it's sth as simple as Show2D and Show3D, etc. vice versa. Since widget states are exposed as python variables, ShowDiffraction pattern could simply "attune" to that widget state and change accordingly if possible.

@henryhng
henryhng marked this pull request as draft August 11, 2026 14:49
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.

2 participants