The Tier 3 math implementation layer for pyFoundationTools: numpy-backed
math classes (quaternions today, spatial poses / waveforms / polynomials /
trajectory generation as the port lands) that subclass the Tier-2
foundation_abc.math.* ABCs and interoperate with the Tier-1
foundationTypes.mathTypes data carriers, plus a separate matplotlib
plotting helper package.
math_tools.spatial.quaternion.Quaternion— fully-typed OOP wrapper around thenumpy-quaternionlibrary: arithmetic (+ - * /, scalar and quaternion operands),conjugate/inverse/normalized/norm, rotation-matrix and axis/angle conversions, and conversion to/from the spherical small-circle representation.math_tools.spherical— spherical-arc and small-circle utilities (great-circle construction between two points, endpoint computation, Plate Carrée / Cartesian coordinate transforms) built on the ISO physics spherical convention, using the Tier-1UnitSphericalArcType/UnitSphericalSmallCircleTypecarriers.math_tools.errors— theMathToolsErrordomain exception hierarchy (WaveformCompatibilityError,TimestampComparisonError,PolynomialSolveError); programmer errors still raise stdlibTypeError/ValueError.math_plot_helpers.plot_unit_spherical— matplotlib visualizations (Plate Carrée, polar, and 3D multiplot views) for spherical arcs, small circles, and quaternions. This is the only package in the repo permitted to importmatplotlib(tests/test_package_layering.pyenforces the one-waymath_plot_helpers → math_toolsdependency).
See .claude/specs/mathToolsArchitecture.md
for the full architecture and the module map for capability still being
ported (spatial pose, waveforms/DSP, polynomials, OTG trajectory
generation).
The package is not published (pyproject.toml's project URLs point at
github.com/kopecn/py_math_tools, not a PyPI release). Install from source:
make uv-syncSee Development Workflows below for the full
uv--prefixed workflow.
from math_tools.spatial.quaternion import Quaternion
identity = Quaternion.from_components(1, 0, 0, 0)
rotated = Quaternion.from_unit_x_to_vector([0, 1, 0])
print((identity * rotated).normalized())
print(rotated.to_rotation_matrix())import numpy as np
from math_tools.spherical import arc_from_two_points, compute_spherical_arc_endpoint
arc = arc_from_two_points(azimuth1=0, polar1=0, azimuth2=0, polar2=np.pi / 2)
end_azimuth, end_polar = compute_spherical_arc_endpoint(arc)uv run python examples/sphericalPlotting/plotArcs.py
uv run python examples/sphericalPlotting/plotQuatUnitCircles.pyBoth scripts call plot_unit_spherical_multiplot(..., show_plot=True); run
with an interactive matplotlib backend to see the figures, or with
MPLBACKEND=Agg to just exercise the code path non-interactively.
All workflows go through the Makefile (make help lists every target); it
is the source of truth for tooling, not this README.
make uv-sync # create/refresh .venv from pyproject + requirements.txt
make uv-fullCheck # gate: ruff lint + strict mypy + pytest
make uv-format # ruff format + autofixmake uv-refresh is required after the pyFoundationTools pin in
requirements.txt changes — a stale .venv makes the gate meaningless.
- Python >= 3.10
pyFoundationTools,numpy,scipy,numpy-quaternion,matplotlib(seepyproject.tomlfor the names-only dependency declaration andrequirements.txtfor the pinnedpyFoundationToolssource)