- Network.find_neighbor_throats(pores, mode='or', flatten=True, asmask=False)[source]#
Returns a list of throats neighboring the given pore(s)
pores (array_like) – Indices of pores whose neighbors are sought
flatten (bool, optional) – If
True(default) a 1D array of unique throat indices is returned. If
Falsethe returned array contains arrays of neighboring throat indices for each input pore, in the order they were sent.
mode (str) –
Specifies logic to filter the resulting list. Options are:
(default) All neighbors of the input throats. Also accepts ‘any’ and ‘union’.
Only neighbors of one and only one input throats. This is useful for counting the pores that are not shared by any of the input pores. Also accepts ‘exclusive_or’.
Neighbors that are shared by two or more input throats. This is equivalent to counting all neighbors with ‘or’, minus those found with ‘xor’, and is useful for finding neighbors that the inputs have in common.
Only neighbors shared by all input throats. Also accepts ‘intersection’ and ‘all’
asmask (boolean) – If
False(default), the returned result is a list of the neighboring throats as indices. If
True, the returned result is a boolean mask. (Useful for labelling)
True, returns a 1D array of throat indices
filtered according to the specified mode. If
False, returns a list of lists, where each list contains the
neighbors of the corresponding input pores.
logicoptions are applied to neighboring bonds only, thus it is not possible to obtain bonds that are part of the global set but not neighbors. This is because (a) the list of global bonds might be very large, and (b) it is not possible to return a list of neighbors for each input site if global sites are considered.
>>> import openpnm as op >>> pn = op.network.Cubic(shape=[5, 5, 5]) >>> Ts = pn.find_neighbor_throats(pores=[0, 1]) >>> print(Ts) [ 0 1 100 101 200 201] >>> Ts = pn.find_neighbor_throats(pores=[0, 1], flatten=False) >>> print(Ts) [ 0 100 200] >>> print(Ts) [ 0 1 101 201]