Quaternions library
This is a library for dealing with quaternions in python in a unified way.
To install it:
$ pip install satellogic_quaternions
Examples of code:
In [1]: from quaternions import Quaternion
In [2]: q1 = Quaternion(1, 2, 3, 4)
In [3]: q2 = Quaternion(2, 3, 5, 8)
In [4]: q1 + q2
Out[4]: Quaternion(3, 5, 8, 12)
In [5]: q1 * q2
Out[5]: Quaternion(-51, 3, 15, 15)
In [6]: q1 / q2
Out[6]: Quaternion(0.53921568627450989, 0.049019607843137247, -0.029411764705882353, 0.0098039215686274439)
In [7]: print(q1)
(1+2i+3j+4k)
Most of all the quaternions we use are unitary (not like the example above)
In [8]: q1.is_unitary()
Out[8]: False
In [9]: q1 / q1.norm()
Out[9]: Quaternion(0.18257418583505536, 0.36514837167011072, 0.54772255750516607, 0.73029674334022143)
In [10]: q1 /= q1.norm()
In [11]: q1.is_unitary()
Out[11]: True
Usually, quaternions are used for rotating vectors. This is done with numpy:
In [12]: q1.matrix
Out[12]:
array([[-0.66666667, 0.66666667, 0.33333333],
[ 0.13333333, -0.33333333, 0.93333333],
[ 0.73333333, 0.66666667, 0.13333333]])
In [14]: q1.matrix.dot([2, 3, -4])
Out[14]: array([-0.66666667, -4.46666667, 2.93333333])
In [16]: q1.matrix.dot([1, 0, 0])
Out[16]: array([-0.66666667, 0.13333333, 0.73333333])
A unitary quaternion matrix is unitary. The inverse is the transpose and it is also the matrix of the inverse quaternion. And the inverse quaternion of a unitary quaternion is the conjugate:
In [17]: q1.conjugate()
Out[17]: Quaternion(0.18257418583505536, -0.36514837167011072, -0.54772255750516607, -0.73029674334022143)
In [18]: q1
Out[18]: Quaternion(0.18257418583505536, 0.36514837167011072, 0.54772255750516607, 0.73029674334022143)
In [19]: q1 * q1.conjugate()
Out[19]: Quaternion(0.99999999999999978, 0.0, 0.0, 0.0)
In [20]: q1.conjugate().matrix
Out[20]:
array([[-0.66666667, 0.13333333, 0.73333333],
[ 0.66666667, -0.33333333, 0.66666667],
[ 0.33333333, 0.93333333, 0.13333333]])
License
quaternions is Satellogic SA Copyright 2017-2025. All our code is GPLv3 licensed.
Metadata
Release files for satellogic_quaternions 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| satellogic_quaternions-0.1.8.tar.gz | 1.3 MB | Without provenance | Details for satellogic_quaternions-0.1.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| satellogic_quaternions-0.1.8-py3-none-any.whl | Python 3 | none | any | Details for satellogic_quaternions-0.1.8-py3-none-any.whl |
Total release size: 1.3 MB
Release files / satellogic_quaternions-0.1.8.tar.gz
| Download URL | satellogic_quaternions-0.1.8.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8c36249cccfdea45a2807cf9c89f4c7a14d3f1068f5942a1956d32a65830858
|
|
BLAKE2b-256 checksum How to use checksums |
526be9d20b1a2f16e61a0e4262697f2970589c7fcdf5ea0a17ecfe16df3a2ee0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.11
|
Release files / satellogic_quaternions-0.1.8-py3-none-any.whl
| Download URL | satellogic_quaternions-0.1.8-py3-none-any.whl |
|---|---|
| Size | 21.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b57c7ef3947b78297843bb8a770cad905ee22e357115d14730b20ba44153c86
|
|
BLAKE2b-256 checksum How to use checksums |
a39a820fa1fa8feec9a3a2305a9193fc168176f39bcbd93b6a0e26f4f0a69b84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.11
|
Security for satellogic_quaternions 0.1.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.