Architecture#
The scatterem package is a stack of layers. Each layer is one or more
subpackages. A module imports only from its own subpackage and from lower
layers. It never imports from a higher layer. Thus the physics does not depend
on the solvers, and the solvers do not depend on plotting or on the paper
datasets.
The core has seven layers, from the forward physics (layer 0) to the
reconstruction methods (layer 6). Three small base layers sit below the core:
settings, rotations and crystals. The paper datasets and the root scatterem
namespace sit above it.
The layers#
Layer |
Subpackages |
What they hold |
|---|---|---|
8 |
|
the root namespace: the FF-STEM entry points, |
7 |
|
the paper datasets, downloaded from Zenodo or Hugging Face on first use |
6 |
|
the reconstruction methods: direct ptychography, tilt-corrected dark field, their fusion, |
5 |
|
internal: one check for a |
4 |
|
forward simulation: PRISM-EELS, BiP-PRISM and the |
3 |
|
|
2 |
|
the 4D-STEM containers, metadata, acquisition fields, calibration and storage |
1 |
|
|
0 |
|
constants, electron optics, atom sets, potentials, transmission functions and propagation |
−1 |
|
elements, phases and CIF reading |
−2 |
|
rotations: quaternions and axis-angle |
−3 |
|
process-wide settings, read by |
The bold rows are the seven core layers. Two subpackages in the same layer do
not import each other. For example, nn does not import vis.
The import rule#
A module in layer n imports from layers below n only. There is one
exception: scatterem.reconstruction reads scatterem.__version__ from the
root namespace, to write it into the run record.
The rule has these results for users:
Import from the subpackage that holds a name, for example
from scatterem.physics.optics import lens_wavefront. The root namespace re-exports only the FF-STEM entry points,Dataset4DStem, the paper datasets andconfigure.A lower layer does not call the higher layers. For example, a potential built with
scatterem.physicsruns no reconstruction code. (An import of any subpackage still runs the rootscatterem/__init__.py, which importsscatterem.reconstruction.)Plotting is optional. Only
visimports matplotlib at import time. A lower layer loads matplotlib only when one of its plotting functions runs.
Where to look#
To do this |
Start in |
|---|---|
Load a paper dataset |
|
Hold, calibrate or bin your own 4D-STEM data |
|
Build atoms, potentials and a probe |
|
Simulate core-loss or elastic STEM data |
|
Reconstruct with FF-STEM |
|
Reconstruct a mixed-state probe |
|
Measure the probe modes |
|
Plot a result |
|
The API reference lists every public name by subpackage.