Point Pattern Analysis (pointpats)

pointpats is an open-source python library for the statistical analysis of planar point patterns. It is a subpackage of PySAL (Python Spatial Analysis Library) and is under active development for the inclusion of many newly proposed analytics for point patterns.

Installation

From version 2.1.0, pointpats supports python 3.6 and 3.7 only. Please make sure that you are operating in a python 3 environment.

Installing released version

pointpats is available on the Python Package Index. Therefore, you can either install directly with pip from the command line:

pip install -U pointpats

or download the source distribution (.tar.gz) and decompress it to your selected destination. Open a command shell and navigate to the decompressed folder. Type:

pip install .

You may also install the latest stable pointpats via conda-forge channel by running:

$ conda install --channel conda-forge pointpats

Installing development version

Potentially, you might want to use the newest features in the development version of pointpats on github - pysal/pointpats while have not been incorporated in the Pypi released version. You can achieve that by installing pysal/pointpats by running the following from a command shell:

pip install git+https://github.com/pysal/pointpats.git

You can also fork the pysal/pointpats repo and create a local clone of your fork. By making changes to your local clone and submitting a pull request to pysal/pointpats, you can contribute to the pointpats development.

API reference

Point Pattern

PointPattern(points[, window, names, …])

Planar Point Pattern Class 2-D.

Point Processes

PointProcess(window, n, samples[, asPP])

Point Process base class.

PoissonPointProcess(window, n, samples[, …])

Poisson point process including \(N\)-conditioned CSR process and \(\lambda\)-conditioned CSR process.

PoissonClusterPointProcess(window, n, …[, …])

Poisson cluster point process (Neyman Scott).

Centrography

mbr(points)

Find minimum bounding rectangle of a point array.

hull(points)

Find convex hull of a point array.

mean_center(points)

Find mean center of a point array.

weighted_mean_center(points, weights)

Find weighted mean center of a marked point pattern.

manhattan_median(points)

Find manhattan median of a point array.

std_distance(points)

Calculate standard distance of a point array.

euclidean_median(points)

Calculate the Euclidean median for a point pattern.

ellipse(points)

Calculate parameters of standard deviational ellipse for a point pattern.

skyum(points[, not_hull])

Implements Skyum (1990)’s algorithm for the minimum bounding circle in R^2.

dtot(coord, points)

Sum of Euclidean distances between event points and a selected point.

_circle(p, q, r[, dmetric])

Returns (radius, (center_x, center_y)) of the circumscribed circle by the triangle pqr.

Quadrat Based Statistics

RectangleM(pp[, count_column, count_row, …])

Rectangle grid structure for quadrat-based method.

HexagonM(pp, lh)

Hexagon grid structure for quadrat-based method.

QStatistic(pp[, shape, nx, ny, lh, realizations])

Quadrat analysis of point pattern.

Distance Based Statistics

DStatistic(name)

Abstract Base Class for distance statistics.

G(pp[, intervals, dmin, dmax, d])

Estimates the nearest neighbor distance distribution function G for a point pattern.

F(pp[, n, intervals, dmin, dmax, d])

Estimates the empty space distribution function for a point pattern: F(d).

J(pp[, n, intervals, dmin, dmax, d])

Estimates the J function for a point pattern [LB96]

K(pp[, intervals, dmin, dmax, d])

Estimates the K function for a point pattern.

L(pp[, intervals, dmin, dmax, d])

Estimates the \(L\) function for a point pattern [OSullivanU10].

Envelopes(*args, **kwargs)

Abstract base class for simulation envelopes.

Genv(pp[, intervals, dmin, dmax, d, pct, …])

Simulation envelope for G function.

Fenv(pp[, n, intervals, dmin, dmax, d, pct, …])

Simulation envelope for F function.

Jenv(pp[, n, intervals, dmin, dmax, d, pct, …])

Simulation envelope for J function.

Kenv(pp[, intervals, dmin, dmax, d, pct, …])

Simulation envelope for K function.

Lenv(pp[, intervals, dmin, dmax, d, pct, …])

Simulation envelope for L function.

Window functions

Window(parts[, holes])

Geometric container for point patterns.

as_window(pysal_polygon)

Convert a libpysal polygon to a Window.

poly_from_bbox(bbox)

to_ccf(poly)

Space-Time Interaction Tests

SpaceTimeEvents(path, time_col[, …])

Method for reformatting event data stored in a shapefile for use in calculating metrics of spatio-temporal interaction.

knox(s_coords, t_coords, delta, tau[, …])

Knox test for spatio-temporal interaction.

mantel(s_coords, t_coords[, permutations, …])

Standardized Mantel test for spatio-temporal interaction.

jacquez(s_coords, t_coords, k[, permutations])

Jacquez k nearest neighbors test for spatio-temporal interaction.

modified_knox(s_coords, t_coords, delta, tau)

Baker’s modified Knox test for spatio-temporal interaction.

References

Bak04

Rose D Baker. Identifying space–time disease clusters. Acta tropica, 91(3):291–299, 2004.

Jac96

Geoffrey M Jacquez. A k nearest neighbour test for space–time interaction. Statistics in medicine, 15(18):1935–1949, 1996.

KB64

E. G. Knox and M. S. Bartlett. The detection of space-time interactions. Journal of the Royal Statistical Society. Series C (Applied Statistics), 13(1):25–30, 1964. URL: http://www.jstor.org/stable/2985220.

LB96

M. N. M. Lieshout and A. J. Baddeley. A nonparametric measure of spatial interaction in point patterns. Statistica Neerlandica, 50(3):344–361, 1996. doi:10.1111/j.1467-9574.1996.tb01501.x.

Man67

Nathan Mantel. The detection of disease clustering and a generalized regression approach. Cancer research, 27(2):209—220, February 1967.

OSullivanU10

D. O’Sullivan and D. J. Unwin. Point Pattern Analysis, chapter 5, pages 121–156. John Wiley & Sons, Ltd, 2010. doi:10.1002/9780470549094.ch5.