core#

Frame conventions, physical constants and coordinate maps shared package-wide.

Functions

electron_wavelength_nm(voltage_kv[, v0mod])

Relativistic electron wavelength in nm (EMsoft CalcWaveLength).

interaction_constant(voltage_kv[, v0mod])

Interaction constant sigma in (V nm)^-1 (EMsoft Sigma).

master_pattern_grid(npx[, device, dtype])

Northern-hemisphere unit vectors for every master pattern pixel.

quaternion_to_matrix(q)

Unit quaternions (..., 4), order (a, b, c, d), to matrices (..., 3, 3).

relativistic_correction(voltage_kv)

Relativistic correction factor gamma = 1 + e V / (m0 c^2).

rotate_vectors(q, v)

Rotate vectors v (..., P, 3) by quaternions q (..., 4).

sample_to_detector_matrix(sample_tilt, tilt, ...)

Rows are the detector basis (X_d, Y_d, Z_d) in sample coordinates.

sample_to_detector_tensor(detector, device, ...)

sample_to_detector_matrix() for a detector, as a torch tensor.

sphere_to_square(v[, eps])

Unit vectors (..., 3) to square Lambert coordinates (..., 2), book units.

square_to_sphere(xy[, eps])

Square Lambert coordinates (..., 2, book units) to unit vectors (..., 3).