upxo.geoEntities.point_processes module

Point Process Generation Module

Generate synthetic point patterns for microstructure modeling and testing.

Includes:
  • Poisson (uniform random)

  • Poisson cluster process

  • Matérn hard-core process

  • Regular lattice

  • Gibbs processes

  • Strauss process

  • Log-Gaussian Cox process (LGCP)

  • Thomas cluster process

Example

from upxo.pxtalops.point_processes import PoissonPointProcess, MaternHardCore

# Generate Poisson points ppp = PoissonPointProcess(intensity=0.01, window=(100, 100)) points = ppp.generate()

# Generate hard-core process mhc = MaternHardCore(intensity=0.005, hard_core_radius=5, window=(100, 100)) points = mhc.generate()

class upxo.geoEntities.point_processes.Window(xmin: float = 0.0, xmax: float = 100.0, ymin: float = 0.0, ymax: float = 100.0)[source]

Bases: object

Spatial window for point process

xmin: float = 0.0
xmax: float = 100.0
ymin: float = 0.0
ymax: float = 100.0
property width: float

Width of the bounding window (xmax - xmin).

property height: float

Height of the bounding window (ymax - ymin).

property area: float

Area of the bounding window (width * height).

classmethod from_tuple(bounds: Tuple[float, float, float, float])[source]

Create from (xmin, xmax, ymin, ymax)

class upxo.geoEntities.point_processes.PointProcess(window: Tuple[float, float, float, float] | None = None, seed: int | None = None)[source]

Bases: ABC

Abstract base class for point processes

abstractmethod generate() pandas.DataFrame[source]

Generate point pattern. Returns DataFrame with columns [x, y, …]

calculate_k_function(points: pandas.DataFrame, r_max: float = 10.0, r_count: int = 50) Dict[str, numpy.ndarray][source]

Calculates Ripley’s K-function K(r) using PySAL’s pointpats.K.

calculate_g_r(points: pandas.DataFrame, r_max: float = 10.0, r_count: int = 50, dimension: int = 2) Dict[str, numpy.ndarray][source]

Calculates the Pair Correlation Function g(r) by deriving it numerically from the K-function obtained via pointpats.K.

Parameters:
  • points (pd.DataFrame) – DataFrame with ‘x’, ‘y’ (and ‘z’ if 3D) columns.

  • r_max (float) – Maximum radius (r) for the calculation.

  • r_count (int) – Number of radii to sample between 0 and r_max.

  • dimension (int) – The spatial dimension (2 or 3) of the pattern.

Returns:

Dictionary containing ‘r_g’ (radii for g(r))

and ‘g_r’ (the Pair Correlation function estimate).

Return type:

Dict[str, np.ndarray]

plot(points: pandas.DataFrame, title: str = 'Point Pattern', ax=None)[source]

Plot generated points

class upxo.geoEntities.point_processes.PoissonPointProcess(intensity: float = 0.01, window: Tuple | None = None, seed: int | None = None)[source]

Bases: PointProcess

Homogeneous Poisson point process.

Points are uniformly distributed; counts follow Poisson distribution.

generate() pandas.DataFrame[source]

Generate Poisson points

class upxo.geoEntities.point_processes.InhomogeneousPoissonPointProcess(intensity_func, max_intensity: float, window: Tuple | None = None, seed: int | None = None)[source]

Bases: PointProcess

Inhomogeneous Poisson point process with spatially varying intensity.

generate() pandas.DataFrame[source]

Generate inhomogeneous Poisson via thinning

class upxo.geoEntities.point_processes.PoissonClusterProcess(parent_intensity: float = 0.005, n_offspring_per_parent: int = 10, offspring_radius: float = 5.0, window: Tuple | None = None, seed: int | None = None)[source]

Bases: PointProcess

Poisson cluster process (Neyman-Scott).

Parents follow Poisson; offspring cluster around parents.

generate() pandas.DataFrame[source]

Generate cluster points

class upxo.geoEntities.point_processes.MaternHardCore(intensity: float = 0.005, hard_core_radius: float = 5.0, window: Tuple | None = None, seed: int | None = None)[source]

Bases: PointProcess

Matérn hard-core process.

Points repel each other: no two points within hard_core_radius. Generated via thinning of Poisson.

upxo.geoEntities.point_processes.generate(self) pandas.DataFrame[source]

Generate hard-core points via rejection sampling (optimized with KDTree)

class upxo.geoEntities.point_processes.ThomasClusterProcess(parent_intensity: float = 0.001, mean_offspring: float = 25, offspring_std: float = 3.0, window: Tuple | None = None, seed: int | None = None)[source]

Bases: PointProcess

Thomas cluster process.

Offspring distributed normally around parent locations. Special case of Neyman-Scott.

generate() pandas.DataFrame[source]

Generate Thomas cluster points

class upxo.geoEntities.point_processes.StraussProcess(beta: float = 0.05, gamma: float = 0.5, interaction_range: float = 10.0, window: Tuple | None = None, seed: int | None = None, max_iterations: int = 1000)[source]

Bases: PointProcess

Strauss process: pair-interaction point process.

Inhibitory: points less likely to appear near existing points. Interaction range and strength parameterized.

generate() pandas.DataFrame[source]

Generate Strauss points via MCMC

class upxo.geoEntities.point_processes.RegularLattice(spacing: float = 10.0, window: Tuple | None = None, jitter: float = 0.0)[source]

Bases: PointProcess

Regular lattice (grid) of points.

generate() pandas.DataFrame[source]

Generate regular lattice

upxo.geoEntities.point_processes.compare_processes(window: Tuple = (0, 100, 0, 100), seed: int = 42)[source]

Generate and plot comparison of different processes