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:
objectSpatial rectangular window for point-process generation.
- xmin, xmax, ymin, ymax
Coordinate bounds of the rectangular sampling domain.
- Type:
- class upxo.geoEntities.point_processes.PointProcess(window: Tuple[float, float, float, float] | None = None, seed: int | None = None)[source]
Bases:
ABCAbstract base class for point processes.
Notes
Subclasses implement
generateand return point coordinates as apandas.DataFrame.- abstractmethod generate() pandas.DataFrame[source]
Generate a point pattern.
- Returns:
Point coordinates with at least
xandycolumns.- Return type:
pandas.DataFrame
- 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.
- Parameters:
- Returns:
Dictionary containing support radii under
'r'and K-function values under'K_r'.- Return type:
- 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 (pandas.DataFrame) – DataFrame with
xandycolumns, and optionallyzfor 3D workflows.r_max (float, optional) – Maximum radius for the calculation.
r_count (int, optional) – Number of radii to sample between zero and
r_max.dimension (int, optional) – Spatial dimension of the pattern. Supported values are
2and3.
- Returns:
Dictionary containing
'r_g'radii and'g_r'pair correlation estimates.- Return type:
- Raises:
ValueError – If
dimensionis not 2 or 3.
- plot(points: pandas.DataFrame, title: str = 'Point Pattern', ax=None)[source]
Plot generated points.
- Parameters:
points (pandas.DataFrame) – Point coordinates with
xandycolumns.title (str, optional) – Plot title.
ax (matplotlib.axes.Axes, optional) – Existing axes to plot into. If
None, a new figure and axes are created.
- Returns:
Axes containing the point pattern plot.
- Return type:
matplotlib.axes.Axes
- class upxo.geoEntities.point_processes.PoissonPointProcess(intensity: float = 0.01, window: Tuple | None = None, seed: int | None = None)[source]
Bases:
PointProcessHomogeneous Poisson point process.
Points are uniformly distributed; counts follow Poisson distribution.
- Parameters:
- class upxo.geoEntities.point_processes.InhomogeneousPoissonPointProcess(intensity_func, max_intensity: float, window: Tuple | None = None, seed: int | None = None)[source]
Bases:
PointProcessInhomogeneous Poisson point process with spatially varying intensity.
- Parameters:
- 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:
PointProcessPoisson cluster process (Neyman-Scott).
Parents follow Poisson; offspring cluster around parents.
- Parameters:
parent_intensity (float, optional) – Intensity of the parent Poisson process.
n_offspring_per_parent (int, optional) – Mean number of offspring per parent.
offspring_radius (float, optional) – Standard deviation of offspring displacement around each parent.
window (tuple or Window, optional) – Spatial sampling bounds.
seed (int, optional) – Random seed for reproducibility.
- 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:
PointProcessMatérn hard-core process.
Points repel each other: no two points within hard_core_radius. Generated via thinning of Poisson.
- Parameters:
intensity (float, optional) – Target candidate intensity. Achieved intensity may be lower after hard-core rejection.
hard_core_radius (float, optional) – Minimum allowed distance between accepted points.
window (tuple or Window, optional) – Spatial sampling bounds.
seed (int, optional) – Random seed for reproducibility.
- upxo.geoEntities.point_processes.generate(self) pandas.DataFrame[source]
Generate hard-core points by rejection sampling.
- Returns:
Accepted point coordinates with
xandycolumns.- Return type:
pandas.DataFrame
Notes
Candidate acceptance uses a KDTree nearest-neighbor check against already accepted points.
- 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:
PointProcessThomas cluster process.
Offspring distributed normally around parent locations. Special case of Neyman-Scott.
- Parameters:
parent_intensity (float, optional) – Intensity of the parent Poisson process.
mean_offspring (float, optional) – Mean number of offspring per parent.
offspring_std (float, optional) – Standard deviation of offspring displacement.
window (tuple or Window, optional) – Spatial sampling bounds.
seed (int, optional) – Random seed for reproducibility.
- 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:
PointProcessStrauss process: pair-interaction point process.
Inhibitory: points less likely to appear near existing points. Interaction range and strength parameterized.
- Parameters:
beta (float, optional) – Intensity parameter.
gamma (float, optional) – Interaction parameter. Values between 0 and 1 produce inhibition.
interaction_range (float, optional) – Radius within which pair interaction is counted.
window (tuple or Window, optional) – Spatial sampling bounds.
seed (int, optional) – Random seed for reproducibility.
max_iterations (int, optional) – Number of MCMC proposal iterations.
- class upxo.geoEntities.point_processes.RegularLattice(spacing: float = 10.0, window: Tuple | None = None, jitter: float = 0.0)[source]
Bases:
PointProcessRegular lattice (grid) of points.
- Parameters: