Skip to content

Representing poses¤

cryojax provides different parameterizations for the pose of a structure. These are captured through the abstract base class called AbstractPose.

cryojax.simulator.AbstractPose

cryojax.simulator.AbstractPose ¤

Base class for the image pose. Subclasses will choose a particular convention for parameterizing the rotation by overwriting the AbstractPose.rotation property.

Info

Angular quantities in cryojax are always in degrees. Therefore concrete classes of the AbstractPose have angles in degrees, e.g.

import cryojax.simulator as cxs

phi_in_degrees, theta_in_degrees, psi_in_degrees = 10.0, 30.0, 40.0
pose = cxs.EulerAnglePose(
    phi_angle=phi_in_degrees,
    theta_angle=theta_in_degrees,
    psi_angle=psi_in_degrees,
)
cryojax.simulator.AbstractPose.compute_shifts(frequency_grid_in_angstroms: Float[Array, 'y_dim x_dim 2']) -> Complex[Array, 'y_dim x_dim'] ¤

Compute the phase shifts from the in-plane translation, given a frequency grid coordinate system.

Arguments:

  • frequency_grid_in_angstroms: A grid of in-plane frequency coordinates \((q_x, q_y)\)

Returns:

From the vector \((t_x, t_y)\) (given by self.offset_in_angstroms), returns the grid of in-plane phase shifts \(\exp{(- 2 \pi i (t_x q_x + t_y q_y))}\).

cryojax.simulator.AbstractPose.rotate_coordinates(coordinate_grid_or_list: Float[Array, 'z_dim y_dim x_dim 3'] | Float[Array, 'size 3'], inverse: bool = False) -> Float[Array, 'z_dim y_dim x_dim 3'] | Float[Array, 'size 3'] ¤

Rotate a 3D coordinate system.

Arguments:

  • coordinate_grid_or_list: The 3D coordinate system to rotate. This can either be a list of coordinates of shape (N, 3) or a grid of coordinates (N1, N2, N3, 3).
  • inverse: If True, compute the inverse rotation (i.e. rotation by the matrix \(R^T\), where \(R\) is the rotation matrix).

Returns:

The rotated version of coordinate_grid_or_list.

cryojax.simulator.AbstractPose.offset_in_angstroms: Float[Array, 2] cached property ¤

The in-plane translation vector, where the origin in taken to be in the center of the imaging plane.

cryojax.simulator.AbstractPose.rotation: SO3 abstractmethod cached property ¤

Generate an SO3 object from a particular angular parameterization.

cryojax.simulator.AbstractPose.from_rotation(rotation: SO3) -> Self abstractmethod classmethod ¤

Construct an AbstractPose from an SO3 object.

cryojax.simulator.AbstractPose.from_rotation_and_translation(rotation: SO3, offset_in_angstroms: Float[Array, 2]) -> Self classmethod ¤

Construct an AbstractPose from an SO3 object and an in-plane translation vector.

cryojax.simulator.EulerAnglePose ¤

An AbstractPose represented by Euler angles. Angles are given in degrees, and the sequence of rotations is given by a zyz extrinsic rotations.

cryojax.simulator.EulerAnglePose.__init__(offset_x_in_angstroms: float | Float[Array, ''] = 0.0, offset_y_in_angstroms: float | Float[Array, ''] = 0.0, phi_angle: float | Float[Array, ''] = 0.0, theta_angle: float | Float[Array, ''] = 0.0, psi_angle: float | Float[Array, ''] = 0.0) ¤

Arguments:

  • offset_x_in_angstroms: In-plane translation in x direction.
  • offset_y_in_angstroms: In-plane translation in y direction.
  • phi_angle: Angle to rotate about first rotation axis, which is the z axis.
  • theta_angle: Angle to rotate about second rotation axis, which is the y axis.
  • psi_angle: Angle to rotate about third rotation axis, which is the z axis.

cryojax.simulator.QuaternionPose ¤

An AbstractPose represented by unit quaternions.

cryojax.simulator.QuaternionPose.__init__(offset_x_in_angstroms: float | Float[Array, ''] = 0.0, offset_y_in_angstroms: float | Float[Array, ''] = 0.0, wxyz: tuple[float, float, float, float] | Float[np.ndarray, 4] | Float[Array, 4] = (1.0, 0.0, 0.0, 0.0)) ¤

Arguments:

  • offset_x_in_angstroms: In-plane translation in x direction.
  • offset_y_in_angstroms: In-plane translation in y direction.
  • wxyz: The quaternion, represented as a vector \(\mathbf{q} = (q_w, q_x, q_y, q_z)\).

cryojax.simulator.AxisAnglePose ¤

An AbstractPose parameterized in the axis-angle representation.

The axis-angle representation parameterizes elements of the so3 algebra, which are skew-symmetric matrices, with the euler vector \(\boldsymbol{\omega} = (\omega_x, \omega_y, \omega_z)\). The magnitude of this vector is the angle, and the unit vector is the axis.

In a SO3 object, the euler vector is mapped to SO3 group elements using the matrix exponential.

cryojax.simulator.AxisAnglePose.__init__(offset_x_in_angstroms: float | Float[Array, ''] = 0.0, offset_y_in_angstroms: float | Float[Array, ''] = 0.0, euler_vector: tuple[float, float, float] | Float[np.ndarray, 3] | Float[Array, 3] = (0.0, 0.0, 0.0)) ¤

Arguments:

  • offset_x_in_angstroms: In-plane translation in x direction.
  • offset_y_in_angstroms: In-plane translation in y direction.
  • euler_vector: The axis-angle parameterization, represented with the euler vector \(\boldsymbol{\omega}\).