PMEAL / porespy

A set of tools for characterizing and analying 3D images of porous materials
https://porespy.org
MIT License
298 stars 99 forks source link

`regions_to_network` breaks when there are no throats #745

Open ma-sadeghi opened 1 year ago

ma-sadeghi commented 1 year ago

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 commented 1 year ago

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)