num_pores#

LiquidByName.num_pores(labels='all', mode='or')#

Returns the number of pores of the specified labels

Parameters
  • 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:

    mode

    meaning

    ’or’

    Pores with one or more of the given labels are counted. 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 counted. Also accepts ‘exclusive_or’.

    ’nor’

    Pores with none of the given labels are counted. Also accepts ‘not’ and ‘none’.

    ’nand’

    Pores with not all of the given labels are counted.

    ’xnor’

    Pores with more than one of the given labels are counted.

Returns

Np – Number of pores with the specified labels

Return type

int

See also

num_throats, count

Notes

Technically, ‘nand’ and ‘xnor’ should also count pores with none of the labels, however, to make the count more useful these are not included.

Examples

>>> 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