quantEM is organized as a core infrastructure package plus one subpackage per experimental modality. Core holds everything shared: data structures, file I/O, visualization, configuration, fitting, and machine learning building blocks. Each modality subpackage then holds the analysis specific to one kind of measurement.
quantem
├── core
│ ├── datastructures
│ ├── io
│ ├── visualization
│ ├── config
│ ├── fitting
│ ├── ml
│ └── utils
├── imaging
├── diffraction
├── diffractive_imaging
├── tomography
└── spectroscopyInside core: datastructures holds the Dataset classes and Vector; io holds the file readers and Zarr serialization; visualization holds show_2d, linescan, colormaps, and scale bars; config holds the global settings for device, precision, and plotting defaults; fitting holds least-squares fitting, backgrounds, and diffraction models; ml holds CNNs, autoencoders, implicit neural representations, loss functions, and distributed training; utils holds array helpers, filters, validators, and random number generation.
The modality subpackages cover, in order: real-space images, diffraction-space measurements, phase retrieval, tilt series, and spectra.
What each modality covers¶
quantem.imaging works on real-space S/TEM images and image series.
drift: measure and correct scan drift and distortion across an image serieslattice: fit atomic lattices and map local lattice distortions
quantem.diffraction works on diffraction patterns, mainly nanobeam and 4D-STEM.
disk_detection,bragg_vectors: locate Bragg disks at each probe position and store them as raggedVectordatastrain,strain_autocorrelation: convert fitted lattice vectors into strain and rotation mapsmodel_fitting: fit a forward model directly to the diffraction patterns, as an alternative to disk detection
quantem.diffractive_imaging recovers phase from 4D-STEM data.
ptychography,ptychography_lite: iterative gradient-based reconstruction, from quick previews to multi-GPU runsdirect_ptychography: non-iterative reconstructioninterchangeable model components:
object_models,probe_models,detector_models,dataset_models,origin_modelsconstraints,optimize_hyperparameters: regularization and Optuna-driven hyperparameter search
quantem.tomography reconstructs 3D volumes from tilt series.
tomography,tomography_lite: reconstruction, including implicit neural representationspreprocess: alignment and preprocessing of the tilt seriesradon: forward and adjoint projection operators
quantem.spectroscopy analyzes spectroscopic signals, principally energy-dispersive X-ray spectroscopy (XEDS) and electron energy loss spectroscopy (EELS).
Import conventions¶
The top-level package re-exports the pieces most workflows need:
import quantem
quantem.io
quantem.datastructures
quantem.visualizationThese give the file readers and load/save, the Dataset classes, and the plotting helpers.
Modality subpackages are imported explicitly, for example:
from quantem.diffractive_imaging import ptychography
from quantem.core import configDatasets carry calibrations¶
All analysis operates on Dataset objects: thin wrappers around an array (NumPy or torch tensor) plus calibration metadata such as sampling, units, origin, name, and signal_units. Dimension-specific subclasses (Dataset2d, Dataset3d, Dataset4d, Dataset4dstem) add modality-specific functionality, and Vector handles ragged point-like data such as detected Bragg peaks. See Datasets & I/O.
Relationship to the tutorials¶
The quantem-tutorials repository contains runnable Jupyter notebooks organized by the same modality names as the subpackages. The User Guide pages in this documentation are condensed versions of those notebooks. For a complete, executable walkthrough with data, use the tutorials.