spacenet.pcf.helpers.compute_weighted_contributions_parallel#
- spacenet.pcf.helpers.compute_weighted_contributions_parallel(object_indices_A, object_indices_B, r, spatial_kernel_bandwidth, spatial_kernel_n, total_length, all_network_distances, these_marker_contributions_weighting, node_to_edges, n_jobs=-1, verbose=True)#
Computes the local contributions to the pair correlation function for a list of reference nodes (object_indices_A) and a set of target nodes (object_indices_B) at specified radii (r), weighted by marker contributions, in parallel across multiple CPU cores.
- 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.
- these_marker_contributions_weightingnp.array
An array of shape (num_objects_B, num_markers) containing the contributions of each object in population B to each marker. This should be precomputed based on the marker values and the weighting scheme for the contributions.
- 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, weighted by the marker contributions. The shape of this array will be (num_markers, len(r)).