- GenericMixture.num_pores(labels='all', mode='or')#
Returns the number of pores of the specified labels
labels (list of strings) – The pore labels that should be included in the count. If not supplied, all pores are counted.
labels – Label of pores to be returned
mode (str, optional) –
Specifies how the count should be performed. The options are:
Pores with one or more of the given labels are counted. Also accepts ‘union’ and ‘any’.
Pores with all of the given labels are returned. Also accepts ‘intersection’ and ‘all’.
Pores with only one of the given labels are counted. Also accepts ‘exclusive_or’.
Pores with none of the given labels are counted. Also accepts ‘not’ and ‘none’.
Pores with not all of the given labels are counted.
Pores with more than one of the given labels are counted.
Np – Number of pores with the specified labels
- Return type
Technically, ‘nand’ and ‘xnor’ should also count pores with none of the labels, however, to make the count more useful these are not included.
>>> import openpnm as op >>> pn = op.network.Cubic(shape=[5, 5, 5]) >>> pn.num_pores() 125 >>> pn.num_pores(labels=['top']) 25 >>> pn.num_pores(labels=['top', 'front'], mode='or') 45 >>> pn.num_pores(labels=['top', 'front'], mode='xnor') 5