pores#
- GenericSpecies.pores(labels='all', mode='or', asmask=False, to_global=False)#
Returns pore indicies where given labels exist, according to the logic specified by the
mode
argument.- Parameters
labels (str or list[str]) – The label(s) whose pores locations are requested. This argument also accepts ‘*’ for wildcard searches.
mode (str) –
Specifies how the query should be performed. The options are:
mode
meaning
’or’
Pores with one or more of the given labels are returned. Also accepts ‘union’ and ‘any’.
’and’
Pores with all of the given labels are returned. Also accepts ‘intersection’ and ‘all’.
’xor’
Pores with only one of the given labels are returned. Also accepts ‘exclusive_or’.
’nor’
Pores with none of the given labels are returned. Also accepts ‘not’ and ‘none’.
’nand’
Pores with not all of the given labels are returned.
’xnor’
Pores with more than one of the given labels are returned.
asmask (bool) – If
True
then a boolean array of length Np is returned withTrue
values indicating the pores that satisfy the query.to_global (bool) – If
True
, the returned indices will be indexed relative to the full domain. This only has an effect when the calling object is a Subdomain.
- Returns
A Numpy array containing pore indices filtered by the logic specified
in
mode
.
See also
Notes
Technically, nand and xnor should also return pores with none of the labels but these are not included. This makes the returned list more useful.
To perform more complex or compound queries, you can opt to receive the result a a boolean mask (
asmask=True
), then manipulate the arrays manually.Examples
>>> import openpnm as op >>> pn = op.network.Cubic(shape=[5, 5, 5]) >>> Ps = pn.pores(labels=['top', 'back'], mode='union') >>> Ps[:5] # Look at first 5 pore indices array([ 4, 9, 14, 19, 20]) >>> pn.pores(labels=['top', 'back'], mode='xnor') array([ 24, 49, 74, 99, 124])