Skip to content

ShowDiffraction tutorial, CLI integration - #195

Open
henryhng wants to merge 487 commits into
electronmicroscopy:mainfrom
henryhng:tutorial
Open

ShowDiffraction tutorial, CLI integration#195
henryhng wants to merge 487 commits into
electronmicroscopy:mainfrom
henryhng:tutorial

Conversation

@henryhng

@henryhng henryhng commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

No description provided.

bobleesj and others added 30 commits July 4, 2026 12:47
The LRU paging engine (Dataset5dstem.page/frame/vram_resident) existed but
was never called on dataset switch, so a many-master folder loaded every 4D
dataset into VRAM at once and switching the slider did not free the old one -
VRAM filled and stayed full.

Now: new page_budget kwarg on Show4DSTEM. When set on a multi-dataset
Dataset5dstem, __init__ enables page(page_budget) and the per-frame accessors
(_frame_data, _virtual_image_for_frame, the histogram-init frame) go through
.frame(idx) instead of [idx]. Switching the slider pages the target dataset
onto the GPU and evicts the least-recently-used one to RAM, so only
page_budget datasets are ever resident and the footprint stays flat.

Default (page_budget=None) is unchanged: every dataset stays resident for
instant switching. .frame() is identical to [idx] when paging is off, so the
single-dataset and plain-5D-tensor paths are untouched.

Tested: 33 existing 4dstem/dataset5dstem tests pass, real gold_512
single-dataset Show4DSTEM unchanged, + new tests/test_show4dstem_paging.py
(no-budget=all-resident, budget=1 evicts LRU with flat VRAM, budget=2 keeps 2).
…ged viewer

ShowFolder had Open Show2D/Show3D/both but no 4D handoff, so a folder of
*_master.h5 scans could not be opened as Show4DSTEM. New:

- ShowFolderBrowser.open_show4dstem(gpus=, page_budget=, det_bin=, dtype=,
  scan_size=): discovers every ready master in the folder, loads each round-
  robin across gpus (one dataset per card = N x capacity), wraps them in a
  Dataset5dstem, and builds Show4DSTEM(page_budget=...). Switching the dataset
  slider pages the target onto the GPU and evicts the least-recently-used one
  to RAM (the paging wired in 090a4f1), so a 40-master folder never fills VRAM.
- 'Open Show4DSTEM' button in the selection panel; defaults gpus=current,
  page_budget=1 so switching always evicts. Half-written masters (missing
  sibling data files) are skipped so a live acquisition folder is safe.

Tested end-to-end: 41 real PE-5 masters -> one Show4DSTEM, page_budget=1 keeps
1 resident, switching evicts (resident [0]->[2]). 46 existing showfolder/4dstem
tests pass. New tests: multi-master paged build (mocked io) + no-masters None.
bobleesj and others added 29 commits July 11, 2026 22:06
…er toggle reveals its settings row like Denoise (Show2D + Show3D)
…lider no longer disabled when mode is none); Show2D + Show3D
…boxes from a duplicate menu on the same anchor
…te keeps denoise ON (was gated off in exports; also fixes More badge undercount)
…stale-array fallback broadcast v; now fills neutral, preserves per-panel values)
# Conflicts:
#	CHANGELOG.md
#	README.md
#	docs/tutorials/showdiffraction.ipynb
@henryhng henryhng changed the title ShowDiffraction tutorial, CLI integration- #167 ShowDiffraction tutorial, CLI integration Aug 5, 2026
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