de_twin.render.RenderConfig#
- class de_twin.render.RenderConfig(diffraction_contrast_scale: 'float' = 1.0, mip_phase: 'bool' = True, edge_taper_nm: 'float' = 1.0, refraction_loss: 'bool' = True, phase_texture_scale: 'float' = 1.0, texture_bandlimit_nm: 'float' = 0.07, amplitude_contrast: 'float' = 0.07, lattice_fringes: 'bool' = True, lattice_fringe_model: 'str' = 'kinematic', lattice_fringe_efficiency: 'float' = 0.5, lattice_phase_rad: 'float' = 0.15, pan_margin: 'float' = 0.15, adaptive_margin: 'bool' = True, min_margin_px: 'int' = 64, max_margin_px: 'int' = 256, pan_cache_size: 'int' = 6, reuse_rasters: 'bool' = True, reuse_min_overlap: 'float' = 0.25, raster_threads: 'int' = 4, interactive: 'bool' = False, prefetch: 'bool' = False, preview_side: 'int' = 256, settle_s: 'float' = 0.3, illumination_profile: 'bool' = True, texture_seed_salt: 'int' = 32343, diffraction_cache_mb: 'int' = 256, max_g_inv_nm: 'float' = 25.0, film_halo: 'bool' = True, scaled_diffraction_saturation: 'bool' = True, diffuse_scattering: 'bool' = True, beam_stop_radius_px: 'float' = 0.0, probe_footprint_blend: 'bool' = True, add_descan: 'bool' = False, descan_ramp_scale: 'float' = 1.0, descan_ramp_px: 'tuple[float, float, float]' = (6.0, 4.0, 4.0), intensity_jitter: 'bool' = True, park_on_feature: 'bool' = False, stem_model: 'str' = 'auto', coherent_max_grid: 'int' = 1024, coherent_auto_max_pattern_px: 'int' = 65536, coherent_probe_tail: 'float' = 6.0, coherent_mode_power: 'float' = 0.98, coherent_max_modes: 'int' = 4, coherent_focal_samples: 'int' = 0, coherent_focal_spread: 'bool' = True, coherent_source_size: 'bool' = True, coherent_beam_tilt: 'bool' = True, coherent_incoherent_scattering: 'bool' = True, coherent_object_bandwidth_inv_nm: 'float' = 0.0, coherent_field_max_px: 'int' = 8000000, coherent_cache_mb: 'int' = 64, coherent_read_ahead: 'int' = 2, fieldmap_cache_size: 'int' = 4, time_quantum_s: 'float' = 0.1)[source]#
Bases:
object- Parameters:
diffraction_contrast_scale (float)
mip_phase (bool)
edge_taper_nm (float)
refraction_loss (bool)
phase_texture_scale (float)
texture_bandlimit_nm (float)
amplitude_contrast (float)
lattice_fringes (bool)
lattice_fringe_model (str)
lattice_fringe_efficiency (float)
lattice_phase_rad (float)
pan_margin (float)
adaptive_margin (bool)
min_margin_px (int)
max_margin_px (int)
pan_cache_size (int)
reuse_rasters (bool)
reuse_min_overlap (float)
raster_threads (int)
interactive (bool)
prefetch (bool)
preview_side (int)
settle_s (float)
illumination_profile (bool)
texture_seed_salt (int)
diffraction_cache_mb (int)
max_g_inv_nm (float)
film_halo (bool)
scaled_diffraction_saturation (bool)
diffuse_scattering (bool)
beam_stop_radius_px (float)
probe_footprint_blend (bool)
add_descan (bool)
descan_ramp_scale (float)
intensity_jitter (bool)
park_on_feature (bool)
stem_model (str)
coherent_max_grid (int)
coherent_auto_max_pattern_px (int)
coherent_probe_tail (float)
coherent_mode_power (float)
coherent_max_modes (int)
coherent_focal_samples (int)
coherent_focal_spread (bool)
coherent_source_size (bool)
coherent_beam_tilt (bool)
coherent_incoherent_scattering (bool)
coherent_object_bandwidth_inv_nm (float)
coherent_field_max_px (int)
coherent_cache_mb (int)
coherent_read_ahead (int)
fieldmap_cache_size (int)
time_quantum_s (float)
- __init__(diffraction_contrast_scale=1.0, mip_phase=True, edge_taper_nm=1.0, refraction_loss=True, phase_texture_scale=1.0, texture_bandlimit_nm=0.07, amplitude_contrast=0.07, lattice_fringes=True, lattice_fringe_model='kinematic', lattice_fringe_efficiency=0.5, lattice_phase_rad=0.15, pan_margin=0.15, adaptive_margin=True, min_margin_px=64, max_margin_px=256, pan_cache_size=6, reuse_rasters=True, reuse_min_overlap=0.25, raster_threads=4, interactive=False, prefetch=False, preview_side=256, settle_s=0.3, illumination_profile=True, texture_seed_salt=32343, diffraction_cache_mb=256, max_g_inv_nm=25.0, film_halo=True, scaled_diffraction_saturation=True, diffuse_scattering=True, beam_stop_radius_px=0.0, probe_footprint_blend=True, add_descan=False, descan_ramp_scale=1.0, descan_ramp_px=(6.0, 4.0, 4.0), intensity_jitter=True, park_on_feature=False, stem_model='auto', coherent_max_grid=1024, coherent_auto_max_pattern_px=65536, coherent_probe_tail=6.0, coherent_mode_power=0.98, coherent_max_modes=4, coherent_focal_samples=0, coherent_focal_spread=True, coherent_source_size=True, coherent_beam_tilt=True, coherent_incoherent_scattering=True, coherent_object_bandwidth_inv_nm=0.0, coherent_field_max_px=8000000, coherent_cache_mb=64, coherent_read_ahead=2, fieldmap_cache_size=4, time_quantum_s=0.1)#
- Parameters:
diffraction_contrast_scale (float)
mip_phase (bool)
edge_taper_nm (float)
refraction_loss (bool)
phase_texture_scale (float)
texture_bandlimit_nm (float)
amplitude_contrast (float)
lattice_fringes (bool)
lattice_fringe_model (str)
lattice_fringe_efficiency (float)
lattice_phase_rad (float)
pan_margin (float)
adaptive_margin (bool)
min_margin_px (int)
max_margin_px (int)
pan_cache_size (int)
reuse_rasters (bool)
reuse_min_overlap (float)
raster_threads (int)
interactive (bool)
prefetch (bool)
preview_side (int)
settle_s (float)
illumination_profile (bool)
texture_seed_salt (int)
diffraction_cache_mb (int)
max_g_inv_nm (float)
film_halo (bool)
scaled_diffraction_saturation (bool)
diffuse_scattering (bool)
beam_stop_radius_px (float)
probe_footprint_blend (bool)
add_descan (bool)
descan_ramp_scale (float)
intensity_jitter (bool)
park_on_feature (bool)
stem_model (str)
coherent_max_grid (int)
coherent_auto_max_pattern_px (int)
coherent_probe_tail (float)
coherent_mode_power (float)
coherent_max_modes (int)
coherent_focal_samples (int)
coherent_focal_spread (bool)
coherent_source_size (bool)
coherent_beam_tilt (bool)
coherent_incoherent_scattering (bool)
coherent_object_bandwidth_inv_nm (float)
coherent_field_max_px (int)
coherent_cache_mb (int)
coherent_read_ahead (int)
fieldmap_cache_size (int)
time_quantum_s (float)
- Return type:
None
Methods
__init__([diffraction_contrast_scale, ...])Attributes
Pad by the objective's point spread instead (renderer.transfer_spread_px, x1.3, rounded up to one of a few guard sizes,
min_margin_pxtomax_margin_px): a smaller raster and FFT near focus and at low magnification, a wider guard at large defocus and high magnification.while the view keeps changing, a view the cache cannot crop is rendered at up to
preview_sidesquared and upsampled (~35-70 ms rather than ~0.3-0.9 s); the first time the same view is asked for again — the next frame after you stop — it is rendered in full.what dynamical scattering (saturation in thick, heavy crystals), vibration, drift and the recording take from the fringes.
each resolved beam that reaches the image is a phase grating of its own kinematic strength, a = sqrt(2 f) for a Friedel pair carrying f of the electrons, grown with the thickness (heavy crystals give strong fringes, light ones weak), up to its MAX_FRINGE_BEAMS strongest pairs.
Padded rasters kept for cropping (a jump back to a recent place is a crop too).
TEM imaging renders a view this fraction of the field larger on each side and serves a stage move that stays inside the margin by cropping it: the image moves rigidly with the specimen, so a joystick nudge costs a crop, not a render.
after each new view, render the view that repeating the last change would give (the next magnification rung, tilt, focus or stage step) in the background, so stepping through a series is a crop.
Threads a large raster is rasterised on, in row strips (1 = serial).
A new padded raster takes the specimen it shares with a cached one (same sampling, on the same world-fixed pixel lattice) from that one's field map when they overlap by at least
reuse_min_overlapof its area, and rasterises only the rest.How long (wall-clock seconds) the view must stay put before it counts as stopped and is rendered in full.
- lattice_fringe_model: str = 'kinematic'#
each resolved beam that reaches the image is a phase grating of its own kinematic strength, a = sqrt(2 f) for a Friedel pair carrying f of the electrons, grown with the thickness (heavy crystals give strong fringes, light ones weak), up to its MAX_FRINGE_BEAMS strongest pairs. “fixed”: every crystal’s fringes share a total phase lattice_phase_rad (the older model).
- Type:
“kinematic”
- lattice_fringe_efficiency: float = 0.5#
what dynamical scattering (saturation in thick, heavy crystals), vibration, drift and the recording take from the fringes. Calibrated on Ted Pella’s lattice images (646 Au [001], 675 Si <011>: fringe contrast 27 % and 34 %, twice the kinematic value).
- Type:
The kinematic amplitude times this
- pan_margin: float = 0.15#
TEM imaging renders a view this fraction of the field larger on each side and serves a stage move that stays inside the margin by cropping it: the image moves rigidly with the specimen, so a joystick nudge costs a crop, not a render. 0 off.
- adaptive_margin: bool = True#
Pad by the objective’s point spread instead (renderer.transfer_spread_px, x1.3, rounded up to one of a few guard sizes,
min_margin_pxtomax_margin_px): a smaller raster and FFT near focus and at low magnification, a wider guard at large defocus and high magnification.pan_marginis then unused.
- pan_cache_size: int = 6#
Padded rasters kept for cropping (a jump back to a recent place is a crop too).
- reuse_rasters: bool = True#
A new padded raster takes the specimen it shares with a cached one (same sampling, on the same world-fixed pixel lattice) from that one’s field map when they overlap by at least
reuse_min_overlapof its area, and rasterises only the rest.
- raster_threads: int = 4#
Threads a large raster is rasterised on, in row strips (1 = serial). Each strip’s numba kernels get the matching share of numba’s threads.
- interactive: bool = False#
while the view keeps changing, a view the cache cannot crop is rendered at up to
preview_sidesquared and upsampled (~35-70 ms rather than ~0.3-0.9 s); the first time the same view is asked for again — the next frame after you stop — it is rendered in full. Off by default, so a library caller always gets the full render.- Type:
Interactive use (dragging the stage, zooming)
- prefetch: bool = False#
after each new view, render the view that repeating the last change would give (the next magnification rung, tilt, focus or stage step) in the background, so stepping through a series is a crop. One view at a time; the latest wins.
- Type:
Live view