Installation and verification

Python 3.12 is the tested runtime. Install the release from PyPI:

python -m pip install syncmoments

To run the tests, install from a checkout (or the source distribution, which carries the tests):

python -m pip install -e '.[validation]'
python -m pytest tests -q

A plain run skips the 1661 tests marked slow (1573 of them in the automatic-differentiation transform matrix, 24 third-order derivative checks of the transfer, the others mostly the full-resolution benchmark); run them with python -m pytest tests -m slow or SYNCMOMENTS_RUN_SLOW=1.

Two environments are tested: JAX 0.10.0, Equinox 0.13.7, NumPy 2.3.5, SciPy 1.16.3, Matplotlib 3.10.8 and pytest 9.0.2; and JAX 0.10.2, Equinox 0.13.8, NumPy 2.5.3, SciPy 1.18.1 without mpmath. The high-precision references of the tests are literals (most generated by scripts/reference_constants.py); two transfer tests recompute theirs with mpmath on random slabs and are skipped without it. The benchmark tests use a verbatim, hash-checked copy of the manuscript’s reference implementation and saved results (tests/model/reference), so they run without the manuscript repository; the source distribution includes the tests, scripts and documentation. The dependency ranges in pyproject.toml do not imply every version combination has been tested. The base installation does not require SciPy. Validation uses it for independent special-function, integration and matrix-exponential references; the optional high_harmonic extra also uses SciPy for host-side high-order values and basis preparation. The optional coefficient certificate additionally requires mpmath.

Importing syncmoments enables JAX float64 globally for scientific accuracy. Import it before creating arrays; this is a documented compatibility side effect. For a source checkout without installation, PYTHONPATH=. remains supported.

PYTHONPATH=. python scripts/run_all.py                 # pytest, diagnostics, figures
PYTHONPATH=. python scripts/run_all.py --no-figures    # pytest and diagnostics

Printed diagnostics alone are not pass/fail physics tests. The runner first executes pytest, then reports script completion. Generated companion figures are package demonstrations; the manuscript uses its separate independent figure generators and captions. Do not substitute one set without checking assumptions.

Independent symbolic derivation

derivation/ contains local Wolfram scripts that derive and check the helical orbit, retarded radiation, absolute harmonic powers and Stokes basis conventions from the classical equations. Run wolframscript -file derivation/verify.wls to regenerate the report. It also compares the complex harmonic amplitudes with direct Fourier integration of the original electric field, independently of this package’s Python implementation.