stitch

openpnm.topotools.stitch(network, donor, P_network, P_donor, method='nearest', len_max=inf, label_suffix='', label_stitches='stitched')[source]

Stitches a second a network to the current network.

Parameters
  • network (GenericNetwork) – The Network to which to donor Network will be attached

  • donor (GenericNetwork) – The Network to stitch on to the current Network

  • P_network (array_like) – The pores on the current Network

  • P_donor (array_like) – The pores on the donor Network

  • label_suffix (str or None) – Some text to append to each label in the donor Network before inserting them into the recipient. The default is to append no text, but a common option would be to append the donor Network’s name. To insert none of the donor labels, use None.

  • label_stitches (str or list[str]) – The label to apply to the newly created ‘stitch’ throats. The defaul is ‘stitched’. If performing multiple stitches in a row it might be helpful to the throats created during each step uniquely for later identification.

  • len_max (float) – Set a length limit on length of new throats

  • method (str (default = 'nearest')) –

    The method to use when making pore to pore connections. Options are:

    • ’radius’Connects each pore on the recipient network to the

      nearest pores on the donor network, within len_max

    • ’nearest’Connects each pore on the recipienet network to the

      nearest pore on the donor network.

Notes

Before stitching it is necessary to translate the pore coordinates of one of the Networks so that it is positioned correctly relative to the other. This is illustrated in the example below.

Examples

>>> import openpnm as op
>>> pn = op.network.Cubic(shape=[5, 5, 5])
>>> pn2 = op.network.Cubic(shape=[5, 5, 5])
>>> [pn.Np, pn.Nt]
[125, 300]
>>> [pn2.Np, pn2.Nt]
[125, 300]
>>> pn2['pore.coords'][:, 2] += 5.0
>>> op.topotools.stitch(network=pn, donor=pn2, P_network=pn.pores('top'),
...                     P_donor=pn2.pores('bottom'), method='radius',
...                     len_max=1.0)
>>> [pn.Np, pn.Nt]
[250, 625]