porespy icon indicating copy to clipboard operation
porespy copied to clipboard

`regions_to_network` breaks when there are no throats

Open ma-sadeghi opened this issue 3 years ago • 1 comments

I know this rarely happens, but there could be some use cases: suppose you have a sphere pack (non-overlapping), and you want to extract some geoemtrical information like pore size distribution, etc. Anyway, the root cause is that we assume throat.conns is non-empty.

ma-sadeghi avatar Nov 04 '22 15:11 ma-sadeghi

Here's how to fix it: In porespy/networks/_getnet.py, if len(t_coords) is 0, the following changes need to be made:

t_coords = np.empty(shape=(0, 3))
net['throat.global_peak'] = np.empty(shape=(0, 3))
net['throat.conns'] = np.empty(shape=(0, 2), dtype=int)

ma-sadeghi avatar Nov 04 '22 16:11 ma-sadeghi