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

`spheres_from_coords` does not allow to add one sphere and adding spheres in same plane (not at 0!) will result in 2D-image #936

Open heinsimon opened 6 months ago

heinsimon commented 6 months ago

Problem

Example

import porespy as ps
import numpy as np

df_onesphere={}
df_onesphere['X']=np.array([23])
df_onesphere['Y']=np.array([24])
df_onesphere['Z']=np.array([25])
df_onesphere['R']=np.array([14])

# Bug 1
try:
    packing_sfc_onesphere=ps.generators.spheres_from_coords(df_onesphere,smooth=True,mode='contained')
except IndexError as inst:
    print(f'Got IndexError: {inst.args}')

# Bug  2
df_spheresInplane={}
df_spheresInplane['X']=np.array([23,23,23])
df_spheresInplane['Y']=np.array([24,23,26])
df_spheresInplane['Z']=np.array([25,26,23])
df_spheresInplane['R']=np.array([14,14,14])
packing_sfc_inplane=ps.generators.spheres_from_coords(df_spheresInplane,smooth=True,mode='contained')
print(f'Shape : {packing_sfc_inplane.shape}')
jgostick commented 5 months ago

Is this issue also fixed by the PR #932 ?

heinsimon commented 5 months ago

Is this issue also fixed by the PR #932 ?

I do not think so, since the fix in PR #932 is within the function points_to_spheres and not within the function spheres_from_coords.