make_rotation

Contents

make_rotation#

pypulseqpp.make_rotation()[source]#

Create a rotation extension event for a block’s gradients.

Parameters:

*args –

Accepted forms (angles in radians):

  • (rotation,) : a SciPy rotation object, retained by reference.

  • (phi,) : rotation about z.

  • (phi, theta) : Rz(phi) @ Ry(theta); y is applied first.

  • (axis, angle) : rotation about a nonzero three-vector.

  • (quaternion,) : four scalar-first components, normalised here.

  • (matrix,) : a 3-by-3 rotation matrix.

  • (matrices,) : an N-by-3-by-3 stack of rotation matrices.

Returns:

Event with type == "rot3D", or one event per stacked matrix.

Return type:

types.SimpleNamespace or list of types.SimpleNamespace

Raises:

ValueError – For an unrecognised form, zero axis or quaternion, or an angle outside its accepted range: phi in [-pi, 2*pi), theta and axis-angle rotations in [-pi, pi].

Notes

Registration caches quaternions by rotation-object identity. Reuse the same object for blocks with the same orientation.