Establish parity between the original DAMOCO MATLAB implementation and this Python port for:
DAMOCO: Data Analysis with Models Of Coupled Oscillators
- API behavior (function names, defaults, outputs)
- numerical equivalence (within floating-point tolerance)
- expected qualitative behavior on synthetic systems
Reference MATLAB toolbox:
Examples:
- synchronization indices are near 1 on constructed resonances
- correlation of identical functions is near 1
- phase derivative estimators recover known constant derivatives
- periodic boundary duplication is preserved for grid outputs
Current automated tests are in:
tests/test_sync_metrics.pytests/test_derivatives.pytests/test_coupling.pytests/test_protophase.pytests/test_plotting.py
Run:
pytest -qFor strict MATLAB-to-Python parity, use the same inputs in both environments:
- Generate test data in MATLAB and save (
.mat) including:- input phases/time series
- outputs from selected
co_*functions
- Load same inputs in Python, run corresponding
damoco.co_*calls. - Compare with metrics:
- max absolute error (
L_inf) - relative
L2error - correlation
- max absolute error (
Suggested tolerance bands:
1e-12to1e-9for simple algebraic quantities1e-8to1e-5for interpolative/integrative quantities- case-specific tolerance for ill-conditioned regressions
On representative datasets:
- compare inferred directionality signs
- compare coupling matrix sparsity/rank ordering
- compare triad/network conclusions under same threshold settings
- Exact phase locking synthetic signals
- verify
co_sync,co_sync3,co_maxsync,co_maxsync3
- verify
- Known Fourier coupling model
- verify
co_fcplfct1/2,co_fcfcor,co_fcfcormax
- verify
- Known grid coupling model with shifts
- verify
co_gcfcor,co_gcfcormax,co_cor_diff
- verify
- Noisy phase derivatives
- verify
co_phidot*,co_resid_decomp
- verify
- Triad with designed coupling graph
- verify
co_fcpltri,co_tricplfan,co_nettri
- verify
- Protophase methods
- verify monotonicity and cycle consistency of
co_hilbproto,co_mmzproto,co_distproto,co_fbtransf1,co_fbtrT,co_avcyc
- verify monotonicity and cycle consistency of
- default linear algebra backend and conditioning effects
- interpolation engine differences
- floating-point summation order
- endpoint handling in numerical integration
- phase unwrap boundary behavior on noisy signals
These usually produce small numeric differences that should not change qualitative scientific interpretation when tolerances are chosen properly.
For publication-quality reproducibility, include:
- exact
damocoversion (PyPI tag or commit hash) - Python, NumPy, SciPy versions
- MATLAB version/toolbox state
- dataset/preprocessing details
- tolerance definitions and pass/fail criteria
Add a dedicated tests/test_matlab_parity.py that loads frozen MATLAB reference fixtures (.mat) and performs direct parity checks in CI.