spacenet.pcf.cross_pair_correlation_function#

spacenet.pcf.cross_pair_correlation_function(spatial_network, object_indices_A=None, object_indices_B=None, spatial_kernel_bandwidth=10, spatial_kernel_n=2, r_min=0, r_max=100, r_step=10, edge_weight_name='Distance', return_confidence_interval=False, confidence_interval_kwargs={}, low_memory=False, verbose=True, n_jobs=1)#

Computes the cross pair correlation function between two populations of objects (A and B) on a spatial network.

For a pair correlation function (not cross) on a spatial network set object_indices_A and object_indices_B to be the same set of node indices.

Parameters:
spatial_networknetworkx.Graph

The spatial network on which to compute the pair correlation function. Edges should have a weight attribute corresponding to the distance between nodes.

object_indices_Aarray-like, optional

The indices of the nodes in population A. If None, all nodes in the network will be considered as part of population A. Default is None.

object_indices_Barray-like, optional

The indices of the nodes in population B. If None, all nodes in the network will be considered as part of population B. Default is None.

spatial_kernel_bandwidthfloat, optional

The bandwidth parameter for the spatial kernel function. This controls the smoothness of the pair correlation function. Default is 10.

spatial_kernel_nint, optional

The exponent parameter for the spatial kernel function. This controls the shape of the kernel. Default is 2 (which corresponds to a Gaussian-like kernel).

r_minfloat, optional

The minimum distance to consider when computing the pair correlation function. Default is 0.

r_maxfloat, optional

The maximum distance to consider when computing the pair correlation function. Default is 100.

r_stepfloat, optional

The step size for the distance bins when computing the pair correlation function. Default is 10.

edge_weight_namestr, optional

The name of the edge attribute in the network that corresponds to the distance between nodes. Default is ‘Distance’.

return_confidence_intervalbool, optional

Whether to compute and return 95% confidence intervals for the pair correlation function using spatial bootstrapping. Default is False.

low_memorybool, optional

Whether to use a low-memory implementation of Dijkstra’s algorithm that computes distances in batches. This can be useful for large networks that do not fit in memory. Default is False.

verbosebool, optional

Whether to print progress messages during computation. Default is True.

n_jobsint, optional

The number of parallel jobs to run when computing contributions. If n_jobs > 1, the contributions will be computed in parallel across multiple CPU cores. Default is 1 (no parallelization).

Returns:
radiinumpy.ndarray

The radii at which the pair correlation function was computed.

gnumpy.ndarray

The values of the pair correlation function at the corresponding radii.

confidence_intervalnumpy.ndarray (if return_confidence_interval is True)

If return_confidence_interval is True, this will be a numpy array (2,n) containing the confidence intervals for the pair correlation function at each radius. The first row corresponds to the lower bounds of the confidence intervals, and the second row corresponds to the upper bounds. If return_confidence_interval is False, this will not be returned.

Notes

For a pair correlation function (not cross) on a spatial network set object_indices_A and object_indices_B to be the same set of node indices. For details, see the reference paper…