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

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 this issue Mar 13, 2024 · 2 comments
Labels
bug PR tag for bug fixes high priority

Comments

@heinsimon
Copy link
Contributor

Problem

  • Call to spheres_from_coords with just one sphere in df results in IndexError
  • Call to spheres_from_coords with just all sphere in one plane and that plane not being at 0 will result in an 2D-image

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
Copy link
Member

Is this issue also fixed by the PR #932 ?

@ma-sadeghi ma-sadeghi changed the title spheres_from_coords: Does not allow to add one sphere and adding spheres in same plane (not at 0!) will result in 2D-image spheres_from_coords does not allow to add one sphere and adding spheres in same plane (not at 0!) will result in 2D-image Mar 26, 2024
@heinsimon
Copy link
Contributor Author

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.

@jgostick jgostick added bug PR tag for bug fixes high priority labels Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug PR tag for bug fixes high priority
Projects
None yet
Development

No branches or pull requests

2 participants