interleave_data#

Mercury.interleave_data(prop)#

Retrieves requested property from associated objects, to produce a full Np or Nt length array.

Parameters

prop (str) – The property name to be retrieved

Returns

A full length (Np or Nt) array of requested property values.

Return type

ndarray

Notes

This makes an effort to maintain the data ‘type’ when possible; however when data are missing this can be tricky. Data can be missing in two different ways: A set of pores is not assisgned to a geometry or the network contains multiple geometries and data does not exist on all. Float and boolean data is fine, but missing ints are converted to float when nans are inserted.

Examples

>>> import openpnm as op
>>> pn = op.network.Cubic(shape=[2, 2, 2])
>>> Ps = pn['pore.top']
>>> Ts = pn.find_neighbor_throats(pores=Ps)
>>> g1 = op.geometry.GenericGeometry(network=pn, pores=Ps, throats=Ts)
>>> Ts = ~pn.to_mask(throats=Ts)
>>> g2 = op.geometry.GenericGeometry(network=pn, pores=~Ps, throats=Ts)
>>> g1['pore.value'] = 1
>>> print(g1['pore.value'])
[1 1 1 1]
>>> print(g2['pore.value'])  # 'pore.value' is defined on g1, not g2
[nan nan nan nan]
>>> print(pn['pore.value'])
[nan  1. nan  1. nan  1. nan  1.]
>>> g2['pore.value'] = 20
>>> print(pn['pore.value'])
[20  1 20  1 20  1 20  1]
>>> pn['pore.label'] = False
>>> print(g1['pore.label'])  # 'pore.label' is defined on pn, not g1
[False False False False]