Added explicit unit test for `insert_disk_at_points` for codecov
-import porespy as ps
-import numpy as np
import pytest
+import numpy as np
+from numpy.testing import assert_allclose
import scipy.ndimage as spim
import scipy.stats as spst
-import matplotlib.pyplot as plt
-plt.close('all')
+import porespy as ps
class GeneratorTest():
@@ -322,6 +321,14 @@ class GeneratorTest():
im=im, r=3, clearance=1, protrusion=1)
np.testing.assert_allclose(np.linalg.norm(im), 46.2276, rtol=1e-5)
+ def test_insert_disk_at_points(self):
+ from porespy.generators.__gravity__ import insert_disks_at_points
+ im = np.ones((50, 50))
+ coords = np.array([[15, 25], [35, 25]]).T
+ radii = np.array([5, 6])
+ im = insert_disks_at_points(im, coords, radii=radii, v=10)
+ assert_allclose(np.linalg.norm(im), 141.852036)
+
if __name__ == '__main__':
t = GeneratorTest()
