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

Using DDA on objects with more than one domain #5

Closed
anna-wang opened this issue Jul 29, 2014 · 2 comments
Closed

Using DDA on objects with more than one domain #5

anna-wang opened this issue Jul 29, 2014 · 2 comments

Comments

@anna-wang
Copy link
Contributor

Using the example from the tutorial (http://manoharan.seas.harvard.edu/holopy/users/dda_tutorial.html#dda-tutorial) fails:

import holopy as hp
from holopy.core import Optics, ImageSchema
from holopy.scattering.scatterer import Scatterer, Sphere
from holopy.scattering.theory import DDA
s1 = Sphere(r = .5, center = (0, -.4, 0))
s2 = Sphere(r = .5, center = (0, .4, 0))
schema = ImageSchema(100, .1, Optics(.66, 1.33, (1, 0)))
dumbbell = Scatterer(lambda point: s1.contains(point) or s2.contains(point),
1.59, (5, 5, 5))
holo = DDA.calc_holo(dumbbell, schema)

gives error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

@tdimiduk
Copy link
Member

That is actually corrected in the most recent version of the docs, if you build it yourself, or look at:
http://people.seas.harvard.edu/~tdimiduk/holopy/

If you want to do a dumbbell like that specifically, you might also try out the CSG Union I added but have not formally documented yet.

from holopy.core import Optics, ImageSchema
from holopy.scattering.scatterer import Union, Sphere
from holopy.scattering.theory import DDA
s1 = Sphere(n=1.59, r = .5, center = (5, 4.6, 5))
s2 = Sphere(n=1.59, r = .5, center = (5, 5.4, 5))
schema = ImageSchema(100, .1, Optics(.66, 1.33, (1, 0)))
dumbbell = Union(s1, s2)
holo = DDA.calc_holo(dumbbell, schema)
# csg scattters do support rotations
holo_rotatated = DDA.calc_holo(dumbbell.rotated(1, 0, 0), schema)

I want to get a little bit of feedback on the interface, but if you think this is sensible after using it, I can move to formally documenting the csg interface.

@anna-wang
Copy link
Contributor Author

I see. The way it's done now is incompatible with the 10+ other types of
scatterers I've created, such as cylinders with spherical caps, Janus
crescents, floating lenses...

On 29 July 2014 14:24, Tom Dimiduk notifications@github.com wrote:

That is actually corrected in the most recent version of the docs, if you
build it yourself, or look at:
http://people.seas.harvard.edu/~tdimiduk/holopy/

If you want to do a dumbbell like that specifically, you might also try
out the CSG Union I added but have not formally documented yet.

from holopy.core import Optics, ImageSchemafrom holopy.scattering.scatterer import Union, Spherefrom holopy.scattering.theory import DDAs1 = Sphere(n=1.59, r = .5, center = (5, 4.6, 5))s2 = Sphere(n=1.59, r = .5, center = (5, 5.4, 5))schema = ImageSchema(100, .1, Optics(.66, 1.33, (1, 0)))dumbbell = Union(s1, s2)holo = DDA.calc_holo(dumbbell, schema)# csg scattters do support rotationsholo_rotatated = DDA.calc_holo(dumbbell.rotated(1, 0, 0), schema)

I want to get a little bit of feedback on the interface, but if you think
this is sensible after using it, I can move to formally documenting the csg
interface.


Reply to this email directly or view it on GitHub
#5 (comment).

barkls pushed a commit that referenced this issue Aug 19, 2019
barkls pushed a commit to barkls/holopy that referenced this issue Dec 6, 2019
This issue was closed.
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

No branches or pull requests

2 participants