Skip to content

Releases: zzhang0123/syncmoments

SyncMoments 0.5.0

Choose a tag to compare

@zzhang0123 zzhang0123 released this 28 Sep 06:29

SyncMoments 0.5.0

This release adds a finite-$\gamma$ high-order harmonic route for declared
smooth compact channels. It keeps the discrete helical-orbit harmonic
reference, Stokes $I$ and $V$, and each line's own response and Faraday
phase. It does not replace the harmonic sum with the leading ultra-relativistic
continuum model.

Added

  • high_order_channel_modes selects direct or accelerated work from the
    number of active integer modes in each channel. The broad 0.1–3 GHz,
    $B=5,\mu\mathrm G$, $\gamma=3000$ fixed-point example evaluated 2,104
    continuous-order samples without allocating an array spanning roughly
    $10^{10}$–$10^{12}$ harmonics. This is finite resource evidence; its
    accelerated sum, SciPy Bessel and roundoff errors remain unbounded.
  • build_high_order_basis prepares a reusable fixed-reference $N\leq1$
    moment response matrix, including first $\gamma/B$ derivatives and
    line-dependent phase derivatives where requested. Its ordinary numerical
    term is unbounded; the response matrix can be reused in prediction and
    fitting without repeating the harmonic calculation.
  • certify_high_order_basis_coarse optionally attaches a per-column
    fixed-reference numerical envelope to that stored matrix. It covers the
    ideal unit-peak bump and TaylorPhase under exact-binary inputs and
    experimental mpmath interval arithmetic. Changes to certified coefficients
    or inputs fail closed, including under JIT. The envelope propagates through
    predict without rerunning certification. A high-$\gamma$ $N=1$ example
    produced an error near $9\times10^{35}$ in response units, far above the
    signal; a finite certificate is not a useful science tolerance by itself.
  • The existing low-order HarmonicKernel prunes support-excluded integer
    ranges before Bessel evaluation. A manually truncated potentially active
    range keeps an unbounded harmonic-truncation term.

Scope and installation

The optional high-order value and basis route needs SciPy through
syncmoments[high_harmonic]; the offline certificate also needs mpmath.
Nonzero $\gamma/B$ displacement Taylor remainders, omitted physical effects,
population tails and downstream inference bias have no bound from this
release. Unsupported channels, modes, tolerances and resource caps raise or
retain unbounded status. The
high-order guide
separates the exploratory point values, exploratory matrix and conditional
coefficient envelope.

Release checks

The focused release gate passed 252 tests; version and documentation checks passed 36 tests (overlapping the focused gate). The strict Sphinx HTML build, Black, Ruff, isolated source/wheel build, strict Twine check, and independent wheel import passed. The broader non-slow suite was interrupted after 621 passing tests and was not completed. These checks do not establish the unbounded scientific error terms described above.

SyncMoments 0.4.0

Choose a tag to compare

@zzhang0123 zzhang0123 released this 26 Sep 06:58

SyncMoments 0.4.0 adds identifiable moment reconstruction from a spectral energy distribution (SED) and makes the polarised transfer values accurate at large Faraday depth.

Identifiable moment reconstruction

New public API in syncmoments.model.fit:

  • reduce_response groups equal and proportional responses before any data is seen. It returns an explicit map C = H T with coefficient labels, units and zero-response slots.
  • fit_combinations fits the grouped response in a declared coefficient metric (T = L Q, whitened SVD). It returns:
    • the identifiable combinations beta with their noise covariance;
    • the estimator K;
    • the resolution projector Pi;
    • the full-tensor representative;
    • the unresolved directions.
  • CoefficientLayout, ResponseReduction and CombinationFit describe the inputs and results.

The results keep three claims apart: analytic redundancy of the kernel, numerical rank at a stated tolerance, and recoverability under the noise and precision threshold. Discrepancies propagate as K delta and |K| E. An unresolved direction is reported as unbounded, never as zero. The analytic grouping covers the ultra-relativistic continuum kernel; other kernels use their structural zeros only.

scripts/sed_reconstruction_example.py runs the manuscript's smooth correlated continuum example through these APIs. The mock data come from an independent population integration. The example reproduces the historical research run:

  • 60 coefficients, 52 active, 30 grouped, 9 retained;
  • numerical rank 26;
  • chi2 55.2361 on 63 degrees of freedom, within 4e-13.

In clusters of equal singular values the package uses a canonical basis, so individual beta there differ from the research run by a rotation within the cluster; the subspaces and norms agree. docs/guide/reconstruction.md explains the example. The figure and the CSV are in the repository. The JSON and NPZ records of the run are attached here, generated from the tagged commit with a clean tree.

Transfer accuracy

  • Values. transfer_slab values now use the same ceil-count Pade-13 exponential as the derivatives. Against mpmath, the value error was up to 2.8e-5 of the largest Stokes component at large Faraday depth (36.3 MHz, |K ds|_1 = 8.7e4) and is now about 1e-12. Values are no longer bit-identical to 0.3.0.
  • Path-length derivative. d out / d ds is computed as Phi (eps - K S). This removes the cancellation that gave O(1) and larger relative errors in ill-conditioned slabs; the errors are now within the stated roundoff bound.
  • Third derivatives. Tests now cover them.

Validation

  • Test suites. Both environments pass the fast and slow suites with no failures:
    • JAX 0.10.0, Equinox 0.13.7, NumPy 2.3.5.
    • JAX 0.10.2, Equinox 0.13.8, NumPy 2.5.3.
  • Docs and build. The documentation builds with -W under Sphinx 8.2.3 and 9.1.0, and rendered headings match the sources. The wheel and sdist pass twine check --strict.
  • Manuscript numbers. The Section 5.3.1 benchmark numbers are unchanged.

CHANGELOG.md lists every change with measurements, and its "Known limitations" section lists what remains open.

Install

python -m pip install syncmoments==0.4.0

Documentation: https://syncmoments.readthedocs.io.

SyncMoments 0.3.0

Choose a tag to compare

@zzhang0123 zzhang0123 released this 25 Sep 21:11

SyncMoments 0.3.0 is the companion package of Zhang & Chluba, A statistical framework for the modelling of synchrotron emission. This release renames the package and improves the numerics, dependency robustness and model options of syncmoments.model.

Renamed

The package was called synchro; that name on PyPI belongs to an unrelated project. From this release:

  • The display name is SyncMoments. Install it with pip install syncmoments and import it with import syncmoments.
  • There is no compatibility alias. Replace import synchro and from synchro... with syncmoments.
  • The slow-test switch is now SYNCMOMENTS_RUN_SLOW=1.
  • The v0.2.0 tag keeps the old name.

Highlights

  • Memory. At the manuscript benchmark size (L = 8, N = 2), building the basis now peaks at 0.84 GB on JAX 0.10.0 and 0.97 GB on JAX 0.10.2. 0.2.0 needed 10.9 GB and 45.6 GB. README continuum example (b) needs 1.2 GB and 1.8 GB, against 0.2.0's 6.4 GB and 26.7 GB.
  • Harmonic-kernel derivatives. Derivatives in field strength come from an analytic Bessel recurrence (HarmonicKernel(derivatives="analytic"), the default), so no tangent passes through the Bessel quadrature.
  • Model options. Lower-set truncations are available through Truncation(..., max_orders=...), with the telescoped remainder margin lower_set_margin. The new symmetry closures are pitch_symmetric and field_reversal_symmetric.
  • JAX 0.10.2 robustness. Population weights are normalised without a subnormal reciprocal, which previously returned wrong averages for weights near 1e308 on JAX 0.10.2. float16, bfloat16 and float32 weights are handled.
  • Radiative transfer.
    • transfer_slab and transfer_los derivatives are exact at every source scale, in every tested AD mode and nesting, including reverse mode through vmap.
    • A non-finite slab is refused with its cause.
    • Eager calls compile once per shape.
  • Tests.
    • The suite has 5196 tests: 3561 fast and 1635 opt-in slow.
    • A systematic AD-transform matrix covers every entry point with a custom derivative or batching rule.
    • The manuscript benchmark reference is included as a hash-checked copy, so the full suite runs from the source distribution.

Behaviour changes

  • transfer_slab and transfer_los raise EquinoxRuntimeError for a non-finite result, where 0.2.0 returned NaN or inf. Under an outer jax.jit the error is JaxRuntimeError.
  • A fixed_table closure combined with a symmetry closure takes the full table and represents the symmetrised marginal.
  • Transfer derivatives changed toward the exact values. On random slabs the change is up to 1.9e-10 relative. In rotation-dominated slabs that need many squarings it is up to 5e-6. Values are bit-identical.

CHANGELOG.md lists every change with measurements, and its "Known limitations" section lists what is deferred to 0.3.1.

Validation

  • Test runs. Both environments were tested:

    • JAX 0.10.0, Equinox 0.13.7, NumPy 2.3.5.
    • JAX 0.10.2, Equinox 0.13.8, NumPy 2.5.3, without mpmath.

    In each, the fast and slow suites pass with no skips. Lint is clean, and the documentation builds with -W under Sphinx 8.2.3 and 9.1.0.

  • Source distribution. The full fast suite and the benchmark also pass from the unpacked source distribution in a fresh environment.

  • Manuscript numbers. The Section 5.3.1 numbers are unchanged. At N = 2, L = 8 the errors are 1.644e-4 and 1.753e-3 of channel intensity. The saved finite predictions are matched within 5.6e-10.

  • Radiation audit. review-results/radiation.json was regenerated with the final code; all 2401 numerical entries are identical to the previous record.

Install

python -m pip install syncmoments

The same release from GitHub:

python -m pip install "syncmoments @ git+https://github.com/zzhang0123/syncmoments@v0.3.0"

The wheel and the source distribution are attached to this release. Documentation: https://syncmoments.readthedocs.io.

synchro 0.2.0

Choose a tag to compare

@zzhang0123 zzhang0123 released this 24 Sep 16:30

First tagged release of synchro, the companion package of Zhang & Chluba, A statistical framework for the modelling of synchrotron emission.

This release adds synchro.model. It predicts channel-integrated Stokes spectra from a finite set of joint population moments (manuscript Section 4 and Appendix B), with an explicit error budget, declared population assumptions and spectral fits.

Highlights

  • Forward modelling. build_basis constructs Legendre-projected, channel-integrated spectral bases with derivatives in energy, field strength and Faraday depth. It supports the exact harmonic kernel (moving lines, per-line Faraday phase) and the ultra-relativistic continuum kernel. predict contracts them with JointMoments; direct_channel_average is the untruncated reference.
  • Declared assumptions. Independence between groups of (gamma, B, mu, eta, phi, depth), an independent screen, field independence, azimuth separability, isotropic pitch, Gaussian depth and nodal populations are parametrisations of the moment vector. They are never defaults and are recorded in every output. Screen routes include GaussianScreen, LaplaceScreen and GammaScreen.
  • Error budget. Every term is bound, measured, estimate, unbounded or not_applicable; a missing input is unbounded, and the total is unbounded while any term is. Assumptions can be quantified by measured discrepancies, the manuscript's factorisation bounds or caller allowances.
  • Spectral fits. synchro.model.fit provides fit_linear (closed-form weighted least squares), LogDensity and fit_bfgs, fit_nodal, identifiability and feasibility reports, and a self-describing FitResult.
  • Documentation on Read the Docs, with the design and acceptance record in docs/DESIGN.md.

Validation

  • 187 existing tests, 1168 new tests and 42 slow tests pass; ruff and black are clean.
  • The manuscript's Section 5.3.1 smooth-channel example is reproduced with automatic differentiation. At N = 2, L = 8 the second-order errors are 1.644e-4 and 1.753e-3 of channel intensity; the manuscript reports 1.64e-4 and 1.75e-3. All 18 saved finite predictions are matched to within 5.6e-10 of channel intensity.
  • An independent six-lens review confirmed 35 findings, all in error-budget reporting and none in the physics. All were fixed over three rounds, with each fix re-verified by reproduction.

Compatibility

Existing APIs are unchanged. stokes_harmonic gains an optional static n_nodes. Slow tests run with -m slow or SYNCHRO_RUN_SLOW=1.

The package is not on PyPI: the name synchro there belongs to an unrelated project. Install from this release or the repository:

python -m pip install "synchro @ git+https://github.com/zzhang0123/synchro@v0.2.0"

See CHANGELOG.md for the full list.