Skip to content

Feat/update template module - #1

Closed
kopecn wants to merge 70 commits into
devfrom
feat/update-template-module
Closed

kopecn wants to merge 70 commits into
devfrom
feat/update-template-module

Conversation

@kopecn

@kopecn kopecn commented Aug 11, 2026

Copy link
Copy Markdown
Owner

No description provided.

kopecn and others added 30 commits June 29, 2026 22:52
Rename pyMathTools/pyMathToolsPlotHelpers packages to snake_case
(math_tools/math_plot_helpers) and re-parent QuaternionABC onto the new
foundation_abc layout per the template conformance spec.
Add the math_tools exception hierarchy (MathToolsError and three domain
subtypes) and an AST-based package layering test enforcing math_tools
never imports math_plot_helpers/matplotlib, and math_tools.otg (once it
exists) never imports numpy.
Add .claude/CLAUDE.md and a real README, correct pyproject dependency
names (numpy/scipy were missing), and fix dead MathTypes import paths in
the two spherical plotting examples so they import-run cleanly.
Add PrecisionTimeInterval: an immutable, hashable, attosecond-exact
subclass of PrecisionTimeIntervalABC backed by a single signed total-
attosecond int, with full arithmetic/ordering/wire-dict surface per
precisionTimeMath.md.
Add PrecisionTimestamp: an immutable, hashable, epoch-referenced
timestamp composing a PrecisionTimeInterval offset plus optional
timescale/reference_frame/uncertainty metadata, with Swift-parity
can_compare/compare_validated semantics per precisionTimeMath.md.
Add Position: a numpy-backed 3D point type subclassing PositionABC with
cylindrical/spherical/spherical-iso constructors and inverse accessors,
full vector arithmetic, and the shared API idioms (normalize/normalized,
isclose, __array__, unhashable).
Add dot, rotation_matrix_elements (delegating to to_rotation_matrix),
rotate_position, __array__, and snake_case aliases for the two existing
camelCase methods to Quaternion. Purely additive: legacy
tests/test_quaternion.py is untouched.
Add SpatialPose: an SE(3) pose composing Position + Quaternion, subclassing
SpatialTransformABC. Constructors (components, homogeneous matrix,
Denavit-Hartenberg, identity), composition/transform via *, translated,
inverse, relative_pose, interpolate (lerp + slerp), position/angular
distance (double-cover safe), and normalize/normalized per spatialMath.md.
Add UnivariatePolynomial: an immutable, numpy-backed general polynomial
with ascending-degree float64 coefficient storage, derivative/integrate,
companion-matrix real_roots (raises PolynomialSolveError on the zero
polynomial), and value evaluation via numpy's polyval.
Faithful port of the Swift OTG analytic root kernel (Roots.swift/Utils.swift):
solve_cubic, solve_resolvent, solve_quartic_monic, evaluate_polynomial,
polynomial_derivative(_monic), shrink_interval, integrate_jerk. Corrects a
latent 1/a^4 vs 1/a^3 scaling bug in solve_cubic's halfq term (inert in the
Swift source's monic-only call sites, not inert for general coefficients per
Compliance 2b), documented in polynomials.md. Re-homes
POLYNOMIAL_ZERO_THRESHOLD from polynomial.py into roots.py.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds the scalar waveform container: attosecond-exact PrecisionTime axis,
22 signal generators, None-on-empty statistics (population variance
pinned), attosecond-exact slicing, and the list-vocabulary mutation API.
No DSP mixins yet (composed in a later chunk); no arithmetic operators
(chunk 12).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds the elementwise operator surface: arithmetic (+ - * / // %, forward/
reflected/in-place), bitwise (integer-dtype only), unary, and comparison
producers (elements_equal/less_than/greater_than, isclose_elementwise,
isclose). Waveform-Waveform ops require equal dt+length
(WaveformCompatibilityError otherwise); results carry dt/t0 from the left
operand.

Fixes a bug where Waveform1D's __array__ let numpy's ufunc machinery
bypass Python's operator protocol for numpy-scalar/array operands (e.g.
np.float64(2.0) + w silently returned a bare ndarray, discarding dt/t0)
by setting __array_ufunc__ = None, with a regression test.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The 22 generators themselves landed early in chunk 11 (umbrella spec
groups them under Constructors). This chunk adds the dedicated
compliance-4 test file, and fixes a real gap: sine's frequency parameter
had no default, so the spec's own pinned example (Waveform1D.sine(n=1000))
raised TypeError. frequency now defaults to 1.0 Hz on sine only, matching
the literal acceptance criterion.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds the shared substrate for the upcoming DSP mixin chunks: all 12
support enums + 15 frozen descriptor dataclasses (eq=False on the 5
ndarray-bearing ones), the WaveformProtocol structural contract mixins
will depend on, and Waveform1D._with_values (the replace-values factory).
WaveformTriggerType (undefined in the Python spec text) is flattened from
Swift's associated-value enum into a 4-member discriminator, with the
payload moved onto WaveformTrigger's optional fields.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds the position time-series aggregate container: (n,3) float64 storage,
on-demand Position materialization, from_components with length/dt
validation, vectorized normalize/component_waveforms (never loops over
materialized elements), and the full mutation/extend/concatenate verb set.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds the quaternion time-series aggregate container, mirroring
WaveformPosition's structure: (n,4) float64 storage in w-first order
(pinned repo-wide, not Swift's x-first), on-demand Quaternion
materialization, w-first component_waveforms/from_components, vectorized
are_all_unit/normalize, and the full mutation/extend/concatenate verb set.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds the 6-DOF pose time-series container: parallel (n,3) position +
(n,4) w-first quaternion arrays, from_poses/from_waveforms constructors,
nested component_waveforms reusing chunks 15/16's per-axis NamedTuples,
and the is_valid/sample_count=min(...) semantics for the (deliberately
constructible) unequal-array-length edge case. Completes Track C
(chunks 11-17).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Add CalcMixin (integrate/derivative). Fixed a runtime bug in the planned
mixin pattern: nominally subclassing WaveformProtocol shadows Waveform1D's
real properties under C3 linearization, so mixins now self-type instead
(mypy's documented "mixin classes" idiom). Spec and protocol docs updated
accordingly for chunks 19-29.
Add CorrelationMixin (auto_correlation, cross_correlation,
find_max_correlation), backed by scipy.signal.correlate. Lag sign kept as
scipy's native convention (spec-permitted divergence from Swift), documented
in the module docstring.
Add EnvelopeMixin: amplitude_envelope (Hilbert), upper_lower_envelopes
(peak/valley interpolation), instantaneous_amplitude (HILBERT/RMS/PEAK).
Add SpectralMixin: fft, power_spectral_density (Welch), spectrogram,
mel_spectrogram, spectral_features (centroid/spread/rolloff/flatness).
Add FilteringMixin: low/high/band-pass, dispatcher (incl. band-stop),
moving-average, exponential, Savitzky-Golay, Whittaker-Henderson filters,
and frequency_response.
kopecn and others added 28 commits July 21, 2026 16:24
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Corrects otg.md's numeric-truth-table atol from 1e-8 to 1e-6 (semver
0.0.4 -> 0.0.5): the Swift source literals are recorded to only 6
decimal places, so 1e-8 was unsatisfiable by any correct port. Also
corrects "32-case" to "31-case" (the Swift array has 31 entries).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Final chunk of the math-tools-port plan: curates the flat
`import math_tools as mt` root surface (19 re-exports, no logic),
pinned by test_public_surface.py.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Fix j·tf⁴→j·tf³ transcription defect in UDUD-T0246 discriminant
(tf_p3→tf_p2) at position_third_order_step2.py:1731,1752,1763; add
regression test. Scaffold Track F corrective plan overview.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Trivial branch builds fixed-length 8-element a/v/p arrays and sets
pf to current position, per otg.md fidelity requirement 1; add
regression tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace 8 bare math.sqrt sites in position_third_order_step1 with the
IEEE-754 _ieee754_sqrt (NaN on negative radicand) so out-of-domain
candidates are rejected by guards instead of raising; add regression test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Position.is_unit uses rtol=0.0 so only spec atol=1e-12 applies;
days_since_epoch/seconds_of_day derive from signed total_attoseconds
(floor div/mod) for correct pre-epoch behavior. Add regression tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
solve_cubic uses a scale-relative leading-coefficient degeneracy
threshold; shrink_interval guards f==0 before the Newton step to
avoid a ZeroDivisionError trap. Update polynomials.md (semver 0.0.4)
and add regression tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Route __getitem__/get/pop through a shared _resolve_index helper that
bounds against sample_count (not either raw array's length), per
waveformCore.md compliance 9; add regression tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add __array__ and isclose to the three aggregate waveform containers,
restore WaveformSpatialPose.from_components, and fix Waveform1D.__array__
copy=False contract (C-7). Update waveformCore.md (semver 0.0.3) and add
tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
chirp/heaviside/sigmoid derive total duration from an endpoint-inclusive
(n-1)*dt span via _span_seconds (0.0 at n<=1), fixing off-by-one phase
conventions. Update waveformCore.md (semver 0.0.4) and add tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Give math_tools.spherical and math_plot_helpers curated __all__
re-exports; update README/examples to import at subpackage level; pin
the surface with tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Reconcile window symmetric/periodic conventions: add periodic param to
windowing helpers (default symmetric), share DEFAULT_KAISER_BETA across
windowing/spectral. Document per-family rule in waveformDsp.md (semver
0.0.8) and add tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Close 11 Track B/C test-coverage gaps (hashability, double-cover
isclose, operator surface, generator analytics, bulk smoke, indexing);
set Quaternion.__hash__ = None explicitly (the one permitted src edit).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Close 23 DSP test-coverage gaps with value-level known-answer/analytic
assertions across all DSP mixin families; tests only, no src changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Close 8 OTG oracle-coverage gaps: add a reproducible 450-case multi-DOF
corpus that exercises Step2 (0->900 invocations), plus continuity,
retarget, invariant, and the missing testBugFix_NegativeTimeInterval_Case3
cases. Correct chunk 42's stale 'all 4 testBugFix' claim. Tests/data only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Reconcile docs against post-fix repo: fix dead CI/workflow refs, stale
OTG tolerance (1e-6) and case-count claims, install/keyword drift; wire
examples/ into the gate (lint+typecheck clean); delete hints.py dead
__main__; add governance tests. Bump templateConformance (0.0.3) and
overview (0.1.1).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
pyproject declares dependency NAMES ONLY per the BKM; requirements.txt carries
the pins and git pointers. testInEnvInstallFromSetup ran `pip install ".[dev]"`
alone, so pip resolved the bare name pyFoundationTools against PyPI and failed
with "No matching distribution found".

Every other install path here already installs -r requirements.txt first.
make testInEnv now green: 1550 passed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Back-port of the py-cookiecut rename. testInEnv green end-to-end after the
rename (1550 passed in the clean room).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@kopecn
kopecn deleted the branch dev August 14, 2026 17:15
@kopecn kopecn closed this Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant