code: def test_basic_euler():
      # some example rotations, in radians
      zr = 0.05
      yr = -0.4
      xr = 0.2
      # Rotation matrix composing the three rotations
      M = nea.euler2mat(zr, yr, xr)
      # Corresponding individual rotation matrices
      M1 = nea.euler2mat(zr)
      M2 = nea.euler2mat(0, yr)
      M3 = nea.euler2mat(0, 0, xr)
      # which are all valid rotation matrices
      assert is_valid_rotation(M)
      assert is_valid_rotation(M1)
      assert is_valid_rotation(M2)
      assert is_valid_rotation(M3)
      # Full matrix is composition of three individual matrices
      assert np.allclose(M, np.dot(M3, np.dot(M2, M1)))
      # Rotations can be specified with named args, default 0
      assert np.all(nea.euler2mat(zr) == nea.euler2mat(z=zr))
      assert np.all(nea.euler2mat(0, yr) == nea.euler2mat(y=yr))
      assert np.all(nea.euler2mat(0, 0, xr) == nea.euler2mat(x=xr))
      # Applying an opposite rotation same as inverse (the inverse is
      # the same as the transpose, but just for clarity)
      assert np.allclose(
          nea.euler2mat(x=-xr), np.linalg.inv(nea.euler2mat(x=xr))
      )
  
file_path: nibabel/nibabel/tests/test_euler.py
imports: import math
  import numpy
  import pytest
  from numpy import pi
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ..None import eulerangles
  from ..None import quaternions
label_desc: Use image node_id 6 for calling a global function with example usage: test_basic_euler() without return types