tiltlib.sample_holder.SampleHolder

class tiltlib.sample_holder.SampleHolder(axes: list[Axis] = None)[source]

Bases: object

__init__(axes: list[Axis] = None) None[source]

Handles the rotation of a sample holder in a TEM. The first axis is always extrinsic.

Parameters:

axes (list[Axis], optional) – Tilt axes, in order, defaults to None

Raises:

ValueError – If axes contains a non-Axis instance

Methods

TEM_frame_to_sample_frame(v)

Convert a vector in TEM coordinates to sample coordinates

__init__([axes])

Handles the rotation of a sample holder in a TEM.

as_matrix()

Returns the 3x3 rotation matrix transforming the TEM coordinate system to the sample holder coordinate system

reset_rotation()

Resets the sample holder to the angles it was initialized with

rotate(*angles[, degrees])

Rotates the sample holder by the given angles from the current position

rotate_to(*angles[, degrees])

Sets the angles of all rotation axes to the given angles

rotation_matrix()

Returns the 3x3 rotation matrix transforming the TEM coordinate system to the sample holder coordinate system

sample_frame_to_TEM_frame(v)

Convert a vector in sample coordinates to TEM coordinates

to_matrix()

Returns the 3x3 rotation matrix transforming the TEM coordinate system to the sample holder coordinate system

Attributes

angles

Current tilt angles, in radians

TEM_frame_to_sample_frame(v: Vector3d) Vector3d[source]

Convert a vector in TEM coordinates to sample coordinates

Parameters:

v (Vector3d) – TEM vector

Returns:

Sample vector

Return type:

Vector3d

property angles: list[float]

Current tilt angles, in radians

as_matrix() ndarray

Returns the 3x3 rotation matrix transforming the TEM coordinate system to the sample holder coordinate system

Returns:

Rotation matrix

Return type:

np.ndarray

reset_rotation()[source]

Resets the sample holder to the angles it was initialized with

rotate(*angles: float, degrees: bool = False)[source]

Rotates the sample holder by the given angles from the current position

Parameters:
  • angles (float) – tilt angles, in order of tilt axes

  • degrees (bool, optional) – Whether angles are in degrees(True) or radians(False), defaults to False

rotate_to(*angles: float, degrees: bool = False)[source]

Sets the angles of all rotation axes to the given angles

Parameters:
  • angles (float) – tilt angles, in order of tilt axes

  • degrees (bool, optional) – Whether angles are in degrees(True) or radians(False), defaults to False

rotation_matrix() ndarray[source]

Returns the 3x3 rotation matrix transforming the TEM coordinate system to the sample holder coordinate system

Returns:

Rotation matrix

Return type:

np.ndarray

sample_frame_to_TEM_frame(v: Vector3d) Vector3d[source]

Convert a vector in sample coordinates to TEM coordinates

Parameters:

v (Vector3d) – Sample vector

Returns:

TEM vector

Return type:

Vector3d

to_matrix() ndarray

Returns the 3x3 rotation matrix transforming the TEM coordinate system to the sample holder coordinate system

Returns:

Rotation matrix

Return type:

np.ndarray