Skip to main content

Perform quaternion operations using NumPy arrays

Project description

rowan

ReadTheDocs Status CircleCI Codecov PyPI Codacy Badge Zenodo JOSS

Welcome to rowan, a python package for quaternions. The package is built entirely on top of NumPy and represents quaternions using NumPy arrays, meaning that all functions support arbitrarily high-dimensional arrays of quaternions. Quaternions are encoded as arrays of shape (...,4), with the convention that the final dimension of an array (a, b, c, d) represents the quaternion a + bi + cj + dk. The package covers all basic quaternion algebraic and calculus operations, and also provides features for measuring distances, performing point cloud mapping, and interpolating. If you have any questions about how to work with rowan, please visit the ReadTheDocs page.

Authors

Setup

The recommended methods for installing rowan are using pip or conda.

Installation via pip

To install the package from PyPI, execute:

pip install rowan --user

Installation via conda

To install the package from conda, first add the conda-forge channel:

conda config --add channels conda-forge

After the conda-forge channel has been added, you can install rowan by executing

conda install rowan

Installation from source

To install from source, execute:

git clone https://github.com/glotzerlab/rowan.git
cd rowan
python setup.py install --user

Requirements

  • Python = 2.7, >= 3.3
  • NumPy >= 1.10

Testing

The package is currently tested for Python versions 2.7 and Python >= 3.3 on Unix-like systems. Continuous integrated testing is performed using CircleCI on these Python versions with NumPy versions 1.10 and above.

To run the packaged unit tests, execute the following line from the root of the repository:

python -m unittest discover tests

To check test coverage, make sure the coverage module is installed:

pip install coverage

and then run the packaged unit tests with the coverage module:

coverage run -m unittest discover tests

Quickstart

This library can be used to work with quaternions by simply instantiating the appropriate NumPy arrays and passing them to the required functions. For example:

import rowan
import numpy as np
one = np.array([10, 0, 0, 0])
one_unit = rowan.normalize(one)
assert(np.all(one_unit == np.array([1, 0, 0, 0])))
if not np.all(one_unit == rowan.multiply(one_unit, one_unit)):
    raise RuntimeError("Multiplication failed!")

one_vec = np.array([1, 0, 0])
rotated_vector = rowan.rotate(one_unit, one_vec)

mat = np.eye(3)
quat_rotate = rowan.from_matrix(mat)
alpha, beta, gamma = rowan.to_euler(quat_rotate)
quat_rotate_returned = rowan.from_euler(alpha, beta, gamma)
identity = rowan.to_matrix(quat_rotate_returned)

Documentation

Documentation for rowan is written in reStructuredText and compiled using Sphinx. To build the documentation, first install Sphinx:

pip install sphinx sphinx_rtd_theme

You can then use Sphinx to create the actual documentation in either PDF or HTML form by running the following commands in the rowan root directory:

cd doc
make html # For html output
make latexpdf # For a LaTeX compiled PDF file
open build/html/index.html

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rowan-1.2.2.tar.gz (28.5 kB view details)

Uploaded Source

Built Distribution

rowan-1.2.2-py2.py3-none-any.whl (27.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file rowan-1.2.2.tar.gz.

File metadata

  • Download URL: rowan-1.2.2.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.6

File hashes

Hashes for rowan-1.2.2.tar.gz
Algorithm Hash digest
SHA256 eec83a8bc86ab010ebda8985917fb8c93973c263d2031bd4e22b70c3d61157dc
MD5 a59a62ca3c8cf33aa1365afcca59ec7b
BLAKE2b-256 855fcc8a695ff9c62904f50e268e19a23ff502d2d5d262e2fe365f5999ee01be

See more details on using hashes here.

File details

Details for the file rowan-1.2.2-py2.py3-none-any.whl.

File metadata

  • Download URL: rowan-1.2.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 27.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.6

File hashes

Hashes for rowan-1.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c4b39070ce219989504dacc99cadebf752489331ec8d9851b4eb574ddddce243
MD5 35cfbd9d1518804e43be2f3423f319fb
BLAKE2b-256 1fa19cb0ac53b14d9f700d2f5791fb661e7db2dd8a1996283f9b24496de7cda6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page