manoharan-lab / holopy

Hologram processing and light scattering in python
GNU General Public License v3.0
131 stars 50 forks source link

segfault when using Collection of Spheres #407

Closed mdhoney closed 7 months ago

mdhoney commented 2 years ago

I am currently working my way through the tutorials for the Scattering Calculations (here). Scattering off a single sphere works fine, e.g.

from holopy.scattering import calc_holo, Sphere, Spheres
sphere = Sphere(n=1.59, r=0.5, center=(4, 4, 5))

calc_holo(...) then returns a result as expected.

However, using the example for a collection of spheres:

s1 = Sphere(center=(5, 5, 5), n = 1.59, r = .5)
s2 = Sphere(center=(4, 4, 5), n = 1.59, r = .5)
collection = Spheres([s1, s2])

causes calc_holo to segfault, both in command-line Python 3 and inside a Jupyter Notebook.

Note that manually setting theory=Mie works, so I'm assuming the problem is with Multisphere. Does any extra package need to be installed for that? The documentation doesn't make any mention of it...

vnmanoharan commented 7 months ago

I'm not able to reproduce the segfault, but it's likely a problem with compiling the scattering extensions. We are working on a new version of HoloPy that changes the build system, which should hopefully make it easier to run the scattering extensions on multiple platforms. A preview is available in the develop branch. If this is still an issue for you, feel free to reopen.