{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Strong",
              "__tag": 4048,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Array API Standard Support"
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "as_davenport",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.spatial.transform._rotation:Rotation.as_davenport"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "SCIPY_ARRAY_API=1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported."
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "====================  ====================  ====================\nLibrary               CPU                   GPU\n====================  ====================  ====================\nNumPy                 ✅                     n/a                 \nCuPy                  n/a                   ⛔                   \nPyTorch               ✅                     ✅                   \nJAX                   ✅                     ✅                   \nDask                  ⛔                     n/a                 \n====================  ====================  ====================",
          "execution_status": null
        },
        {
          "__type": "Blockquote",
          "__tag": 4059,
          "children": [
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "See "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "dev-arrayapi",
                  "domain": null,
                  "role": "ref",
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " for more information."
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "angles",
              "annotation": "ndarray, shape (..., 3)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Shape depends on shape of inputs used to initialize object. The returned angles are in the range:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "First angle belongs to [-180, 180] degrees (both inclusive)"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "Third angle belongs to [-180, 180] degrees (both inclusive)"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "Second angle belongs to a set of size 180 degrees,   given by: "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "[-abs(lambda), 180 - abs(lambda)]"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", where "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "lambda"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "   is the angle between the first and third axes."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Represent as Davenport angles."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "axes",
              "annotation": "array_like, shape (..., [1 or 2 or 3], 3) or (..., 3)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Axis of rotation, if one dimensional. If N dimensional, describes the sequence of axes for rotations, where each axes[..., i, :] is the ith axis. If more than one axis is given, then the second axis must be orthogonal to both the first and third axes."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "order",
              "annotation": "string",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If it belongs to the set {'e', 'extrinsic'}, the sequence will be extrinsic. If it belongs to the set {'i', 'intrinsic'}, sequence will be treated as intrinsic."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "degrees",
              "annotation": "boolean, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Returned angles are in degrees if this flag is True, else they are in radians. Default is False."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "suppress_warnings",
              "annotation": "boolean, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Disable warnings about gimbal lock. Default is False."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Any orientation can be expressed as a composition of 3 elementary rotations."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "For both Euler angles and Davenport angles, consecutive axes must be are orthogonal ("
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "axis2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is orthogonal to both "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "axis1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "axis3"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "). For Euler angles, there is an additional relationship between "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "axis1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " or "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "axis3"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", with two possibilities:"
            }
          ]
        },
        {
          "__type": "Blockquote",
          "__tag": 4059,
          "children": [
            {
              "__type": "BulletList",
              "__tag": 4053,
              "ordered": false,
              "start": 1,
              "children": [
                {
                  "__type": "ListItem",
                  "__tag": 4054,
                  "children": [
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "InlineCode",
                          "__tag": 4051,
                          "value": "axis1"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " and "
                        },
                        {
                          "__type": "InlineCode",
                          "__tag": 4051,
                          "value": "axis3"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " are also orthogonal (asymmetric sequence)"
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "ListItem",
                  "__tag": 4054,
                  "children": [
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "InlineCode",
                          "__tag": 4051,
                          "value": "axis1 == axis3"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " (symmetric sequence)"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "For Davenport angles, this last relationship is relaxed "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", and only the consecutive orthogonal axes requirement is maintained."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "A slightly modified version of the algorithm from "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " has been used to calculate Davenport angles for the rotation about a given sequence of axes."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Davenport angles, just like Euler angles, suffer from the problem of gimbal lock "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "3"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", where the representation loses a degree of freedom and it is not possible to determine the first and third angles uniquely. In this case, a warning is raised (unless the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "suppress_warnings"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " option is used), and the third angle is set to zero. Note however that the returned angles still represent the correct rotation."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/scipy/spatial/transform/_rotation.py",
  "item_line": 1292,
  "item_type": "function",
  "aliases": [
    "scipy.spatial.transform.Rotation.as_davenport"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.spatial.transform import Rotation as R\nimport numpy as np\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nDavenport angles are a generalization of Euler angles, when we use the\ncanonical basis axes:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ex = [1, 0, 0]\ney = [0, 1, 0]\nez = [0, 0, 1]\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nRepresent a single rotation:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "r = R.from_rotvec([0, 0, np.pi/2])\nr.as_davenport([ez, ex, ey], 'extrinsic', degrees=True)\nr.as_euler('zxy', degrees=True)\nr.as_davenport([ez, ex, ey], 'extrinsic', degrees=True).shape\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nRepresent a stack of single rotation:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "r = R.from_rotvec([[0, 0, np.pi/2]])\nr.as_davenport([ez, ex, ey], 'extrinsic', degrees=True)\nr.as_davenport([ez, ex, ey], 'extrinsic', degrees=True).shape\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nRepresent multiple rotations in a single object:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "r = R.from_rotvec([\n[0, 0, 90],\n[45, 0, 0]], degrees=True)\nr.as_davenport([ez, ex, ey], 'extrinsic', degrees=True)\nr.as_davenport([ez, ex, ey], 'extrinsic', degrees=True).shape\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "self",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "axes",
        "annotation": "ArrayLike",
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "order",
        "annotation": "str",
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "degrees",
        "annotation": "bool",
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "False"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "suppress_warnings",
        "annotation": "bool",
        "kind": "KEYWORD_ONLY",
        "default": "False"
      }
    ],
    "return_annotation": "Array",
    "target_name": "as_davenport"
  },
  "references": [
    ".. [1] Shuster, Malcolm & Markley, Landis. (2003). Generalization of",
    "       the Euler Angles. Journal of the Astronautical Sciences. 51. 123-132.",
    "       10.1007/BF03546304.",
    ".. [2] Bernardes E, Viollet S (2022) Quaternion to Euler angles",
    "       conversion: A direct, general and computationally efficient method.",
    "       PLoS ONE 17(11): e0276302. 10.1371/journal.pone.0276302",
    ".. [3] https://en.wikipedia.org/wiki/Gimbal_lock#In_applied_mathematics"
  ],
  "qa": "scipy.spatial.transform._rotation:Rotation.as_davenport",
  "arbitrary": [],
  "local_refs": [
    "angles",
    "axes",
    "degrees",
    "order",
    "suppress_warnings"
  ]
}