oops, broke a test
@@ -92,16 +92,23 @@ class NetworkExtractionTest():
assert np.allclose(net1['pore.coords'][:, 0], net3['pore.coords'][:, 1])
def test_generate_voxel_image(self):
+ import openpnm as op
+ pn = op.network.Cubic(shape=[5, 5, 5], spacing=1)
+ geo = op.geometry.StickAndBall(network=pn, pores=pn.Ps, throats=pn.Ts)
+ geo.add_model(propname="pore.volume",
+ model=op.models.geometry.pore_volume.cube)
+ geo.add_model(propname="throat.volume",
+ model=op.models.geometry.throat_volume.cylinder)
im = ps.networks.generate_voxel_image(
- network=self.net,
+ network=pn,
pore_shape="cube",
throat_shape="cylinder",
max_dim=400,
rtol=0.01
)
porosity_actual = im.astype(bool).sum() / np.prod(im.shape)
- volume_void = self.net["pore.volume"].sum() + self.net["throat.volume"].sum()
- volume_total = np.prod(self.net.spacing * self.net.shape)
+ volume_void = pn["pore.volume"].sum() + pn["throat.volume"].sum()
+ volume_total = np.prod(pn.spacing * pn.shape)
porosity_desired = volume_void / volume_total
assert_allclose(actual=porosity_actual, desired=porosity_desired, rtol=0.1)
