spacenet.pcf.helpers.compute_contributions_parallel#

spacenet.pcf.helpers.compute_contributions_parallel(object_indices_A, object_indices_B, r, spatial_kernel_bandwidth, spatial_kernel_n, total_length, all_network_distances, node_to_edges, n_jobs=-1, verbose=True)#

Runs the compute_contributions function in parallel across multiple CPU cores for a list of object indices. This function is designed to speed up the computation of contributions to the pair correlation function by distributing the workload across multiple processes. Each process will compute contributions for a subset of the object indices in A, using the same set of object indices in B and the same parameters for the kernel function and network distances.

Parameters:
object_indices_Alist

A list of object indices for which to compute contributions.

object_indices_Blist

A list of object indices that contribute to the kernel for each object in A.

rnumpy.ndarray

An array of radii at which to compute contributions.

spatial_kernel_bandwidthfloat

The bandwidth parameter for the spatial kernel function.

spatial_kernel_nfloat

The exponent parameter for the spatial kernel function.

total_lengthfloat

The total length of the network, used for density normalization.

all_network_distancesdict

A dictionary mapping each node index to a dictionary of shortest distances to all other nodes in the network. This should be precomputed for efficiency.

node_to_edgesdict

A dictionary mapping node indices to a list of edges (and their weights) that are connected to that node. This should be precomputed for efficiency.

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 (use all available cores).

verbosebool, optional

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

Returns:
local_contributionsnp.array

An array of local contributions to the pair correlation function for the reference node at each radius in r.