num_pores

Subdomain.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:

    ’or’, ‘union’, ‘any’ : (default) Pores with one or more of the given labels are counted.

    ’and’, ‘intersection’, ‘all’ : Pores with all of the given labels are counted.

    ’xor’, ‘exclusive_or’ : Pores with only one of the given labels are counted.

    ’nor’, ‘none’, ‘not’ : Pores with none of the given labels are counted.

    ’nand’ : Pores with some but 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