openpnm.topotools.find_pore_to_pore_distance(network, pores1=None, pores2=None)[source]

Find the distance between all pores on set 1 to each pore in set 2

  • network (GenericNetwork) – The network object containing the pore coordinates

  • pores1 (array_like) – The pore indices of the first set

  • pores2 (array_Like) – The pore indices of the second set. It’s OK if these indices are partially or completely duplicating pores.


dist – A distance matrix with len(pores1) rows and len(pores2) columns. The distance between pore i in pores1 and j in pores2 is located at (i, j) and (j, i) in the distance matrix.

Return type



This function computes and returns a distance matrix, which is a dense matrix of size Np_1 by Np_2, so can get large. For distances between larger sets a KD-tree approach would be better, which is available in scipy.spatial.