rowan

A Python package for working with quaternions.

https://github.com/glotzerlab/rowan

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
    3 of 8 committers (37.5%) from academic institutions
  • Institutional organization owner
    Organization glotzerlab has institutional domain (glotzerlab.engin.umich.edu)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.2%) to scientific vocabulary

Keywords from Contributors

polygons computational-geometry geometry physics polyhedra shapes signac distributed energy-system-model mesh
Last synced: 6 months ago · JSON representation

Repository

A Python package for working with quaternions.

Basic Info
Statistics
  • Stars: 29
  • Watchers: 7
  • Forks: 8
  • Open Issues: 1
  • Releases: 0
Created about 7 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License

README.rst

=====
rowan
=====

.. contents::
    :local:

|ReadTheDocs|
|PyPI|
|conda-forge|
|JOSS|

.. |ReadTheDocs| image:: https://readthedocs.org/projects/rowan/badge/?version=latest
   :target: http://rowan.readthedocs.io/en/latest/?badge=latest
.. |PyPI| image:: https://img.shields.io/pypi/v/rowan.svg
   :target: https://pypi.org/project/rowan/
.. |conda-forge| image:: https://img.shields.io/conda/vn/conda-forge/rowan.svg
   :target: https://anaconda.org/conda-forge/rowan
.. |JOSS| image:: http://joss.theoj.org/papers/10.21105/joss.00787/status.svg
   :target: https://doi.org/10.21105/joss.00787

Welcome to the documentation for rowan, a package for working with quaternions!
Quaternions, which form a number system with various interesting properties, were originally developed for classical mechanics.
Although they have since been largely displaced from this application by vector mathematics, they have become a standard method of representing rotations in three dimensions.
Quaternions are now commonly used for this purpose in various fields, including computer graphics and attitude control.

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``.
This package provides tools for standard algebraic operations on quaternions as well as a number of additional tools for *e.g.* measuring distances between quaternions, interpolating between them, and performing basic point-cloud mapping.
A particular focus of the rowan package is working with unit quaternions, which are a popular means of representing rotations in 3D.
In order to provide a unified framework for working with the various rotation formalisms in 3D, rowan allows easy interconversion between these formalisms.

Core features of rowan include (but are not limited to):

* Algebra (multiplication, exponentiation, etc).
* Derivatives and integrals of quaternions.
* Rotation and reflection operations, with conversions to and from matrices, axis angles, etc.
* Various distance metrics for quaternions.
* Basic point set registration, including solutions of the Procrustes problem
  and the Iterative Closest Point algorithm.
* Quaternion interpolation (slerp, squad).

Getting Started
===============

Installation
------------

The recommended methods for installing rowan are using **pip** or **conda**.
To install the package from PyPI, execute:

.. code-block:: bash

    $ pip install rowan

To install the package from conda, first add the **conda-forge** channel and
then install rowan:

.. code-block:: bash

    $ conda config --add channels conda-forge
    $ conda install rowan


If you wish, you may also install rowan by cloning `the repository `_ and running the setup script:

.. code-block:: bash

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

The minimum requirements for using rowan are:

* Python >= 3.8
* NumPy >= 1.21

To use the mapping subpackage, rowan also requires

* SciPy >= 1.7

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:

.. code-block:: python

    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)

Running Tests
-------------

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

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

.. code-block:: bash

    python -m unittest discover tests


Running Benchmarks
------------------
Benchmarks for the package are contained in a Jupyter notebook in the ``benchmarks`` folder in the root of the repository.
If you do not have or do not wish to use the notebook format, an equivalent Benchmarks.py script is also included.
The benchmarks compare rowan to two alternative packages, so you will need to install ``pyquaternion`` and ``numpy_quaternion`` if you wish to see those comparisons.

Building Documentation
----------------------

You can also build this documentation from source if you clone the repository.
The documentation is written in `reStructuredText `_ and compiled using `Sphinx `_.
To build from source, first install Sphinx:

.. code-block:: bash

    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:

.. code-block:: bash

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

Support and Contribution
========================

This package is hosted on `GitHub `_.
Please report any bugs or problems that you find on the `issue tracker `_.

All contributions to rowan are welcomed via pull requests!
Please see the `development guide `_ for more information on requirements for new code.

Owner

  • Name: Glotzer Group
  • Login: glotzerlab
  • Kind: organization
  • Location: University of Michigan

We develop molecular simulation tools to study the self-assembly of complex materials and explore matter at the nanoscale.

GitHub Events

Total
  • Watch event: 8
  • Delete event: 21
  • Member event: 1
  • Issue comment event: 5
  • Push event: 63
  • Pull request review comment event: 2
  • Pull request review event: 6
  • Pull request event: 35
  • Create event: 22
Last Year
  • Watch event: 8
  • Delete event: 21
  • Member event: 1
  • Issue comment event: 5
  • Push event: 63
  • Pull request review comment event: 2
  • Pull request review event: 6
  • Pull request event: 35
  • Create event: 22

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 468
  • Total Committers: 8
  • Avg Commits per committer: 58.5
  • Development Distribution Score (DDS): 0.09
Past Year
  • Commits: 28
  • Committers: 6
  • Avg Commits per committer: 4.667
  • Development Distribution Score (DDS): 0.5
Top Committers
Name Email Commits
Vyas Ramasubramani v****b@u****u 426
Bradley Dice b****e@b****m 16
Joshua A. Anderson j****r@u****u 14
pre-commit-ci[bot] 6****] 6
dependabot[bot] 4****] 3
Tim Moore m****c@u****u 1
Pierre de Buyl p****l@c****e 1
Domagoj Fijan 5****n 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 14
  • Total pull requests: 91
  • Average time to close issues: about 1 month
  • Average time to close pull requests: about 1 month
  • Total issue authors: 3
  • Total pull request authors: 12
  • Average comments per issue: 1.57
  • Average comments per pull request: 0.44
  • Merged pull requests: 74
  • Bot issues: 0
  • Bot pull requests: 48
Past Year
  • Issues: 0
  • Pull requests: 40
  • Average time to close issues: N/A
  • Average time to close pull requests: 10 days
  • Issue authors: 0
  • Pull request authors: 6
  • Average comments per issue: 0
  • Average comments per pull request: 0.08
  • Merged pull requests: 31
  • Bot issues: 0
  • Bot pull requests: 36
Top Authors
Issue Authors
  • bdice (12)
  • klarh (1)
  • malramsay64 (1)
Pull Request Authors
  • vyasr (28)
  • dependabot[bot] (24)
  • pre-commit-ci[bot] (13)
  • pull-request-submitter[bot] (10)
  • bdice (6)
  • janbridley (3)
  • joaander (2)
  • Fab7c4 (1)
  • DomFijan (1)
  • tcmoore3 (1)
  • pdebuyl (1)
  • renovate[bot] (1)
Top Labels
Issue Labels
bug (5) major (4) enhancement (2) minor (2) proposal (1) task (1)
Pull Request Labels
dependencies (25) github_actions (10) minor (4) bug (2) python (2) enhancement (1)

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 226,986 last-month
  • Total docker downloads: 77
  • Total dependent packages: 7
    (may contain duplicates)
  • Total dependent repositories: 17
    (may contain duplicates)
  • Total versions: 23
  • Total maintainers: 4
pypi.org: rowan

Perform quaternion operations using NumPy arrays

  • Homepage: https://github.com/glotzerlab/rowan
  • Documentation: https://rowan.readthedocs.io/
  • License: rowan BSD-3 Clause Open Source Software License Copyright 2017-2024 The Regents of the University of Michigan All rights reserved. rowan may contain modifications ("Contributions") provided, and to which copyright is held, by various Contributors who have granted The Regents of the University of Michigan the right to modify and/or distribute such Contributions. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  • Latest release: 1.3.2
    published over 1 year ago
  • Versions: 14
  • Dependent Packages: 3
  • Dependent Repositories: 13
  • Downloads: 226,986 Last month
  • Docker Downloads: 77
Rankings
Dependent packages count: 2.3%
Docker downloads count: 2.9%
Dependent repos count: 4.0%
Downloads: 5.4%
Average: 7.4%
Stargazers count: 14.5%
Forks count: 15.3%
Maintainers (4)
Last synced: 6 months ago
conda-forge.org: rowan

rowan performs quaternion operations directly on numpy arrays. The package does not require conversion of arrays into a special quaternion object, ensuring easy integration into existing code, but broadcasting is fully supported natively for all operations to ensure that code is performant.

  • Versions: 9
  • Dependent Packages: 4
  • Dependent Repositories: 4
Rankings
Dependent packages count: 12.5%
Dependent repos count: 16.1%
Average: 33.9%
Stargazers count: 52.9%
Forks count: 54.1%
Last synced: 6 months ago

Dependencies

requirements/requirements-testing.txt pypi
  • coverage ==6.3.2 test
  • numpy >=1.15.0 test
  • pytest ==7.0.1 test
  • pytest-cov ==3.0.0 test
  • scipy >=1.0.0 test
requirements.txt pypi
  • numpy >=1.15.0
pyproject.toml pypi
  • numpy >=1.21