How to use rot tilt psi to generate rotation matrix

def euler_to_rotation_matrix((rot, tilt, psi)):

x, y, z = np.radians(rot, tilt, psi)

Rx = np.array([[1, 0, 0],
               [0, np.cos(x), -np.sin(x)],
               [0, np.sin(x), np.cos(x)]])

Ry = np.array([[np.cos(y), 0, np.sin(y)],
               [0, 1, 0],
               [-np.sin(y), 0, np.cos(y)]])

Rz = np.array([[np.cos(z), -np.sin(z), 0],
               [np.sin(z), np.cos(z), 0],
               [0, 0, 1]])

rotation_matrix = Rz @ Ry @ Rx

return rotation_matrix

Is this right? Please, thanks

There are like a million (OK, OK, exactly 24) different Euler angle conventions.

The one used in EM is the intrinsic YZ’Y’’ convention, which you can find worked out here as well as in the Relion code base.

Also FYI, cryoSPARC uses Rodrigues axis-angle vectors and not Euler angles.