parameters: (ai, aj, ak, axes='sxyz')
return_statement: return quaternion
docstring: Return quaternion from Euler angles and axis sequence.
  
      ai, aj, ak : Euler's roll, pitch and yaw angles
      axes : One of 24 axis sequences as string or encoded tuple
  
      >>> q = quaternion_from_euler(1, 2, 3, 'ryxz')
      >>> numpy.allclose(q, [0.310622, -0.718287, 0.444435, 0.435953])
      True
docstring_summary: Return quaternion from Euler angles and axis sequence.
docstring_tokens: Return quaternion from Euler angles and axis sequence .
function: def quaternion_from_euler(ai, aj, ak, axes='sxyz'):
      """Return quaternion from Euler angles and axis sequence.
  
      ai, aj, ak : Euler's roll, pitch and yaw angles
      axes : One of 24 axis sequences as string or encoded tuple
  
      >>> q = quaternion_from_euler(1, 2, 3, 'ryxz')
      >>> numpy.allclose(q, [0.310622, -0.718287, 0.444435, 0.435953])
      True
  
      """
      try:
          firstaxis, parity, repetition, frame = _AXES2TUPLE[axes.lower()]
      except (AttributeError, KeyError):
          _ = _TUPLE2AXES[axes]
          firstaxis, parity, repetition, frame = axes
  
      i = firstaxis
      j = _NEXT_AXIS[i+parity]
      k = _NEXT_AXIS[i-parity+1]
  
      if frame:
          ai, ak = ak, ai
      if parity:
          aj = -aj
  
      ai /= 2.0
      aj /= 2.0
      ak /= 2.0
      ci = math.cos(ai)
      si = math.sin(ai)
      cj = math.cos(aj)
      sj = math.sin(aj)
      ck = math.cos(ak)
      sk = math.sin(ak)
      cc = ci*ck
      cs = ci*sk
      sc = si*ck
      ss = si*sk
  
      quaternion = numpy.empty((4, ), dtype=numpy.float64)
      if repetition:
          quaternion[i] = cj*(cs + sc)
          quaternion[j] = sj*(cc + ss)
          quaternion[k] = sj*(cs - sc)
          quaternion[3] = cj*(cc - ss)
      else:
          quaternion[i] = cj*sc - sj*cs
          quaternion[j] = cj*ss + sj*cc
          quaternion[k] = cj*cs - sj*sc
          quaternion[3] = cj*cc + sj*ss
      if parity:
          quaternion[j] *= -1
  
      return quaternion
function_tokens: def quaternion_from_euler ( ai , aj , ak , axes = 'sxyz' ) : try : firstaxis , parity , repetition , frame = _AXES2TUPLE [ axes . lower ( ) ] except ( AttributeError , KeyError ) : _ = _TUPLE2AXES [ axes ] firstaxis , parity , repetition , frame = axes i = firstaxis j = _NEXT_AXIS [ i + parity ] k = _NEXT_AXIS [ i - parity + 1 ] if frame : ai , ak = ak , ai if parity : aj = - aj ai /= 2.0 aj /= 2.0 ak /= 2.0 ci = math . cos ( ai ) si = math . sin ( ai ) cj = math . cos ( aj ) sj = math . sin ( aj ) ck = math . cos ( ak ) sk = math . sin ( ak ) cc = ci * ck cs = ci * sk sc = si * ck ss = si * sk quaternion = numpy . empty ( ( 4 , ) , dtype = numpy . float64 ) if repetition : quaternion [ i ] = cj * ( cs + sc ) quaternion [ j ] = sj * ( cc + ss ) quaternion [ k ] = sj * ( cs - sc ) quaternion [ 3 ] = cj * ( cc - ss ) else : quaternion [ i ] = cj * sc - sj * cs quaternion [ j ] = cj * ss + sj * cc quaternion [ k ] = cj * cs - sj * sc quaternion [ 3 ] = cj * cc + sj * ss if parity : quaternion [ j ] *= - 1 return quaternion