AttributeError: module 'openpnm.models.misc' has no attribute 'difference' ?? #2596
Answered
by
jgostick
JorgeESantos
asked this question in
Q&A
-
Trying to perform the volume adjustment regarding the overlapping of spherical pores and cylindrical throats presented at: Code segment: from functions import Trigo_scaffolds, Voxel_image, TPMS_engine, scatter_3Ddataset
import numpy as np
import porespy as ps
import openpnm as pnm
#Generating Binary image
#M, voxel_lenght = Trigo_scaffolds(Geo='b', shape=[2,2,2], elem=27, meshdata=False, min_dimen=13e-3)
M, voxel_lenght = TPMS_engine([2,2,2], elem=31, min_dimen=13e-3, iT=0.35, meshdata=False)
#Voxel_image(M, 'oldlace', 'darkgray')
#region Network creations
from skimage.feature import peak_local_max
from functions import region3D_centroids, peaks_MBA_filter, Watershed_regions
from porespy.networks import snow2, regions_to_network
from edt import edt3d
M0 = np.logical_not(M)
peaks = region3D_centroids(peak_local_max(edt3d(M0, black_border=True), indices=False)*1*edt3d(M0, black_border=True))[0]
peaks = peaks_MBA_filter(M0, peaks=peaks, minimum=2.0)[0]
#snow_net = snow2(M0, boundary_width=0, accuracy='high',
#voxel_size=voxel_lenght)
Net = regions_to_network(Watershed_regions(M0, peaks, return_img=False), voxel_size=voxel_lenght, accuracy='high')
settings = {'pore_shape': 'sphere',
'throat_shape': 'cylinder',
'pore_diameter': 'equivalent_diameter',
'throat_diameter': 'equivalent_diameter'}
#Exception: 'spheres_and_cylinders' can only be applied when throat diameter is smaller than that of adjacent pores.
#o erro desapareceu após a aplicação da escala
#todo tentar perceber as diferenças entre os diâmetros
Net, geo = pnm.io.PoreSpy.import_data(Net, settings=settings)
#snow_net, snow_geo = pnm.io.PoreSpy.import_data(snow_net.network, settings=settings)
Net = ps.networks.label_boundaries(Net, labels=[['left', 'right'], ['front', 'back'], ['top', 'bottom']])
#snow_net = ps.networks.label_boundaries(snow_net, labels=[['left', 'right'], ['front', 'back'], ['top', 'bottom']])
print('Network and Geometry assigned')
#endregion
#region Geometrical modifications
#todo nothing to do here for now
"""Spherical pores overlap with their throats
A spherical pore will always have a region of overlap with its connected throats.
The volume of this region will be double counted if an extra step is not taken."""
geo.add_model(propname='throat.lens_volume',
model=pnm.models.geometry.throat_volume.lens)
geo.add_model(propname='throat.volume',
model=pnm.models.misc.difference,
props=['throat.total_volume', 'throat.lens_volume']) This raised "AttributeError: module 'openpnm.models.misc' has no attribute 'difference'". can you please fix it or provide another way to make the adjustment please? Regards. |
Beta Was this translation helpful? Give feedback.
Answered by
jgostick
Oct 15, 2022
Replies: 1 comment 1 reply
-
did you update your version of OpenPNM? We release V3 this week. You can check by doing |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
JorgeESantos
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
did you update your version of OpenPNM? We release V3 this week. You can check by doing
op.__version__
at the command line.