de_twin.column.Column#

class de_twin.column.Column(state=None, *, clock=None, instrument_type=None, allow_ht=False, stage_speed_um_s=100.0, tilt_speed_deg_s=10.0, stage_limits=(2000.0, 2000.0, 500.0, 70.0, 30.0), corrector=None, seed=0, corrector_options=None)[source]#

Bases: object

A simulated column. Thread-safe (self.lock is an RLock).

Parameters:
  • state (MicroscopeState | None) – Initial state (defaults: MicroscopeState defaults, i.e. 200 kV, MAG1 20 kx, screen up so the camera sees the beam).

  • clock – Callable returning seconds, or an object with now() (de_twin.clock.Clock). Stage motion is interpolated on this clock; a virtual clock fast-forwards it.

  • instrument_type (str | None) – Vendor string reported as INSTRUMENT_Type (“JEOL” default, or “FEI”).

  • allow_ht (bool) – Permit high-tension / filament writes (refused by default).

  • stage_speed_um_s (float) – Stage dynamics; stage_speed_um_s=float('inf') makes moves instantaneous.

  • tilt_speed_deg_s (float) – Stage dynamics; stage_speed_um_s=float('inf') makes moves instantaneous.

  • stage_limits (Iterable[float]) – Stage dynamics; stage_speed_um_s=float('inf') makes moves instantaneous.

  • corrector (str | None) – None / "none" (default; or state.corrector), "probe", "image" or "both": fit a CEOS-like aberration corrector (self.corrector).

  • seed (int) – Seeds the corrector’s native aberrations, tune, drift and noise.

  • corrector_options (dict | None) – Extra keyword arguments for Corrector (tuned=False for a cold start, drift_rates={...}, served="image").

__init__(state=None, *, clock=None, instrument_type=None, allow_ht=False, stage_speed_um_s=100.0, tilt_speed_deg_s=10.0, stage_limits=(2000.0, 2000.0, 500.0, 70.0, 30.0), corrector=None, seed=0, corrector_options=None)[source]#
Parameters:

Methods

__init__([state, clock, instrument_type, ...])

cl_ladder()

Camera lengths in mm of the active optics mode (empty in TEM imaging).

close()

Nothing to release for a simulated column.

convergence_mrad()

get(name)

Read a property by its DE-TEM-Channel name (see the module docstring).

mag_ladder()

Magnifications a Magnification write can reach from here (empty in TEM diffraction).

move_stage([x, y, z, alpha, beta, wait, timeout])

now()

on_change(callback)

Call callback(name, value) after every accepted write (outside the lock).

op_state()

DE-TEM-Channel OperationState: 1 running while the stage moves, else the last set's.

property_names()

set(name, value)

Write a property by its DE-TEM-Channel name.

set_alpha_selector(alpha)

set_beam_blank(blanked)

set_beam_shift_um(x, y)

set_beam_tilt_mrad(x, y)

set_camera_length_cm(cm)

set_camera_length_mm(mm)

set_column_valves(open_)

set_condenser_aperture(index)

set_condenser_stig(x, y)

set_convergence_mrad(mrad)

set_defocus_um(um)

set_diffraction_shift_mrad(x, y)

set_function_mode(mode)

Raw vendor function mode, or a JEOL name ("MAG1", "LowMAG", "DIFF", ...).

set_ht_kv(kv)

set_image_shift_um(x, y)

set_instrument_type(vendor)

set_intensity(value)

set_magnification(magnification)

set_magnification_index(index)

set_objective_stig(x, y)

set_probe_mode(mode)

set_projection(mode)

set_screen(down)

set_spot_size(spot)

set_stage([x, y, z, alpha, beta])

Start a stage move (non-blocking; see wait_idle()).

set_tem_stem(mode)

stage_position()

stage_target()

state()

Snapshot, with the stage interpolated to now.

stop()

Freeze the stage wherever its trajectory has reached (stopStage).

time_to_idle()

Clock seconds until the stage has arrived (0 when idle).

values()

Every readable property.

wait_idle([timeout])

Block until the stage has arrived.

Attributes

busy

function_mode

Raw JEOL function mode 0..4 (MAG1, MAG2, LowMAG, SAMAG, DIFF).

instrument_type

on_change(callback)[source]#

Call callback(name, value) after every accepted write (outside the lock).

Parameters:

callback (Callable[[str, Any], None])

Return type:

None

now()[source]#
Return type:

float

property instrument_type: str#
property function_mode: int#

Raw JEOL function mode 0..4 (MAG1, MAG2, LowMAG, SAMAG, DIFF).

mag_ladder()[source]#

Magnifications a Magnification write can reach from here (empty in TEM diffraction). In TEM imaging that is LowMAG’s and MAG1’s together: a write beyond the active mode’s ladder crosses into the other (imaging_mode_for), as a real column’s mag knob does, so a client stepping this ladder is not stuck at the top of LowMAG.

Return type:

Ladder

cl_ladder()[source]#

Camera lengths in mm of the active optics mode (empty in TEM imaging).

Return type:

Ladder

time_to_idle()[source]#

Clock seconds until the stage has arrived (0 when idle).

Return type:

float

property busy: bool#
convergence_mrad()[source]#
Return type:

float

state()[source]#

Snapshot, with the stage interpolated to now.

Return type:

MicroscopeState

op_state()[source]#

DE-TEM-Channel OperationState: 1 running while the stage moves, else the last set’s.

Return type:

int

stage_position()[source]#
Return type:

tuple[float, float, float, float, float]

stage_target()[source]#
Return type:

tuple[float, float, float, float, float]

get(name)[source]#

Read a property by its DE-TEM-Channel name (see the module docstring).

Parameters:

name (str)

Return type:

Any

values()[source]#

Every readable property.

Return type:

dict[str, Any]

static property_names()[source]#
Return type:

list[str]

set(name, value)[source]#

Write a property by its DE-TEM-Channel name. Raises ColumnRefused.

Parameters:
Return type:

None

set_magnification(magnification)[source]#
Parameters:

magnification (float)

Return type:

None

set_magnification_index(index)[source]#
Parameters:

index (int)

Return type:

None

set_camera_length_mm(mm)[source]#
Parameters:

mm (float)

Return type:

None

set_camera_length_cm(cm)[source]#
Parameters:

cm (float)

Return type:

None

set_defocus_um(um)[source]#
Parameters:

um (float)

Return type:

None

set_spot_size(spot)[source]#
Parameters:

spot (int)

Return type:

None

set_probe_mode(mode)[source]#
Return type:

None

set_alpha_selector(alpha)[source]#
Parameters:

alpha (int)

Return type:

None

set_convergence_mrad(mrad)[source]#
Parameters:

mrad (float)

Return type:

None

set_condenser_aperture(index)[source]#
Parameters:

index (int)

Return type:

None

set_intensity(value)[source]#
Parameters:

value (float)

Return type:

None

set_image_shift_um(x, y)[source]#
Parameters:
Return type:

None

set_beam_shift_um(x, y)[source]#
Parameters:
Return type:

None

set_beam_tilt_mrad(x, y)[source]#
Parameters:
Return type:

None

set_diffraction_shift_mrad(x, y)[source]#
Parameters:
Return type:

None

set_objective_stig(x, y)[source]#
Parameters:
Return type:

None

set_condenser_stig(x, y)[source]#
Parameters:
Return type:

None

set_stage(x=None, y=None, z=None, alpha=None, beta=None)[source]#

Start a stage move (non-blocking; see wait_idle()). um / degrees.

Return type:

None

move_stage(x=None, y=None, z=None, alpha=None, beta=None, *, wait=True, timeout=None)[source]#
Parameters:
Return type:

bool

set_tem_stem(mode)[source]#
Return type:

None

set_projection(mode)[source]#
Return type:

None

set_function_mode(mode)[source]#

Raw vendor function mode, or a JEOL name (“MAG1”, “LowMAG”, “DIFF”, …).

Return type:

None

set_beam_blank(blanked)[source]#
Parameters:

blanked (bool)

Return type:

None

set_screen(down)[source]#
Parameters:

down (bool)

Return type:

None

set_column_valves(open_)[source]#
Parameters:

open_ (bool)

Return type:

None

set_ht_kv(kv)[source]#
Parameters:

kv (float)

Return type:

None

set_instrument_type(vendor)[source]#
Parameters:

vendor (str)

Return type:

None

stop()[source]#

Freeze the stage wherever its trajectory has reached (stopStage).

Return type:

None

wait_idle(timeout=None)[source]#

Block until the stage has arrived. Uses clock.sleep when the clock has one, so a ManualClock is simply advanced. timeout in clock seconds.

Parameters:

timeout (float | None)

Return type:

bool

close()[source]#

Nothing to release for a simulated column.

Return type:

None