Visualization¶
Kernel density estimation for particle distributions, one estimator per
geometry, plus a histogram for the hyperbolic boundary. All three are
re-exported at the top level as ww.sphere_kde, ww.disk_kde, and
ww.boundary_angle_histogram.
See the density estimation tutorial for worked
examples and guidance on choosing k.
Sphere¶
sphere_kde ¶
Computes a kernel density estimate of particle positions on the unit sphere. The kernel uses the dot product between each particle's position and each point on the sphere surface to measure closeness.
Points on the unit sphere have a norm of 1, so a larger dot product corresponds to a smaller geodesic distance between two points. The kernel assigns larger weights to points on the mesh surface that are closer to the particles and smaller weights to points that are farther to the particles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
final_positions
|
An (N, 3) array of final particle positions on the unit sphere. |
required | |
x_surface
|
A 2D array containing the x-coordinates of the sphere mesh. |
required | |
y_surface
|
A 2D array containing the y-coordinates of the sphere mesh. |
required | |
z_surface
|
A 2D array containing the z-coordinates of the sphere mesh. |
required | |
k
|
The concentration parameter for the kernel. Larger values produce more concentrated density around the particles. Defaults to sqrt(N) when N is given, else 20 (same default convention as disk_kde). |
None
|
|
N
|
Number of particles, used to pick a default k. |
None
|
Returns:
| Type | Description |
|---|---|
|
A 2D array (same shape as x-, y-, z-surface meshes) containing |
|
|
the normalized density values on the sphere. |
Source code in src/wanderwalk/visualization/kde.py
Poincare disk¶
disk_kde ¶
Computes a kernel density estimate of particle positions on the Poincare disk, using the exact hyperbolic geodesic distance as the kernel argument (the direct analogue of sphere_kde's use of the ambient dot product, which is a geodesic-invariant closeness measure for the sphere; see src/manifolds/hyperbolic.py:geodesic_distance).
Since H^2 has no invariant/stationary density to compare against (BM on H^2 is transient, see docs/writeups/2-poincare-disk-derivation.md), this is purely a particle visualization, the same role sphere_kde plays for the sphere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
final_positions
|
An (N, 2) array of particle positions in the disk. |
required | |
x_mesh
|
A 2D array of x-coordinates of mesh points (only points strictly inside the unit disk are meaningful; others are masked out with NaN in the returned density). |
required | |
y_mesh
|
A 2D array of y-coordinates of mesh points, same shape as x_mesh. |
required | |
k
|
Concentration parameter for the kernel exp(-k * d(x_i, y)^2). Larger k concentrates each particle's contribution more tightly around itself. Defaults to sqrt(N) if N is given, else 20 (same default convention as sphere_kde). |
None
|
|
N
|
Number of particles, used only to pick a default k. |
None
|
Returns:
| Type | Description |
|---|---|
|
A 2D array (same shape as x_mesh) of normalized density values, |
|
|
with NaN at mesh points outside the open unit disk. |
Source code in src/wanderwalk/visualization/hyperbolic_kde.py
boundary_angle_histogram ¶
Computes a histogram of the angular position (theta = atan2(y, x)) of particles that have travelled beyond a given Euclidean radius threshold. Since paths converge almost surely to a random point on the boundary circle (the Poisson boundary), and the hyperbolic metric is rotationally symmetric about the origin, that limiting angle must be uniformly distributed on [0, 2*pi) (see docs/writeups/2-poincare-disk-derivation.md and notebooks/Notebook-04.ipynb for the corresponding statistical test).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
final_positions
|
An (N, 2) array of particle positions in the disk. |
required | |
radius_threshold
|
Only particles with Euclidean norm at least this value are included, so the histogram reflects particles that have travelled meaningfully close to the boundary. |
0.9
|
|
bins
|
Number of angular bins over [0, 2*pi). |
36
|
Returns:
| Type | Description |
|---|---|
|
A tuple (histogram, bin_edges) as returned by np.histogram, or |
|
|
(None, None) if no particles meet the radius threshold. |