Skip to content

Commit

Permalink
Merge branch 'dev' into polydisperse_cylinders
Browse files Browse the repository at this point in the history
  • Loading branch information
jgostick committed Oct 25, 2023
2 parents 6314a28 + 5df5dce commit c09b6ab
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
max-parallel: 9
matrix:
# Add '3.10' to the list once #611 is addressed
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11']
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion porespy/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.3.0.dev11'
__version__ = '2.3.0.dev15'
10 changes: 7 additions & 3 deletions porespy/filters/_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,13 @@ def find_disconnected_voxels(im, conn=None, surface=False):
if not surface:
holes = clear_border(labels=labels) > 0
else:
counts = np.bincount(labels.flatten())[1:]
keep = np.where(counts == counts.max())[0] + 1
holes = (labels != keep)*im
keep = set(np.unique(labels))
for ax in range(labels.ndim):
labels = np.swapaxes(labels, 0, ax)
keep.intersection_update(set(np.unique(labels[0, ...])))
keep.intersection_update(set(np.unique(labels[-1, ...])))
labels = np.swapaxes(labels, 0, ax)
holes = np.isin(labels, list(keep), invert=True)
return holes


Expand Down
1 change: 1 addition & 0 deletions requirements/conda.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ scikit-learn
scipy
tqdm
trimesh
PyWavelets
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.3.0.dev11
current_version = 2.3.0.dev15
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.(?P<release>\D+)(?P<build>\d+)?
serialize = {major}.{minor}.{patch}.{release}{build}

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def get_version(rel_path):
'scikit-image',
'scipy',
'tqdm',
'PyWavelets',
],
author='PoreSpy Team',
author_email='jgostick@gmail.com',
Expand Down
14 changes: 14 additions & 0 deletions test/unit/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,20 @@ def test_fill_blind_pores_w_surface(self):
im3 = ps.filters.fill_blind_pores(im, surface=True)
assert im3.sum() == 0

def test_fill_blind_pores_surface_blobs_2D(self):
im = ps.generators.blobs([100, 100], porosity=0.6, seed=0)
im2 = ps.filters.fill_blind_pores(im)
assert im.sum() == 6021
assert im2.sum() == 5981
im3 = ps.filters.fill_blind_pores(im, surface=True)
assert im3.sum() == 5699

def test_fill_blind_pores_surface_blobs_3D(self):
im = ps.generators.blobs([100, 100, 100], porosity=0.5)
im2 = ps.filters.fill_blind_pores(im, surface=True)
labels, N = spim.label(im2, ps.tools.ps_rect(3, ndim=3))
assert N == 1

def test_trim_floating_solid(self):
f = ps.filters.trim_floating_solid(~self.im)
assert np.sum(f) > np.sum(~self.im)
Expand Down

0 comments on commit c09b6ab

Please sign in to comment.