← All packages

Attitude

star-quaternion 0.1.0

Rotations with one stated convention

Public state: Released & Verified. The registry label is RELEASED. What the states mean →

Apache-2.0 Released & Verified single file

Summary

Unit quaternion algebra, rotation matrices and axis-angle with a fixed, tested convention (scalar first, Hamilton, active rotation); agrees with NAIF SPICE and SciPy to 9e-16 and refuses non-unit quaternions and non-rotation matrices instead of normalising them silently.

Run in your browser

Edit the code and press Run (or Ctrl+Enter). Python runs in your browser with this package's published code. The first run downloads Python once (about 12 MB).

Runs in the browser: all 37 tests pass in the browser's Python (Pyodide 314.0.7, Python 3.14.2), measured on 20 October 2026.

Use it on your computer

No account and no GitHub needed. Download, then install with one command:

python -m pip install star_quaternion-0.1.0-py3-none-any.whl

In Python: import star_quaternion

Get started →

Cite it, and its bill of materials

For a paper, a report or a supplier file: the citation in two formats, and the software bill of materials (SBOM) in the two standard formats, with the fingerprint of the wheel.

@software{cavazzini_star_quaternion_0_1_0,
  author  = {Cavazzini, Andrea},
  title   = {{star-quaternion}: Rotations with one stated convention},
  version = {0.1.0},
  year    = {2026},
  url     = {https://andrea07072000.github.io/S.T.A.R.-/software/star_quaternion/},
  note    = {Apache-2.0. Source: https://github.com/Andrea07072000/S.T.A.R.-, commit dc09f61d}
}

For developers

Install directly from the public repository:

python -m pip install "star-quaternion @ git+https://github.com/Andrea07072000/S.T.A.R.-.git@dc09f61dcee098d518f070d6a23a8815defc1109#subdirectory=packages/star_quaternion"

README · tests · evidence (GitHub)

Technical sheet

Package
star-quaternion
Import name
star_quaternion
Version
0.1.0
Licence
Apache-2.0
Python
>=3.9
Dependencies
none (standard library only)
Capability
star.attitude.quaternion
Maturity
Released & Verified (RELEASED)
Published commit
dc09f61d

Requirements

  • R1 Convention: quaternion (w, x, y, z) with the scalar first, Hamilton product, ACTIVE rotation; to_dcm(q) is the matrix R with rotate(q, v) = R v; multiply(a, b) applies b first, then a. This is the convention of NAIF SPICE (q2m, m2q, qxq); SciPy stores the scalar last.
  • R2 normalize, conjugate, multiply, rotate, to_dcm, from_dcm, from_axis_angle, to_axis_angle, angle_between_deg. from_dcm uses the largest-component method (exact on half-turns, where the trace method divides by zero) and returns the quaternion with w >= 0. Angles are computed with atan2: a rotation of 1e-12 degrees keeps its value.
  • R3 Measured against SPICE and SciPy on 411 cases (random rotations, identity, half-turns, 1e-9 degree rotations): matrix, matrix-to-quaternion, product, rotated vector and angle agree within 9e-16.
  • R4 Every function returns finite floats or raises ValueError: wrong shape, non-numeric, boolean, NaN, infinite or |value| >= 1e150 input; a zero quaternion or axis; a quaternion whose norm is further than 1e-6 from 1 where a unit quaternion is required (it is refused, not silently normalised); a matrix that is not orthonormal to 1e-9 or is a reflection.

Limits (what is not claimed)

No Euler angles (twelve conventions: a separate, explicit interface is needed), no interpolation, no attitude determination. Frames are the caller's: the functions rotate vectors, they do not know what the frames are called.

Release gate

Computed by the registry from the result files, with the same function that decides RELEASED.

Mutation score, latest measure of each module (needs at least 0.850)
  • star_quaternion.py 0.958 (2026-10-06)
Independent implementations written by others (needs 2)
NAIF CSPICE q2m, m2q, qxq, mxv, raxisa, SciPy Rotation (scalar-last quaternion)
Also compared with, not counted
S.T.A.R.'s own re-derivations: hand-computed quarter turns and Hamilton relations
Result
Released & Verified

Evidence in the registry

CheckStatusRecordedWhat was observed
Clean install from the release tagVERIFIED2026-10-06pytest outside the tree: 37 passed in 0.22s
Unit testsVERIFIED2026-10-0637 passed in 0.45s
ReviewVERIFIED2026-10-06Requirements, interface, units, data provenance, dependency surface and failure behaviour reviewed
ReviewVERIFIED2026-10-06Re-running the cross-check gives a byte-identical evidence file
Reference valueVERIFIED2026-10-06quarter turns about the three axes, the matrix of the +Z quarter turn and the Hamilton relations reproduced to 1e-12; SPICE q2m, m2q, qxq agree on 411 cases to 9e-16 (suite: 37 passed in 0.45s)
Cross-check with independent librariesVERIFIED2026-10-06star_quaternion agrees with two independent rotation libraries and fixes one convention
BenchmarkVERIFIED2026-10-06max absolute difference by operation: dcm 8.9e-16, quat_from_dcm 3.3e-16, product 4.4e-16, rotated_vector_relative 6.4e-16, angle_rad 8.9e-16

Fingerprints (SHA-256)

star_quaternion-0.1.0-py3-none-any.whlc66e06142eacc3ad6ba850d472d43bda045b63fc3a9a8f337447f2d3ec0b6910
star_quaternion.pydf2c68812a8624679517765a7f2647c84156f28bd6ff20137699a75be2dcdc78
star_quaternion-0.1.0-source.zipf7f47443a67aa906716f65caad256d4b785659065251fff643af71acae9df99e

results