{"id":24540,"library":"rowan","title":"rowan","description":"A Python library for performing quaternion operations using NumPy arrays. Provides functions for quaternion creation, normalization, rotation, interpolation, and conversion between quaternions and other rotation representations (e.g., rotation matrices, axis-angle). Current version: 1.3.2, released 2023-04-03. Release cadence is irregular.","status":"active","version":"1.3.2","language":"python","source_language":"en","source_url":"https://github.com/glotzerlab/rowan","tags":["quaternion","rotation","numpy","geometry","computational-science"],"install":[{"cmd":"pip install rowan","lang":"bash","label":"Install rowan from PyPI"}],"dependencies":[{"reason":"Core dependency; rowan operates on numpy arrays.","package":"numpy","optional":false}],"imports":[{"note":"Importing * pollutes the namespace; prefer explicit functions.","wrong":"from rowan import *","symbol":"rowan","correct":"import rowan"}],"quickstart":{"code":"import rowan\nimport numpy as np\n\n# Create a quaternion from axis-angle (radians)\naxis = np.array([0, 0, 1])\nangle = np.pi / 2\nq = rowan.from_axis_angle(axis, angle)\n\n# Rotate a vector\nv = np.array([1, 0, 0])\nv_rot = rowan.rotate(q, v)\nprint(v_rot)  # [0, 1, 0]\n\n# Convert to rotation matrix\nR = rowan.to_matrix(q)\nprint(R)","lang":"python","description":"Create a quaternion from axis-angle, rotate a vector, and convert to rotation matrix."},"warnings":[{"fix":"Always convert lists to np.array before passing to rowan functions.","message":"rowan expects inputs as numpy arrays, not lists. Passing plain Python lists may cause unexpected errors or silently produce wrong results.","severity":"gotcha","affected_versions":"all"},{"fix":"When interfacing with other libraries, convert conventions explicitly: for rowan use [w, x, y, z].","message":"Quaternion conventions: rowan uses the scalar-first convention (q = [w, x, y, z]). Some other libraries (e.g., scipy) use scalar-last. Mixing conventions will cause incorrect rotations.","severity":"gotcha","affected_versions":"all"},{"fix":"Normalize the axis vector using `axis / np.linalg.norm(axis)` before passing.","message":"The function `rowan.from_axis_angle` expects the axis to be normalized. If the axis is not unit length, the quaternion will represent a rotation with incorrect angle.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade to latest rowan: `pip install --upgrade rowan` or use the correct old name: `rowan.from_axisangle`.","cause":"Older versions of rowan (<1.0?) use different function names, e.g., `rowan.from_axisangle` (no underscore). Check installed version.","error":"AttributeError: module 'rowan' has no attribute 'from_axis_angle'"},{"fix":"Ensure array has homogeneous numeric dtype, e.g., `np.array(..., dtype=np.float64)`.","cause":"Input numpy array has dtype=object, often because it contains mixed types or is created from a ragged list.","error":"TypeError: Object arrays are not supported"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}