class_docstr: Rotation in 3 dimensions.
  
  This class provides an interface to initialize from and represent rotations
  with:
  
      - Quaternions
      - Direction Cosine Matrices
      - Rotation Vectors
      - Euler angles
  
  The following operations on rotations are supported:
  
      - Application on vectors
      - Rotation Composition
      - Rotation Inversion
      - Rotation Indexing
  
  Indexing within a rotation is supported since multiple rotation transforms
  can be stored within a single `Rotation` instance.
  
  To create `Rotation` objects use `from_...` classmethods, `__init__` is not
  supposed to be used directly.
  
  Methods
  -------
  __len__
  from_quat
  from_dcm
  from_rotvec
  from_euler
  as_quat
  as_dcm
  as_rotvec
  as_euler
  apply
  __mul__
  inv
  __getitem__
  random
  
  Examples
  --------
  >>> from scipy.spatial.transform import Rotation as R
  
  A `Rotation` instance can be initialized in any of the above formats and
  converted to any of the others. The underlying object is independent of the
  representation used for initialization.
  
  Consider a counter-clockwise rotation of 90 degrees about the z-axis. This
  corresponds to the following quaternion (in scalar-last format):
  
  >>> r = R.from_quat([0, 0, np.sin(np.pi/4), np.cos(np.pi/4)])
  
  The rotation can be expressed in any of the other formats:
  
  >>> r.as_dcm()
  array([[ 2.22044605e-16, -1.00000000e+00,  0.00000000e+00],
  [ 1.00000000e+00,  2.22044605e-16,  0.00000000e+00],
  [ 0.00000000e+00,  0.00000000e+00,  1.00000000e+00]])
  >>> r.as_rotvec()
  array([0.        , 0.        , 1.57079633])
  >>> r.as_euler('zyx', degrees=True)
  array([90.,  0.,  0.])
  
  The same rotation can be initialized using a direction cosine matrix:
  
  >>> r = R.from_dcm(np.array([
  ... [0, -1, 0],
  ... [1, 0, 0],
  ... [0, 0, 1]]))
  
  Representation in other formats:
  
  >>> r.as_quat()
  array([0.        , 0.        , 0.70710678, 0.70710678])
  >>> r.as_rotvec()
  array([0.        , 0.        , 1.57079633])
  >>> r.as_euler('zyx', degrees=True)
  array([90.,  0.,  0.])
  
  The rotation vector corresponding to this rotation is given by:
  
  >>> r = R.from_rotvec(np.pi/2 * np.array([0, 0, 1]))
  
  Representation in other formats:
  
  >>> r.as_quat()
  array([0.        , 0.        , 0.70710678, 0.70710678])
  >>> r.as_dcm()
  array([[ 2.22044605e-16, -1.00000000e+00,  0.00000000e+00],
         [ 1.00000000e+00,  2.22044605e-16,  0.00000000e+00],
         [ 0.00000000e+00,  0.00000000e+00,  1.00000000e+00]])
  >>> r.as_euler('zyx', degrees=True)
  array([90.,  0.,  0.])
  
  The `from_euler` function is quite flexible in the range of input formats
  it supports. Here we initialize a single rotation about a single axis:
  
  >>> r = R.from_euler('z', 90, degrees=True)
  
  Again, the object is representation independent and can be converted to any
  other format:
  
  >>> r.as_quat()
  array([0.        , 0.        , 0.70710678, 0.70710678])
  >>> r.as_dcm()
  array([[ 2.22044605e-16, -1.00000000e+00,  0.00000000e+00],
         [ 1.00000000e+00,  2.22044605e-16,  0.00000000e+00],
         [ 0.00000000e+00,  0.00000000e+00,  1.00000000e+00]])
  >>> r.as_rotvec()
  array([0.        , 0.        , 1.57079633])
  
  It is also possible to initialize multiple rotations in a single instance
  using any of the `from_...` functions. Here we initialize a stack of 3
  rotations using the `from_euler` function:
  
  >>> r = R.from_euler('zyx', [
  ... [90, 0, 0],
  ... [0, 45, 0],
  ... [45, 60, 30]], degrees=True)
  
  The other representations also now return a stack of 3 rotations. For
  example:
  
  >>> r.as_quat()
  array([[0.        , 0.        , 0.70710678, 0.70710678],
         [0.        , 0.38268343, 0.        , 0.92387953],
         [0.39190384, 0.36042341, 0.43967974, 0.72331741]])
  
  Applying the above rotations onto a vector:
  
  >>> v = [1, 2, 3]
  >>> r.apply(v)
  array([[-2.        ,  1.        ,  3.        ],
         [ 2.82842712,  2.        ,  1.41421356],
         [ 2.24452282,  0.78093109,  2.89002836]])
  
  A `Rotation` instance can be indexed and sliced as if it were a single
  1D array or list:
  
  >>> r.as_quat()
  array([[0.        , 0.        , 0.70710678, 0.70710678],
         [0.        , 0.38268343, 0.        , 0.92387953],
         [0.39190384, 0.36042341, 0.43967974, 0.72331741]])
  >>> p = r[0]
  >>> p.as_dcm()
  array([[ 2.22044605e-16, -1.00000000e+00,  0.00000000e+00],
         [ 1.00000000e+00,  2.22044605e-16,  0.00000000e+00],
         [ 0.00000000e+00,  0.00000000e+00,  1.00000000e+00]])
  >>> q = r[1:3]
  >>> q.as_quat()
  array([[0.        , 0.38268343, 0.        , 0.92387953],
         [0.39190384, 0.36042341, 0.43967974, 0.72331741]])
  
  Multiple rotations can be composed using the `*` operator:
  
  >>> r1 = R.from_euler('z', 90, degrees=True)
  >>> r2 = R.from_rotvec([np.pi/4, 0, 0])
  >>> v = [1, 2, 3]
  >>> r2.apply(r1.apply(v))
  array([-2.        , -1.41421356,  2.82842712])
  >>> r3 = r2 * r1 # Note the order
  >>> r3.apply(v)
  array([-2.        , -1.41421356,  2.82842712])
  
  Finally, it is also possible to invert rotations:
  
  >>> r1 = R.from_euler('z', [90, 45], degrees=True)
  >>> r2 = r1.inv()
  >>> r2.as_euler('zyx', degrees=True)
  array([[-90.,   0.,   0.],
         [-45.,   0.,   0.]])
  
  These examples serve as an overview into the `Rotation` class and highlight
  major functionalities. For more thorough examples of the range of input and
  output formats supported, consult the individual method's examples.
class_docstr_tok: ["Rotation","in","3","dimensions",".","This","class","provides","an","interface","to","initialize","from","and","represent","rotations","with",":","-","Quaternions","-","Direction","Cosine","Matrices","-","Rotation","Vectors","-","Euler","angles","The","following","operations","on","rotations","are","supported",":","-","Application","on","vectors","-","Rotation","Composition","-","Rotation","Inversion","-","Rotation","Indexing","Indexing","within","a","rotation","is","supported","since","multiple","rotation","transforms","can","be","stored","within","a","single","`","Rotation","`","instance",".","To","create","`","Rotation","`","objects","use","`","from_","...","`","classmethods",",","`","__init__","`","is","not","supposed","to","be","used","directly",".","Methods","--","--","--","-","__len__","from_quat","from_dcm","from_rotvec","from_euler","as_quat","as_dcm","as_rotvec","as_euler","apply","__mul__","inv","__getitem__","random","Examples","--","--","--","--",">",">",">","from","scipy.spatial.transform","import","Rotation","as","R","A","`","Rotation","`","instance","can","be","initialized","in","any","of","the","above","formats","and","converted","to","any","of","the","others",".","The","underlying","object","is","independent","of","the","representation","used","for","initialization",".","Consider","a","counter-clockwise","rotation","of","90","degrees","about","the","z-axis",".","This","corresponds","to","the","following","quaternion","(","in","scalar-last","format",")",":",">",">",">","r","=","R.from_quat","(","[","0",",","0",",","np.sin","(","np.pi\/4",")",",","np.cos","(","np.pi\/4",")","]",")","The","rotation","can","be","expressed","in","any","of","the","other","formats",":",">",">",">","r.as_dcm","(",")","array","(","[","[","2.22044605e-16",",","-1.00000000e+00",",","0.00000000e+00","]",",","[","1.00000000e+00",",","2.22044605e-16",",","0.00000000e+00","]",",","[","0.00000000e+00",",","0.00000000e+00",",","1.00000000e+00","]","]",")",">",">",">","r.as_rotvec","(",")","array","(","[","0.",",","0.",",","1.57079633","]",")",">",">",">","r.as_euler","(","'zyx","'",",","degrees=True",")","array","(","[","90.",",","0.",",","0",".","]",")","The","same","rotation","can","be","initialized","using","a","direction","cosine","matrix",":",">",">",">","r","=","R.from_dcm","(","np.array","(","[","...","[","0",",","-1",",","0","]",",","...","[","1",",","0",",","0","]",",","...","[","0",",","0",",","1","]","]",")",")","Representation","in","other","formats",":",">",">",">","r.as_quat","(",")","array","(","[","0.",",","0.",",","0.70710678",",","0.70710678","]",")",">",">",">","r.as_rotvec","(",")","array","(","[","0.",",","0.",",","1.57079633","]",")",">",">",">","r.as_euler","(","'zyx","'",",","degrees=True",")","array","(","[","90.",",","0.",",","0",".","]",")","The","rotation","vector","corresponding","to","this","rotation","is","given","by",":",">",">",">","r","=","R.from_rotvec","(","np.pi\/2","*","np.array","(","[","0",",","0",",","1","]",")",")","Representation","in","other","formats",":",">",">",">","r.as_quat","(",")","array","(","[","0.",",","0.",",","0.70710678",",","0.70710678","]",")",">",">",">","r.as_dcm","(",")","array","(","[","[","2.22044605e-16",",","-1.00000000e+00",",","0.00000000e+00","]",",","[","1.00000000e+00",",","2.22044605e-16",",","0.00000000e+00","]",",","[","0.00000000e+00",",","0.00000000e+00",",","1.00000000e+00","]","]",")",">",">",">","r.as_euler","(","'zyx","'",",","degrees=True",")","array","(","[","90.",",","0.",",","0",".","]",")","The","`","from_euler","`","function","is","quite","flexible","in","the","range","of","input","formats","it","supports",".","Here","we","initialize","a","single","rotation","about","a","single","axis",":",">",">",">","r","=","R.from_euler","(","'","z","'",",","90",",","degrees=True",")","Again",",","the","object","is","representation","independent","and","can","be","converted","to","any","other","format",":",">",">",">","r.as_quat","(",")","array","(","[","0.",",","0.",",","0.70710678",",","0.70710678","]",")",">",">",">","r.as_dcm","(",")","array","(","[","[","2.22044605e-16",",","-1.00000000e+00",",","0.00000000e+00","]",",","[","1.00000000e+00",",","2.22044605e-16",",","0.00000000e+00","]",",","[","0.00000000e+00",",","0.00000000e+00",",","1.00000000e+00","]","]",")",">",">",">","r.as_rotvec","(",")","array","(","[","0.",",","0.",",","1.57079633","]",")","It","is","also","possible","to","initialize","multiple","rotations","in","a","single","instance","using","any","of","the","`","from_","...","`","functions",".","Here","we","initialize","a","stack","of","3","rotations","using","the","`","from_euler","`","function",":",">",">",">","r","=","R.from_euler","(","'zyx","'",",","[","...","[","90",",","0",",","0","]",",","...","[","0",",","45",",","0","]",",","...","[","45",",","60",",","30","]","]",",","degrees=True",")","The","other","representations","also","now","return","a","stack","of","3","rotations",".","For","example",":",">",">",">","r.as_quat","(",")","array","(","[","[","0.",",","0.",",","0.70710678",",","0.70710678","]",",","[","0.",",","0.38268343",",","0.",",","0.92387953","]",",","[","0.39190384",",","0.36042341",",","0.43967974",",","0.72331741","]","]",")","Applying","the","above","rotations","onto","a","vector",":",">",">",">","v","=","[","1",",","2",",","3","]",">",">",">","r.apply","(","v",")","array","(","[","[","-2.",",","1.",",","3",".","]",",","[","2.82842712",",","2.",",","1.41421356","]",",","[","2.24452282",",","0.78093109",",","2.89002836","]","]",")","A","`","Rotation","`","instance","can","be","indexed","and","sliced","as","if","it","were","a","single","1D","array","or","list",":",">",">",">","r.as_quat","(",")","array","(","[","[","0.",",","0.",",","0.70710678",",","0.70710678","]",",","[","0.",",","0.38268343",",","0.",",","0.92387953","]",",","[","0.39190384",",","0.36042341",",","0.43967974",",","0.72331741","]","]",")",">",">",">","p","=","r","[","0","]",">",">",">","p.as_dcm","(",")","array","(","[","[","2.22044605e-16",",","-1.00000000e+00",",","0.00000000e+00","]",",","[","1.00000000e+00",",","2.22044605e-16",",","0.00000000e+00","]",",","[","0.00000000e+00",",","0.00000000e+00",",","1.00000000e+00","]","]",")",">",">",">","q","=","r","[","1:3","]",">",">",">","q.as_quat","(",")","array","(","[","[","0.",",","0.38268343",",","0.",",","0.92387953","]",",","[","0.39190384",",","0.36042341",",","0.43967974",",","0.72331741","]","]",")","Multiple","rotations","can","be","composed","using","the","`","*","`","operator",":",">",">",">","r1","=","R.from_euler","(","'","z","'",",","90",",","degrees=True",")",">",">",">","r2","=","R.from_rotvec","(","[","np.pi\/4",",","0",",","0","]",")",">",">",">","v","=","[","1",",","2",",","3","]",">",">",">","r2.apply","(","r1.apply","(","v",")",")","array","(","[","-2.",",","-1.41421356",",","2.82842712","]",")",">",">",">","r3","=","r2","*","r1","#","Note","the","order",">",">",">","r3.apply","(","v",")","array","(","[","-2.",",","-1.41421356",",","2.82842712","]",")","Finally",",","it","is","also","possible","to","invert","rotations",":",">",">",">","r1","=","R.from_euler","(","'","z","'",",","[","90",",","45","]",",","degrees=True",")",">",">",">","r2","=","r1.inv","(",")",">",">",">","r2.as_euler","(","'zyx","'",",","degrees=True",")","array","(","[","[","-90.",",","0.",",","0",".","]",",","[","-45.",",","0.",",","0",".","]","]",")","These","examples","serve","as","an","overview","into","the","`","Rotation","`","class","and","highlight","major","functionalities",".","For","more","thorough","examples","of","the","range","of","input","and","output","formats","supported",",","consult","the","individual","method","'s","examples","."]
docstr: Initialize from Euler angles.
  
  Rotations in 3 dimensions can be represented by a sequece of 3
  rotations around a sequence of axes. In theory, any three axes spanning
  the 3D Euclidean space are enough. In practice the axes of rotation are
  chosen to be the basis vectors.
  
  The three rotations can either be in a global frame of reference
  (extrinsic) or in a body centred frame of refernce (intrinsic), which
  is attached to, and moves with, the object under rotation [1]_.
  
  Parameters
  ----------
  seq : string
      Specifies sequence of axes for rotations. Up to 3 characters
      belonging to the set {'X', 'Y', 'Z'} for intrinsic rotations, or
      {'x', 'y', 'z'} for extrinsic rotations. Extrinsic and intrinsic
      rotations cannot be mixed in one function call.
  angles : float or array_like, shape (N,) or (N, [1 or 2 or 3])
      Euler angles specified in radians (`degrees` is False) or degrees
      (`degrees` is True).
      For a single character `seq`, `angles` can be:
  
          - a single value
          - array_like with shape (N,), where each `angle[i]`
            corresponds to a single rotation
          - array_like with shape (N, 1), where each `angle[i, 0]`
            corresponds to a single rotation
  
      For 2- and 3-character wide `seq`, `angles` can be:
  
          - array_like with shape (W,) where `W` is the width of
            `seq`, which corresponds to a single rotation with `W` axes
          - array_like with shape (N, W) where each `angle[i]`
            corresponds to a sequence of Euler angles describing a single
            rotation
  
  degrees : boolean, optional
      If True, then the given angles are assumed to be in degrees.
      Default is False.
  
  Returns
  -------
  rotation : `Rotation` instance
      Object containing the rotation represented by the sequence of
      rotations around given axes with given angles.
  
  References
  ----------
  .. [1] `Euler angle definitions
          <https://en.wikipedia.org/wiki/Euler_angles#Definition_by_intrinsic_rotations>`_
  
  Examples
  --------
  >>> from scipy.spatial.transform import Rotation as R
  
  Initialize a single rotation along a single axis:
  
  >>> r = R.from_euler('x', 90, degrees=True)
  >>> r.as_quat().shape
  (4,)
  
  Initialize a single rotation with a given axis sequence:
  
  >>> r = R.from_euler('zyx', [90, 45, 30], degrees=True)
  >>> r.as_quat().shape
  (4,)
  
  Initialize a stack with a single rotation around a single axis:
  
  >>> r = R.from_euler('x', [90], degrees=True)
  >>> r.as_quat().shape
  (1, 4)
  
  Initialize a stack with a single rotation with an axis sequence:
  
  >>> r = R.from_euler('zyx', [[90, 45, 30]], degrees=True)
  >>> r.as_quat().shape
  (1, 4)
  
  Initialize multiple elementary rotations in one object:
  
  >>> r = R.from_euler('x', [90, 45, 30], degrees=True)
  >>> r.as_quat().shape
  (3, 4)
  
  Initialize multiple rotations in one object:
  
  >>> r = R.from_euler('zyx', [[90, 45, 30], [35, 45, 90]], degrees=True)
  >>> r.as_quat().shape
  (2, 4)
docstr_tok: ["Initialize","from","Euler","angles",".","Rotations","in","3","dimensions","can","be","represented","by","a","sequece","of","3","rotations","around","a","sequence","of","axes",".","In","theory",",","any","three","axes","spanning","the","3D","Euclidean","space","are","enough",".","In","practice","the","axes","of","rotation","are","chosen","to","be","the","basis","vectors",".","The","three","rotations","can","either","be","in","a","global","frame","of","reference","(","extrinsic",")","or","in","a","body","centred","frame","of","refernce","(","intrinsic",")",",","which","is","attached","to",",","and","moves","with",",","the","object","under","rotation","[","1","]","_.","Parameters","--","--","--","--","--","seq",":","string","Specifies","sequence","of","axes","for","rotations",".","Up","to","3","characters","belonging","to","the","set","{","'","X","'",",","'","Y","'",",","'","Z","'","}","for","intrinsic","rotations",",","or","{","'","x","'",",","'","y","'",",","'","z","'","}","for","extrinsic","rotations",".","Extrinsic","and","intrinsic","rotations","can","not","be","mixed","in","one","function","call",".","angles",":","float","or","array_like",",","shape","(","N",",",")","or","(","N",",","[","1","or","2","or","3","]",")","Euler","angles","specified","in","radians","(","`","degrees","`","is","False",")","or","degrees","(","`","degrees","`","is","True",")",".","For","a","single","character","`","seq","`",",","`","angles","`","can","be",":","-","a","single","value","-","array_like","with","shape","(","N",",",")",",","where","each","`","angle","[","i","]","`","corresponds","to","a","single","rotation","-","array_like","with","shape","(","N",",","1",")",",","where","each","`","angle","[","i",",","0","]","`","corresponds","to","a","single","rotation","For","2-","and","3-character","wide","`","seq","`",",","`","angles","`","can","be",":","-","array_like","with","shape","(","W",",",")","where","`","W","`","is","the","width","of","`","seq","`",",","which","corresponds","to","a","single","rotation","with","`","W","`","axes","-","array_like","with","shape","(","N",",","W",")","where","each","`","angle","[","i","]","`","corresponds","to","a","sequence","of","Euler","angles","describing","a","single","rotation","degrees",":","boolean",",","optional","If","True",",","then","the","given","angles","are","assumed","to","be","in","degrees",".","Default","is","False",".","Returns","--","--","--","-","rotation",":","`","Rotation","`","instance","Object","containing","the","rotation","represented","by","the","sequence","of","rotations","around","given","axes","with","given","angles",".","References","--","--","--","--","--","..","[","1","]","`","Euler","angle","definitions","<","https",":","\/\/en.wikipedia.org\/wiki\/Euler_angles","#","Definition_by_intrinsic_rotations",">","`","_","Examples","--","--","--","--",">",">",">","from","scipy.spatial.transform","import","Rotation","as","R","Initialize","a","single","rotation","along","a","single","axis",":",">",">",">","r","=","R.from_euler","(","'","x","'",",","90",",","degrees=True",")",">",">",">","r.as_quat","(",")",".shape","(","4",",",")","Initialize","a","single","rotation","with","a","given","axis","sequence",":",">",">",">","r","=","R.from_euler","(","'zyx","'",",","[","90",",","45",",","30","]",",","degrees=True",")",">",">",">","r.as_quat","(",")",".shape","(","4",",",")","Initialize","a","stack","with","a","single","rotation","around","a","single","axis",":",">",">",">","r","=","R.from_euler","(","'","x","'",",","[","90","]",",","degrees=True",")",">",">",">","r.as_quat","(",")",".shape","(","1",",","4",")","Initialize","a","stack","with","a","single","rotation","with","an","axis","sequence",":",">",">",">","r","=","R.from_euler","(","'zyx","'",",","[","[","90",",","45",",","30","]","]",",","degrees=True",")",">",">",">","r.as_quat","(",")",".shape","(","1",",","4",")","Initialize","multiple","elementary","rotations","in","one","object",":",">",">",">","r","=","R.from_euler","(","'","x","'",",","[","90",",","45",",","30","]",",","degrees=True",")",">",">",">","r.as_quat","(",")",".shape","(","3",",","4",")","Initialize","multiple","rotations","in","one","object",":",">",">",">","r","=","R.from_euler","(","'zyx","'",",","[","[","90",",","45",",","30","]",",","[","35",",","45",",","90","]","]",",","degrees=True",")",">",">",">","r.as_quat","(",")",".shape","(","2",",","4",")"]
code: def from_euler(cls, seq, angles, degrees=False):
      """Initialize from Euler angles.
  
      Rotations in 3 dimensions can be represented by a sequece of 3
      rotations around a sequence of axes. In theory, any three axes spanning
      the 3D Euclidean space are enough. In practice the axes of rotation are
      chosen to be the basis vectors.
  
      The three rotations can either be in a global frame of reference
      (extrinsic) or in a body centred frame of refernce (intrinsic), which
      is attached to, and moves with, the object under rotation [1]_.
  
      Parameters
      ----------
      seq : string
          Specifies sequence of axes for rotations. Up to 3 characters
          belonging to the set {'X', 'Y', 'Z'} for intrinsic rotations, or
          {'x', 'y', 'z'} for extrinsic rotations. Extrinsic and intrinsic
          rotations cannot be mixed in one function call.
      angles : float or array_like, shape (N,) or (N, [1 or 2 or 3])
          Euler angles specified in radians (`degrees` is False) or degrees
          (`degrees` is True).
          For a single character `seq`, `angles` can be:
  
              - a single value
              - array_like with shape (N,), where each `angle[i]`
                corresponds to a single rotation
              - array_like with shape (N, 1), where each `angle[i, 0]`
                corresponds to a single rotation
  
          For 2- and 3-character wide `seq`, `angles` can be:
  
              - array_like with shape (W,) where `W` is the width of
                `seq`, which corresponds to a single rotation with `W` axes
              - array_like with shape (N, W) where each `angle[i]`
                corresponds to a sequence of Euler angles describing a single
                rotation
  
      degrees : boolean, optional
          If True, then the given angles are assumed to be in degrees.
          Default is False.
  
      Returns
      -------
      rotation : `Rotation` instance
          Object containing the rotation represented by the sequence of
          rotations around given axes with given angles.
  
      References
      ----------
      .. [1] `Euler angle definitions
              <https://en.wikipedia.org/wiki/Euler_angles#Definition_by_intrinsic_rotations>`_
  
      Examples
      --------
      >>> from scipy.spatial.transform import Rotation as R
  
      Initialize a single rotation along a single axis:
  
      >>> r = R.from_euler('x', 90, degrees=True)
      >>> r.as_quat().shape
      (4,)
  
      Initialize a single rotation with a given axis sequence:
  
      >>> r = R.from_euler('zyx', [90, 45, 30], degrees=True)
      >>> r.as_quat().shape
      (4,)
  
      Initialize a stack with a single rotation around a single axis:
  
      >>> r = R.from_euler('x', [90], degrees=True)
      >>> r.as_quat().shape
      (1, 4)
  
      Initialize a stack with a single rotation with an axis sequence:
  
      >>> r = R.from_euler('zyx', [[90, 45, 30]], degrees=True)
      >>> r.as_quat().shape
      (1, 4)
  
      Initialize multiple elementary rotations in one object:
  
      >>> r = R.from_euler('x', [90, 45, 30], degrees=True)
      >>> r.as_quat().shape
      (3, 4)
  
      Initialize multiple rotations in one object:
  
      >>> r = R.from_euler('zyx', [[90, 45, 30], [35, 45, 90]], degrees=True)
      >>> r.as_quat().shape
      (2, 4)
  
      """
      num_axes = len(seq)
      if num_axes < 1 or num_axes > 3:
          raise ValueError(
              "Expected axis specification to be a non-empty "
              "string of upto 3 characters, got {}".format(seq)
          )
  
      intrinsic = re.match(r"^[XYZ]{1,3}$", seq) is not None
      extrinsic = re.match(r"^[xyz]{1,3}$", seq) is not None
      if not (intrinsic or extrinsic):
          raise ValueError(
              "Expected axes from `seq` to be from ['x', 'y', "
              "'z'] or ['X', 'Y', 'Z'], got {}".format(seq)
          )
  
      if any(seq[i] == seq[i + 1] for i in range(num_axes - 1)):
          raise ValueError(
              "Expected consecutive axes to be different, "
              "got {}".format(seq)
          )
  
      seq = seq.lower()
  
      angles = np.asarray(angles, dtype=float)
      if degrees:
          angles = np.deg2rad(angles)
  
      is_single = False
      # Prepare angles to have shape (num_rot, num_axes)
      if num_axes == 1:
          if angles.ndim == 0:
              # (1, 1)
              angles = angles.reshape((1, 1))
              is_single = True
          elif angles.ndim == 1:
              # (N, 1)
              angles = angles[:, None]
          elif angles.ndim == 2 and angles.shape[-1] != 1:
              raise ValueError(
                  "Expected `angles` parameter to have shape "
                  "(N, 1), got {}.".format(angles.shape)
              )
          elif angles.ndim > 2:
              raise ValueError(
                  "Expected float, 1D array, or 2D array for "
                  "parameter `angles` corresponding to `seq`, "
                  "got shape {}.".format(angles.shape)
              )
      else:  # 2 or 3 axes
          if angles.ndim not in [1, 2] or angles.shape[-1] != num_axes:
              raise ValueError(
                  "Expected `angles` to be at most "
                  "2-dimensional with width equal to number "
                  "of axes specified, got {} for shape"
              ).format(angles.shape)
  
          if angles.ndim == 1:
              # (1, num_axes)
              angles = angles[None, :]
              is_single = True
  
      # By now angles should have shape (num_rot, num_axes)
      # sanity check
      if angles.ndim != 2 or angles.shape[-1] != num_axes:
          raise ValueError(
              "Expected angles to have shape (num_rotations, "
              "num_axes), got {}.".format(angles.shape)
          )
  
      quat = _elementary_quat_compose(seq, angles, intrinsic)
      return cls(
          quat[0] if is_single else quat, normalized=True, copy=False
      )
  
imports: from __future__ import division, print_function, absolute_import
  import re
  import warnings
  import numpy
  import scipy.linalg
  from scipy._lib._util import check_random_state
label_desc: Use image node_id 6 for calling the Rotation obj's underlying member method code with example usage: obj.from_euler(cls, seq, angles, degrees) and returns: cls