de_twin.optics.Calibration#

class de_twin.optics.Calibration(projects, *, reference_pixel_um=None, ht_scale=None, tolerance=0.005, stem_scan_span_v=1.0, stem_fov_nm_at_1x=128000000.0, name='custom')[source]#

Bases: object

Magnification -> nm/px and camera length -> 1/nm/px, per mag mode.

Parameters:
  • projects (list[MagProject])

  • reference_pixel_um (float | None)

  • ht_scale (dict | None)

  • tolerance (float)

  • stem_scan_span_v (float)

  • stem_fov_nm_at_1x (float)

  • name (str)

__init__(projects, *, reference_pixel_um=None, ht_scale=None, tolerance=0.005, stem_scan_span_v=1.0, stem_fov_nm_at_1x=128000000.0, name='custom')[source]#
Parameters:
  • projects (list[MagProject])

  • reference_pixel_um (float | None)

  • ht_scale (dict | None)

  • tolerance (float)

  • stem_scan_span_v (float)

  • stem_fov_nm_at_1x (float)

  • name (str)

Methods

__init__(projects, *[, reference_pixel_um, ...])

cl_ladder([tem_stem])

Camera lengths in mm (the twin's unit; mag.yaml stores cm).

default()

Built-in JEOL-like ladders, computed geometrically.

from_mag_yaml(path, *[, reference_pixel_um, ...])

Load a DE-Server mag.yaml (tabs tolerated) and optionally an ht_table_*.yaml.

geometric_recip_inv_nm(state, camera[, ...])

mag_ladder([mode, tem_stem])

mag_modes([tem_stem])

project_for(state[, want_cl])

recip_pixel_inv_nm(state, camera)

1/nm per unbinned detector pixel in diffraction; 0.0 = not calibrated.

snap_cl(cl_mm[, tem_stem])

snap_mag(mode, magnification[, tem_stem])

specimen_pixel_nm(state, camera)

nm of specimen per unbinned detector pixel (TEM imaging); 0.0 = not calibrated.

stem_step_nm(state, scan_size)

nm per scan point for a (nx, ny) scan; 0.0 = not calibrated.

classmethod from_mag_yaml(path, *, reference_pixel_um=None, ht_table=None, tolerance=0.005)[source]#

Load a DE-Server mag.yaml (tabs tolerated) and optionally an ht_table_*.yaml.

Parameters:
  • reference_pixel_um (float | None)

  • tolerance (float)

Return type:

Calibration

classmethod default()[source]#

Built-in JEOL-like ladders, computed geometrically.

Tables are nm per 1-um pixel (1000 / mag) and are scaled by the camera’s pixel pitch, so 20 kx on a 6.5 um pixel is 0.325 nm/px. Camera lengths are geometric (None entries). A camera behind a post-column magnification is OpticsConfig.post_magnification: the calibration is what the column believes.

Return type:

Calibration

project_for(state, want_cl=False)[source]#
Parameters:
Return type:

MagProject | None

specimen_pixel_nm(state, camera)[source]#

nm of specimen per unbinned detector pixel (TEM imaging); 0.0 = not calibrated.

Parameters:

state (MicroscopeState)

Return type:

float

recip_pixel_inv_nm(state, camera)[source]#

1/nm per unbinned detector pixel in diffraction; 0.0 = not calibrated.

Geometric entries use mrad/px = pixel_um / CL_mm and 1/nm = mrad / (1000 lambda).

Parameters:

state (MicroscopeState)

Return type:

float

static geometric_recip_inv_nm(state, camera, camera_length_mm=0.0)[source]#
Parameters:
Return type:

float

stem_step_nm(state, scan_size)[source]#

nm per scan point for a (nx, ny) scan; 0.0 = not calibrated.

Parameters:
Return type:

float

mag_modes(tem_stem=0)[source]#
Parameters:

tem_stem (int)

Return type:

list[str]

mag_ladder(mode='MAG1', tem_stem=0)[source]#
Parameters:
  • mode (str | None)

  • tem_stem (int)

Return type:

Ladder

cl_ladder(tem_stem=0)[source]#

Camera lengths in mm (the twin’s unit; mag.yaml stores cm).

Parameters:

tem_stem (int)

Return type:

Ladder

snap_mag(mode, magnification, tem_stem=0)[source]#
Parameters:
  • mode (str | None)

  • magnification (float)

  • tem_stem (int)

Return type:

float

snap_cl(cl_mm, tem_stem=0)[source]#
Parameters:
Return type:

float