Skip to content

Commit

Permalink
Merge branch 'dev' into adding_gravity_to_ibip
Browse files Browse the repository at this point in the history
  • Loading branch information
jgostick committed Apr 11, 2024
2 parents c543ea0 + 58656a5 commit f38dd33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/porespy/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.0.0a0.dev1'
__version__ = '3.0.0a0.dev3'
5 changes: 3 additions & 2 deletions src/porespy/visualization/_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@ def _sem_parallel(im): # pragma: no cover
voxel in each x, y column. It uses numba for speed, and is
parallelized.
"""
shape=im.shape
shape = im.shape
depth = np.zeros(shape[:2])
for x in prange(shape[0]):
for y in prange(shape[1]):
for z in range(shape[2]-1, 0, -1):
if not im[x][y][z]:
depth[x][y]=z
depth[x][y] = z/shape[2]
break
return depth

Expand Down Expand Up @@ -198,4 +198,5 @@ def xray(im, axis=0): # pragma: no cover
if axis == 2:
im = np.transpose(im, axes=[2, 1, 0])
im = np.sum(im, axis=0, dtype=np.int64)
im = im/np.max(im)
return im
6 changes: 3 additions & 3 deletions test/unit/test_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ def test_sem_x(self):

def test_xray_x(self):
xray = ps.visualization.xray(self.im)
assert np.sum(xray) == np.sum(~self.im)
assert np.min(xray) >= 0 and np.max(xray) <= 1

def test_sem_y(self):
sem = ps.visualization.sem(self.im, axis=1)
assert sem.ndim == 2

def test_xray_y(self):
xray = ps.visualization.xray(self.im, axis=1)
assert np.sum(xray) == np.sum(~self.im)
assert np.min(xray) >= 0 and np.max(xray) <= 1

def test_sem_z(self):
sem = ps.visualization.sem(self.im, axis=2)
assert sem.ndim == 2

def test_xray_z(self):
xray = ps.visualization.xray(self.im, axis=2)
assert np.sum(xray) == np.sum(~self.im)
assert np.min(xray) >= 0 and np.max(xray) <= 1

def test_imshow_single(self):
im = ps.generators.blobs(shape=[10, 20, 30])
Expand Down

0 comments on commit f38dd33

Please sign in to comment.