find_nearby_pores#

DelaunayVoronoiDual.find_nearby_pores(pores, r, flatten=False, include_input=False)#

Find all pores within a given radial distance of the input pore(s) regardless of whether or not they are toplogically connected.

Parameters:
  • pores (array_like) – The list of pores for whom nearby neighbors are to be found

  • r (scalar) – The maximum radius within which the search should be performed

  • include_input (bool) – Controls whether the input pores should be included in the list of pores nearby the other pores in the input list. So if pores=[1, 2] and 1 and 2 are within r of each other, then 1 will be included in the returned for pores near 2, and vice-versa if this argument is True. The default is False.

  • flatten (bool) – If True returns a single list of all pores that match the criteria, otherwise returns an array containing a sub-array for each input pore, where each sub-array contains the pores that are nearby to each given input pore. The default is False.

Returns:

  • A list of pores which are within the given spatial distance.

  • If a list of N pores is supplied, then a an N-long list of

  • such lists is returned. The returned lists each contain the

  • pore for which the neighbors were sought.

Examples

>>> import openpnm as op
>>> pn = op.network.Cubic(shape=[3, 3, 3])
>>> Ps = pn.find_nearby_pores(pores=[0, 1], r=1)
>>> print(Ps[0])
[3 9]
>>> print(Ps[1])
[ 2  4 10]
>>> Ps = pn.find_nearby_pores(pores=[0, 1], r=0.5)
>>> print(Ps)
[array([], dtype=int64), array([], dtype=int64)]
>>> Ps = pn.find_nearby_pores(pores=[0, 1], r=1, flatten=True)
>>> print(Ps)
[ 2  3  4  9 10]