de_twin.render.Renderer#
- class de_twin.render.Renderer(specimen, config=None)[source]#
Bases:
object- Parameters:
config (RenderConfig | None)
- __init__(specimen, config=None)[source]#
- Parameters:
config (RenderConfig | None)
Methods
__init__(specimen[, config])coherent_sampling(optics)The coherent simulation's
Samplingfor these optics.datacube(optics, *[, time_s, model])Noiseless 4D-STEM data: float32 (scan ny, nx, Hd, Wd) at the binned detector shape, electrons per binned pixel per second.
field_map(optics[, layers, time_s, store])(FieldMap, token): rasterise only when view / layers / generation / time change.
ground_truth(optics[, time_s])Per raster pixel (TEM view) or scan point (STEM):
material_id,grain_idand the effective orientationquaternion(orix/diffsims rotation incl.ground_truth_ptychography(optics, *[, time_s])Complex object, probe (modes), scan positions and aberrations of the coherent simulation (see
de_twin.render.coherent.CoherentStem.ground_truth()).Drop every cached raster, frame and pattern (e.g. after the specimen changed).
prefetch(optics[, time_s])Render the TEM view
opticsinto the caches, off the caller's thread: the padded raster and its field map, so asking for that view later is a crop.render(optics, *[, frame_index, scan_point, ...])float32 (ny, nx) = optics.output_shape, electrons / detector pixel / second.
scan_point_for(optics[, frame_index, scan_point])stem_model(optics)The STEM model used for these optics: "coherent" or "kinematic" (
RenderConfig.stem_model, with "auto" resolved; seede_twin.render.coherent).virtual_image(optics, inner_mrad, outer_mrad, *)Annular-detector image over the whole scan, float32 (scan ny, nx), electrons per second collected at each probe position.
warm_up(optics[, max_patterns, budget_s, time_s])Pre-render the most used STEM patterns of the current view (C++ WarmUpCache).
Attributes
- property crystallinity#
- field_map(optics, layers=frozenset({}), time_s=0.0, store=None)[source]#
(FieldMap, token): rasterise only when view / layers / generation / time change.
store: the cache to use (default the renderer’s; previews keep their own, so they do not push out the full-resolution field maps a stage move reuses).
- invalidate()[source]#
Drop every cached raster, frame and pattern (e.g. after the specimen changed).
- Return type:
None
- render(optics, *, frame_index=0, scan_point=None, time_s=0.0)[source]#
float32 (ny, nx) = optics.output_shape, electrons / detector pixel / second.
Returns zeros when the beam is blanked (the caller may map that to
flux=None).
- prefetch(optics, time_s=0.0)[source]#
Render the TEM view
opticsinto the caches, off the caller’s thread: the padded raster and its field map, so asking for that view later is a crop. The heavy work runs without the renderer’s lock (a live frame is not held up); only looking up and storing take it. Coherent 4D-STEM: the probe, transmission tile and first block of patterns. Returns whether anything was rendered.
- stem_model(optics)[source]#
The STEM model used for these optics: “coherent” or “kinematic” (
RenderConfig.stem_model, with “auto” resolved; seede_twin.render.coherent).- Return type:
- datacube(optics, *, time_s=0.0, model=None)[source]#
Noiseless 4D-STEM data: float32 (scan ny, nx, Hd, Wd) at the binned detector shape, electrons per binned pixel per second.
- ground_truth_ptychography(optics, *, time_s=0.0)[source]#
Complex object, probe (modes), scan positions and aberrations of the coherent simulation (see
de_twin.render.coherent.CoherentStem.ground_truth()).
- virtual_image(optics, inner_mrad, outer_mrad, *, time_s=0.0)[source]#
Annular-detector image over the whole scan, float32 (scan ny, nx), electrons per second collected at each probe position.
BF:
(0, convergence); ADF/HAADF: e.g.(40, 200). Uses the field map and the pattern specs directly - no per-point CBED is rendered.
- warm_up(optics, max_patterns=None, budget_s=0.5, time_s=0.0)[source]#
Pre-render the most used STEM patterns of the current view (C++ WarmUpCache).
- ground_truth(optics, time_s=0.0)[source]#
Per raster pixel (TEM view) or scan point (STEM):
material_id,grain_idand the effective orientationquaternion(orix/diffsims rotation incl. the stage tilt; identity where there is no crystal), plusthickness_nm.