Skip to main content

SyncEM

Documentation: https://syncem.readthedocs.io · Releases: https://github.com/zzhang0123/syncem/releases

SyncEM is a JAX and Equinox package for differentiable synchrotron kernels, finite-moment spectral bases, and statistical spectral inference accompanying A statistical framework for the modelling of synchrotron emission (Zhang, Chluba & Watson).

Scope and explicit boundaries

SyncEM separates four operations rather than folding them into a single black box:

  1. Physical kernel approximation: discrete finite-$\gamma$ harmonics or the ultra-relativistic continuum kernel.
  2. Finite basis expansion: per-cell local polynomials, Legendre angular projections, azimuth harmonics, and Faraday phase series.
  3. Statistical closure: declared distributions, conditional laws, symmetries, or free moment coordinates.
  4. Numerical solution: quadrature, differentiation, and linear or nonlinear inference.

Every forward prediction and spectral fit carries a typed error ledger (bound, measured, estimate, unbounded, not_applicable). Passing a kernel or regression test does not certify a Galactic foreground model at 21-cm precision. Unsupplied physical, tail, and modelling discrepancies remain labelled unbounded.

Note on companion repositories: The positive finite-cumulant PDF reconstruction and the independent 21-cm assessment live in the manuscript repository's validation/ directory and do not import SyncEM. CumulantExpansion in this package is a historical alias for a quadratic fixed-harmonic Taylor average, not that PDF reconstruction.

Installation

Python 3.12 is the tested runtime. The examples below use version 0.9.0.

python -m pip install syncem==0.9.0

For local tests and validation tools from a checkout:

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

Importing syncem enables JAX 64-bit floating point (jax_enable_x64) globally. Import syncem at the top of a script before creating JAX arrays.

Quick start

Build a spectral basis on energy cells, predict Stokes spectra in physical units, and inspect the error ledger:

import syncem as se

channels = se.Channels.log(0.2, 8.0, 16, unit="GHz", half_width=0.2)
population = se.paper.e1()
lattice = se.Lattice(gamma=se.paper.cells(order=2))

basis = se.spectral_basis(population, channels, lattice=lattice)
spectrum = basis.predict(population, check=False).to("Jy/sr")
print(spectrum.table())
print(spectrum.ledger.unbounded())

The example skips the direct comparison. Set check=True to request it.

To fit observations with unknown electron moments, replace the energy law with se.FreeMoments() and call se.fit:

data = se.StokesData(
    channels,
    I=spectrum.I,
    Q=spectrum.Q,
    U=spectrum.U,
    unit=spectrum.unit,
    sigma=0.01 * spectrum.I[:, None],
).withhold([1, 5, 9, 13])

result = se.fit(population.replace(gamma=se.FreeMoments()), data, basis=basis)
print(result)

Package layers

SyncEM exposes four distinct layers. New work should start at the top-level syncem interface.

Layer Entry points Purpose
Spectral bases & inference (0.8+) se.Population, se.Channels, se.Lattice, se.spectral_basis, se.predict, se.fit, se.problem General per-variable cells, conditionals, physical electron columns ($\text{cm}^{-2}$), unit-area channels, and typed error ledgers.
Two-regime paper model (0.9) se.RegimeBasis, se.paper.population, se.paper.regime_basis, se.paper.energy_basis Joins finite-$\gamma$ harmonic kernels below $\gamma = 300$ with continuum kernels at and above $\gamma = 300$ for Sec. 5 of the manuscript.
Low-level kernels & transfer syncem.stokes, syncem.derivatives, syncem.expansion, syncem.rm, syncem.faraday, syncem.transfer, syncem.magnus, syncem.los_moments Single-electron Schott harmonics, fixed-harmonic quadratic averages, discrete Faraday screens, and exploratory ordered radiative transfer.
Single-reference layer (v0.7.10) syncem.model, syncem.model.fit Preserved single-reference moment interface with unit-normalised moments and unit-peak channels.

Documentation map

Full documentation is hosted at https://syncem.readthedocs.io:

Verification and companion scripts

  • Standard test suite: python -m pytest tests -q (skips tests marked slow).
  • Paper replays and slow tests: python -m pytest tests -m slow or SYNCEM_RUN_SLOW=1.
  • Full diagnostic runner: PYTHONPATH=. python scripts/run_all.py --no-figures.
  • Independent symbolic derivation: wolframscript -file derivation/verify.wls (see derivation/README.md).
  • Paper reproduction: Study scripts and commands and output archive.

Citation and license

Please cite Zhang, Chluba & Watson, A statistical framework for the modelling of synchrotron emission.

Released under the MIT License. See LICENSE.

Metadata

Release files for syncem 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for syncem 0.9.0
File Size Uploaded Provenance Actions
syncem-0.9.0.tar.gz 3.0 MB With provenance Details for syncem-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for syncem 0.9.0
File Interpreter ABI Platform Actions
syncem-0.9.0-py3-none-any.whl Python 3 none any Details for syncem-0.9.0-py3-none-any.whl

Total release size: 3.9 MB

Release files / syncem-0.9.0.tar.gz

Download URL syncem-0.9.0.tar.gz
Size 3.0 MB
Tags Source
SHA-256 checksum
How to use checksums
66be3265e52b7be809bf51191dbd0f0d2fa889528ba3ef0d487026dfc5de5504
BLAKE2b-256 checksum
How to use checksums
8011abfc6711137b722c012888110ff9779acfc41715bf8b1378c8d38a211e3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / syncem-0.9.0-py3-none-any.whl

Download URL syncem-0.9.0-py3-none-any.whl
Size 948.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
090b1e38d9cc62c749906568e9c4999bfb9e7435f5abca88bbad8d1969bb0a92
BLAKE2b-256 checksum
How to use checksums
c590e1f6e19fb58469c88158168194e0aeab8c7f4682b945aea992b920e11922
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for syncem 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for syncem-0.9.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page