Experimental ANS sources in Show4DSTEM#
ANS (asymmetric numeral systems) is the lossless count representation that
quantem.gpu.io.load uses for 4D-STEM acquisitions on CUDA and MPS. The codec,
container validation, CUDA/Metal/WebGPU decoding, and scientific GPU math
belong to quantem.gpu. Show4DSTEM provides the viewer and interaction
policy.
Use matching source revisions of both packages. This is not a PyPI release and
does not establish a stable container or private API compatibility promise.
The backend’s docs/api/qem-python.md and docs/api/qem-codecs.md describe the
QEM file and its codecs; read them in the matching quantem.gpu checkout.
Live viewers#
An acquisition from io.load is already ANS encoded on the GPU, and
Show4DSTEM reads it directly:
from quantem.gpu.io import load
from quantem.widget import Show4DSTEM
loaded = load("acquisition_master.h5")
Show4DSTEM(loaded)
See Show4DSTEM for the live
behavior. These views need a kernel; quantem show4dstem --backend webgpu --html is the offline path, reading the HDF5 family in the browser.