Reference
Data & state-space¶
The lingua franca every analysis consumes. Trajectory is the result type
all families produce (documented with the base classes);
the regions, samplers and distances below are the state-space primitives the
attractor/basin layer is built on — Monte-Carlo and full-grid sampling, and
the attractor-matching distance used by continuation.
Regions¶
A Region is a Box or a Ball; both describe a bounded subset of state
space and can draw uniform samples from it.
Box
dataclass
¶
Axis-aligned box [lo_i, hi_i] per dimension.
A closed, axis-aligned hyper-rectangle of state space: a point lies in the
box iff lo_i <= u_i <= hi_i for every axis i. It is one of the
region primitives (alongside :class:Ball and :class:Grid) that the
sampler / basin / attractor layer is built on.
| PARAMETER | DESCRIPTION |
|---|---|
lo
|
Per-axis lower and upper corners. Coerced to
TYPE:
|
hi
|
Per-axis lower and upper corners. Coerced to
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
Examples:
>>> b = Box([-1.0, -1.0], [1.0, 1.0])
>>> b.contains([0.0, 0.0])
True
>>> b.contains([[0.0, 0.0], [2.0, 0.0]]) # batch query → per-row mask
array([ True, False])
contains
¶
Whether point(s) u lie in the box.
| PARAMETER | DESCRIPTION |
|---|---|
u
|
A single point of shape
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool or ndarray of bool
|
A scalar |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
Source code in src/tsdynamics/data/sampling.py
Ball
dataclass
¶
Closed Euclidean ball of radius r about center.
The set of points within Euclidean distance r of center (inclusive).
Together with :class:Box and :class:Grid it is one of the region
primitives the sampler / basin / attractor layer is built on.
| PARAMETER | DESCRIPTION |
|---|---|
center
|
Ball centre. Coerced to a
TYPE:
|
r
|
Radius; must be strictly positive.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
Examples:
>>> ball = Ball([0.0, 0.0], r=1.0)
>>> ball.contains([0.5, 0.5])
True
>>> ball.contains([[0.0, 0.0], [2.0, 0.0]]) # batch query → per-row mask
array([ True, False])
contains
¶
Whether point(s) u lie in the ball.
| PARAMETER | DESCRIPTION |
|---|---|
u
|
A single point of shape
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool or ndarray of bool
|
A scalar |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
Source code in src/tsdynamics/data/sampling.py
Grid
dataclass
¶
Regular grid: counts[i] points spanning [lo_i, hi_i] per axis.
A regular Cartesian lattice over an axis-aligned box: axis i carries
counts[i] evenly spaced nodes spanning [lo_i, hi_i] (inclusive of
both endpoints). Use :func:grid_points to enumerate the lattice nodes and
:func:region for a terse (lo, hi, n)-per-axis constructor.
| PARAMETER | DESCRIPTION |
|---|---|
lo
|
Per-axis lower and upper bounds of the bounding box. |
hi
|
Per-axis lower and upper bounds of the bounding box. |
counts
|
Number of nodes per axis; each must be
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
Examples:
axes
¶
Per-axis coordinate vectors (dim arrays, counts[i] long).
contains
¶
Whether point(s) u lie in the grid's bounding box.
Membership is against the bounding box [lo_i, hi_i] — not exact
coincidence with a lattice node.
| PARAMETER | DESCRIPTION |
|---|---|
u
|
A single point of shape
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool or ndarray of bool
|
A scalar |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
Source code in src/tsdynamics/data/sampling.py
Sampling¶
sampler
¶
Return a reproducible 0-argument sampler drawing points from region.
Box → uniform in the box; Ball → uniform in the ball (radial CDF, not the
biased "uniform radius" trick); Grid → uniform over its bounding box (use
:func:grid_points for the lattice itself).
| PARAMETER | DESCRIPTION |
|---|---|
region
|
TYPE:
|
seed
|
Seeds a private
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
callable
|
|
Examples:
Source code in src/tsdynamics/data/sampling.py
grid_points
¶
Enumerate every lattice point of grid (row-major / C order).
| RETURNS | DESCRIPTION |
|---|---|
ndarray, shape ``(prod(counts), dim)``
|
One row per grid node; reshape to |
Source code in src/tsdynamics/data/sampling.py
Set distances¶
set_distance
¶
Distance between two point sets a and b (each (n, dim)).
Methods (Datseris & Wagemakers-style matching primitives):
"centroid"— Euclidean distance between the set centroids. O(n); the cheap default used for attractor matching across a continuation."hausdorff"— symmetric Hausdorff distance, a true metric:max(sup_a inf_b ‖a-b‖, sup_b inf_a ‖a-b‖). KD-tree accelerated."minimum"— the smallest pairwise distance (do the sets touch?). KD-tree accelerated.
Accepts :class:~tsdynamics.data.Trajectory (uses .y), arrays, or any
array-like.