filter_by_label¶
- LiquidByName.filter_by_label(pores=[], throats=[], labels=None, mode='or')¶
Returns which of the supplied pores (or throats) has the specified label(s)
- Parameters
pores (array_like) – List of pores or throats to be filtered
throats (or) – List of pores or throats to be filtered
labels (list of strings) – The labels to apply as a filter
mode (str) –
Controls how the filter is applied. Options include:
’or’, ‘union’, ‘any’: (default) Returns a list of the given locations where any of the given labels exist.
’and’, ‘intersection’, ‘all’: Only locations where all the given labels are found.
’xor’, ‘exclusive_or’: Only locations where exactly one of the given labels are found.
’nor’, ‘none’, ‘not’: Only locations where none of the given labels are found.
’nand’ : Only locations with some but not all of the given labels are returned.
’xnor’ : Only locations with more than one of the given labels are returned.
- Returns
A list of pores (or throats) that have been filtered according the
given criteria. The returned list is a subset of the received list of
pores (or throats).
Examples
>>> import openpnm as op >>> pn = op.network.Cubic(shape=[5, 5, 5]) >>> pn.filter_by_label(pores=[0, 1, 25, 32], labels='left') array([0, 1]) >>> Ps = pn.pores(['top', 'bottom', 'back'], mode='or') >>> pn.filter_by_label(pores=Ps, labels=['top', 'back'], ... mode='and') array([ 24, 49, 74, 99, 124])