NPNitipong Praphaphankul GitHub

Tool · Phase-space distance · v1.0

How different are
two signals? Look at their shape in phase space.

Time-delay embedding turns each signal into a trajectory. CPST measures how far the test trajectory drifts from the reference on average; the percentile Hausdorff distance finds the largest local gap. Everything below runs in your browser.

Try it Python package
Live: reference (black) and test (pink) trajectoriesDrag to rotate
CPST
–

average distortion of the test trajectory

Hausdorff · Q95
–

largest local gap, robust to outliers

Hausdorff · classical
–

worst single gap (q = 100)

Embedding
–

delay τ, dimension m, points per trajectory

01 / Input

Choose two signals and the parameters

Start with a mock pair, a two-tone wave whose trajectory is a clean knot, so you can see each change directly. Or upload your own reference and test signals as CSV files.

What changes in the test signal

Parameters
Input · reference and test in time

02 / Embed

Three samples, one point: the signal becomes a trajectory

Each point of the trajectory is X(n) = [x(n), x(n+τ), x(n+2τ), …]. Move the slider: the three marked samples on the left are the coordinates of the highlighted point on the right. Both signals use the same τ and m.

Signal with x(n), x(n+τ), x(n+2τ)
Reconstructed trajectory (first three axes)
Choosing τ · average mutual information
Choosing m · false nearest neighbours

03 / CPST

Change in Phase Space Topology: the average drift

For every test point, average its k nearest reference points into a centroid and measure the gap. CPST is the mean gap over the whole trajectory, so it responds to changes that are spread over the signal.

  1. Pick a test point sᵢ on the pink trajectory (slider below).
  2. Find its k nearest reference points (black dots) and average them into a centroid r̄ᵢ (white diamond).
  3. Measure the gap Eᵢ = ‖sᵢ − r̄ᵢ‖, the pink segment.
  4. Average all gaps: CPST = mean(Eᵢ).

CPST = 1/N Σ ‖ si − (1/k) Σj∈Nk(i) rj ‖

This point: . Mean of all points:

Test points coloured by Eᵢ · selected neighbourhoodDrag to rotate
Local deviation Eᵢ along the trajectory · dashed line = CPST

04 / Hausdorff

Percentile Hausdorff distance: the largest local gap

Every point looks for its nearest neighbour on the other trajectory, in both directions. The classical Hausdorff distance keeps the single worst gap; the percentile version keeps the q-th percentile, so one bad sample cannot decide the result.

Nearest-neighbour gaps · thick = Q95 gapDrag to rotate
Cumulative distribution of the gaps

dH = max { Qq( minj ‖si − rj‖ ), Qq( mini ‖rj − si‖ ) }

05 / Results

Output

Both indices are in the units of the signal. Judge them against a healthy baseline, not zero: CPST has a small floor when k > 1, and noise raises both.

Response to severity for the current mock changeCPST black · dH pink

06 / Code

Same algorithm in Python

The psdist package reproduces this page and the values reported in the PECT study. MIT licence.

# pip install -r requirements.txt
import psdist
from psdist.mock import make_pair

t, ref, test = make_pair("shape", severity=0.3)
psdist.cpst(ref, test, tau=8, m=3, k=5)        # 0.335
psdist.hausdorff(ref, test, tau=8, m=3, q=95)  # 0.418

Reference

Cite this work

Praphaphankul, N., Akutsu, A., Sasaki, E. Subsurface crack detection in asphalt-paved orthotropic steel bridge decks using pulsed eddy current testing and phase-space feature analysis (manuscript in preparation, 2026).

View on GitHub