Released: Feb 10, A fully featured, pythonic library for representing and using quaternions. View statistics for this project via Libraries. Tags quaternion, math, maths, physics, orientation, pose, geometry, visualisation, animation. A fully featured, pythonic library for quaternion representation, manipulation, 3D animation and geometry. Feb 10, Dec 2, Oct 13, Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Warning Some features may not work without JavaScript. Please try enabling it if you encounter problems. Search PyPI Search. Latest version Released: Feb 10, Navigation Project description Release history Download files. Project links Homepage Download. Maintainers kieranwynn. Project description Project details Release history Download files Project description A fully featured, pythonic library for quaternion representation, manipulation, 3D animation and geometry.

pyquaternion 0.9.5

Project details Project links Homepage Download. Release history Release notifications This version. Download files Download the file for your platform. Files for pyquaternion, version 0. Close Hashes for pyquaternion File type Wheel. Python version py2. Upload date Feb 10, Hashes View. Python version py3.

File type Source. Python version None.GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. If nothing happens, download GitHub Desktop and try again. If nothing happens, download Xcode and try again. If nothing happens, download the GitHub extension for Visual Studio and try again. The code was originally based on code by Martin Ling which he wrote with help from Mark Wiebebut has been rewritten with ideas from rational to work with both python 2.

The basic requirements for this code are reasonably current versions of python and numpy. In particular, python versions 2. Also, any numpy version greater than 1. Scipy is a standard python package for scientific computation, and implements interfaces to C and Fortran codes for optimization among other things need for finding mean and optimal rotors.

Numba uses LLVM to compile python code to machine code, accelerating many numerical functions by factors of anywhere from 2 to It is possible to run all the code without numbabut these particular functions are roughly 4 to times slower without it.

The only drawback of numba is that it is nontrivial to install on its own. Fortunately, the best python installer for scientific python, anacondamakes it trivial. Just install the main anaconda package, which installs both numba and scipy. If you prefer the smaller download size of miniconda which comes with minimal extrasyou'll also have to run this command:. Assuming you use conda to manage your python installation which is currently the preferred choice for science and engineering with pythonyou can install this package simply as.

If you prefer to use pip whether or not you use condayou can instead do. If you refuse to use condayou might want to install inside your home directory without root privileges.

Conda does this by default anyway. This is done by adding --user to the above command:. Note that pip will attempt to compile the code — which requires a working C compiler.The code was originally based on code by Martin Ling which he wrote with help from Mark Wiebebut has been rewritten with ideas from rational to work with both python 2.

The basic requirements for this code are reasonably current versions of python and numpy. In particular, python versions 2. Also, any numpy version greater than 1. Scipy is a standard python package for scientific computation, and implements interfaces to C and Fortran codes for optimization among other things need for finding mean and optimal rotors. Numba uses LLVM to compile python code to machine code, accelerating many numerical functions by factors of anywhere from 2 to It is possible to run all the code without numbabut these particular functions are roughly 4 to times slower without it.

The only drawback of numba is that it is nontrivial to install on its own. Fortunately, the best python installer for scientific python, anacondamakes it trivial.

Just install the main anaconda package, which installs both numba and scipy. Assuming you use conda to manage your python installation which is currently the preferred choice for science and engineering with pythonyou can install this package simply as. If you prefer to use pip whether or not you use condayou can instead do. If you refuse to use condayou might want to install inside your home directory without root privileges.

Conda does this by default anyway. This is done by adding --user to the above command:. Note that pip will attempt to compile the code — which requires a working C compiler. This should work regardless of the installation method, as long as you have a compiler hanging around.

However, note that you will need to have at least numpy installed before this can compile because this package uses a header file provided by numpy. The full documentation can be found on Read the Docsand most functions have docstrings that should explain the relevant points.

The following are mostly for the purposes of example. Quaternion components are stored as doubles. The unary tests isnan and isinf return true if they would return true for any individual component; isfinite returns true if it would return true for all components. Real types may be cast to quaternions, giving quaternions with zero for all three imaginary components. Complex types may also be cast to quaternions, with their single imaginary component becoming the first imaginary component of the quaternion.

Quaternions may not be cast to real or complex types. Several array-conversion functions are also included. But the actual data is identical in the two cases. Bug reports and feature requests are entirely welcome with very few exceptions. For bug reports, please try to include a minimal working example demonstrating the problem. Pull requests are also entirely welcome, of course, if you have an idea where the code is going wrong, or have an idea for a new feature that you know how to implement.

This code is routinely tested on recent versions of both python 2. This code is, of course, hosted on github.

python import quaternion

Because it is an open-source project, the hosting is free, and all the wonderful features of github are available, including free wiki space and web page hosting, pull requests, a nice interface to the git logs, etc. Github user Jon Long longjon has provided some elegant contributions to substantially improve several tricky parts of this code.The following aims to familiarize you with the basic functionality of quaternions in pyquaternion.

It provides an entry point and a quick orientation no pun intended for those who want get stuck straight in. More comprehensive feature summaries can be found in the features and operations documentation. If you want to learn more about quaternions and how they apply to certain problems, you can read about quaternions hereand their application to rotations here. Note: pyquaternion requires Numpy for the representation of arrays and matrices.

Chances are if you're needing quaternions, you've been dealing with numerical computation and you're already familiar with numpy. If not, don't worry, it will be installed into your environment automatically. Great, you now have pyquaternion installed and you're ready to roll. Or pitch. Or yaw. No judging here :. In your code, simply import the Quaternion object from the pyquaternion module:. Note: There are many ways to create a Quaternion object.

See the initialisation section for a complete guide. Now you can do a bunch of useful things with your new quaternion object.

Let's try rotating a vector:. A cool feature of quaternions is that they can be intuitively chained together to form a composite rotation from a sequence of discrete rotations:. Quaternions are used extensively in animation to describe smooth transitions between known orientations. This is known as interpolation. This is an example of an area where quaternions are preferred to rotation matrices as smooth interpolation is not possible with the latter. Here's quaternion interpolation in action:.

In the code above, the expression Quaternion. This could easily be plugged into a visualisation framework to show smooth animated rotation sequences.

Read the full documentation on interpolation features here. For a full demonstration of 3D interpolation and animation, run the demo2.Indexing within a rotation is supported since multiple rotation transforms can be stored within a single Rotation instance. 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 :.

Here we initialize a single rotation about a single axis:. A Rotation instance can be indexed and sliced as if it were a single 1D array or list:.

These examples serve as an overview into the Rotation class and highlight major functionalities. This class provides an interface to initialize from and represent rotations with: Quaternions Rotation 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.

See also Slerp. Quick search. Last updated on Dec 19, Created using Sphinx 2.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

I am trying to import the module quaternion into my code to be able to rotate my sensor data. I keep getting the error, 'No module named 'quaternion''. I should be able to run the script, but I don't know what is the error. I feel like I need to change something about importing the module.

You should solve this by installing the conda package for quaternion available from conda-forge with conda install -c conda-forge quaternion. In your case it looks like you're not using pip from your conda environment, which results in installing the package outside this environment. If you're interested, here are some guidelines on using pip with condaand future evolutions on interoperability between the two. Learn more. Ask Question. Asked 10 months ago. Active 10 months ago. Viewed 1k times.

To install the quaternion module to my computer I used my command prompt and typed: conda activate base pip install quaternion When I run my code in visual studio code, I am running it through the terminal in the base.

python import quaternion

Here are all my imports at the top of the script: import pandas as pd import numpy as np from scipy. Any help would be greatly appreciated. Eric Eric 55 6 6 bronze badges. Or other thing may be is that conda activate base must have started its own virtual environment where the module quaternion was installed. I would suggest for system wide use do pip install module on terminal if you are on linux or similar thing on other platform.Released: May 5, View statistics for this project via Libraries.

Tags quaternion, transformations. A library to handle quaternions. The library is partly tested see tests. It would be great to get everything edge cases and functions under testing. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

May 5, May 2, Apr 14, Apr 12, Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

PythonでQuaternionを使う ~ numpy-quaternion ~

Warning Some features may not work without JavaScript. Please try enabling it if you encounter problems. Search PyPI Search.

Latest version Released: May 5, A package to handle quaternions. Navigation Project description Release history Download files. Project links Homepage. Maintainers mjsobrep. Project description Project details Release history Download files Project description A library to handle quaternions. There are some great resources out there on quaternions. Project details Project links Homepage.

Release history Release notifications This version. Download files Download the file for your platform. Files for quaternions, version 0. Close Hashes for quaternions File type Wheel. Python version py2.

python import quaternion

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *