Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endpoints, conduit_lengths and pore.area from network models #99

Merged
merged 5 commits into from
Dec 4, 2018

Conversation

TomTranter
Copy link
Contributor

No description provided.

@TomTranter
Copy link
Contributor Author

@jgostick I added openpnm to the requirments of porespy and now this pr is failing on python 3.5. This was done to make use of the endpoints and conduit_lengths models in openpnm.

@TomTranter
Copy link
Contributor Author

import porespy as ps
import numpy as np
import openpnm as op

im = ps.generators.blobs([500, 500, 1], porosity=0.8)
snow = ps.filters.snow_partitioning(im, return_all=True)
net = ps.network_extraction.regions_to_network(im=snow.im*snow.regions,
                                               dt=snow.dt,
                                               voxel_size=1)
pn = op.network.GenericNetwork()
pn.update(net)

geo = op.geometry.GenericGeometry(network=pn,
                                  pores=pn.pores(),
                                  throats=pn.throats())
air = op.phases.Air(network=pn)
phys = op.physics.Standard(network=pn, phase=air, geometry=geo)

import matplotlib.pyplot as plt
fig, (ax1, ax2) = plt.subplots(1, 2)
ax1.imshow(im.squeeze())
ax2.imshow(snow.im.squeeze()*snow.regions.squeeze())

def plot_circle(axis, cx, cy, radius):
    theta = np.linspace(0, 2*np.pi, 101)
    x = cx + radius*np.cos(theta)
    y = cy + radius*np.sin(theta)
    axis.plot(x, y, 'r')

for p, [cx, cy, cz] in enumerate(pn['pore.centroid']):
    plot_circle(ax2, cy, cx, pn['pore.inscribed_diameter'][p]/2)

for t in pn.throats():
    ax2.plot([pn['throat.endpoints.tail'][t][1],
              pn['throat.endpoints.head'][t][1]],
             [pn['throat.endpoints.tail'][t][0],
              pn['throat.endpoints.head'][t][0]], 'b')

@TomTranter
Copy link
Contributor Author

image

@TomTranter
Copy link
Contributor Author

As you can see the results aren't perfect but probably good enough for now. @szbrooks has an idea on how to get better results I believe

@codecov
Copy link

codecov bot commented Nov 29, 2018

Codecov Report

Merging #99 into dev will decrease coverage by 0.13%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##              dev      #99      +/-   ##
==========================================
- Coverage   90.62%   90.49%   -0.14%     
==========================================
  Files          17       17              
  Lines        1654     1672      +18     
==========================================
+ Hits         1499     1513      +14     
- Misses        155      159       +4

@TomTranter
Copy link
Contributor Author

@jgostick I took 3.5 out of travis - is there anywhere else it needs to be updated for the package?

@jgostick
Copy link
Member

jgostick commented Dec 3, 2018

Shall I merge?

@TomTranter
Copy link
Contributor Author

I'm sure there will be conflicts. I can do it

@TomTranter
Copy link
Contributor Author

@jgostick that lat pr just went straight into master!

@TomTranter
Copy link
Contributor Author

Screw it then, Just merge the other two into dev and sort out the mess in dev

@jgostick
Copy link
Member

jgostick commented Dec 3, 2018

Oh crap! I didn't even check that, just assumed it was setup correctly. I'll try to fix.

@jgostick
Copy link
Member

jgostick commented Dec 4, 2018

ok, I fixed the PR and undid the commits to master. I'll try to resolve the conflicts, since I created most of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants