holopy.scattering.scatterer package

Modules for defining different types of scatterers, including scattering primitives such as Spheres, and more complex objects such as Clusters.

Submodules

Defines cylinder scatterers.

class Bisphere(n=None, h=None, d=None, center=None, rotation=(0, 0, 0))

Bases: holopy.scattering.scatterer.scatterer.CenteredScatterer

Scattering object representing bisphere scatterers

Parameters:
  • n (complex) – Index of refraction
  • h (distance between centers) –
  • d (diameter) –
  • center (3-tuple, list or numpy array) – specifies coordinates of center of the scatterer
  • rotation (3-tuple, list or numpy.array) – specifies the Euler angles (alpha, beta, gamma) in radians defined in a-dda manual section 8.1

Defines capsule scatterers.

class Capsule(n=None, h=None, d=None, center=None, rotation=(0, 0, 0))

Bases: holopy.scattering.scatterer.scatterer.CenteredScatterer

A cylinder with semi-spherical caps.

A particle with no rotation has its long axis pointing along +z, specify other orientations by euler angle rotations from that reference.

Parameters:
  • n (complex) – Index of refraction
  • h (height of cylinder) –
  • d (diameter) –
  • center (3-tuple, list or numpy array) – specifies coordinates of center of the scatterer
  • rotation (3-tuple, list or numpy.array) – specifies the Euler angles (alpha, beta, gamma) in radians
indicators

Defines Scatterers, a scatterer that consists of other scatterers, including scattering primitives (e.g. Sphere) or other Scatterers scatterers (e.g. two trimers).

class Scatterers(scatterers=None)

Bases: holopy.scattering.scatterer.scatterer.Scatterer

Contains optical and geometrical properties of a a composite scatterer. A Scatterers can consist of multiple scattering primitives (e.g. Sphere) or other Scatterers scatterers.

scatterers

List of scatterers that make up this object

Type:list
parameters [property]

Dictionary of composite’s parameters

add(scatterer)

Adds a new scatterer to the composite.

from_parameters()
translated()
rotated()

Notes

Stores information about components in a tree. This is the most generic container for a collection of scatterers.

add(scatterer)
from_parameters(new_parameters)

Makes a new object similar to self with values as given in parameters. This returns a physical object, so any priors are replaced with their guesses if not included in passed-in parameters.

Parameters:
  • parameters (dict) – dictionary of parameters to use in the new object. Keys should match those of self.parameters.
  • overwrite (bool (optional)) – if True, constant values are replaced by those in parameters
get_component_list()
in_domain(points)

Tell which domain of a scatterer points are in

Parameters:points (np.ndarray (Nx3)) – Point or list of points to evaluate
Returns:domain – The domain of each point. Domain 0 means not in the particle
Return type:np.ndarray (N)
index_at(point)
rotated(ang1, ang2=None, ang3=None)
translated(coord1, coord2=None, coord3=None)

Make a copy of this scatterer translated to a new location

Parameters:y, z (x,) – Value of the translation along each axis
Returns:translated – A copy of this scatterer translated to a new location
Return type:Scatterer

Do Constructive Solid Geometry (CSG) with scatterers. Currently only useful with the DDA th

class CsgScatterer(s1, s2)

Bases: holopy.scattering.scatterer.scatterer.Scatterer

bounds
rotated(alpha, beta, gamma)
class Difference(s1, s2)

Bases: holopy.scattering.scatterer.csg.CsgScatterer

bounds
in_domain(points)

Tell which domain of a scatterer points are in

Parameters:points (np.ndarray (Nx3)) – Point or list of points to evaluate
Returns:domain – The domain of each point. Domain 0 means not in the particle
Return type:np.ndarray (N)
class Intersection(s1, s2)

Bases: holopy.scattering.scatterer.csg.CsgScatterer

in_domain(points)

Tell which domain of a scatterer points are in

Parameters:points (np.ndarray (Nx3)) – Point or list of points to evaluate
Returns:domain – The domain of each point. Domain 0 means not in the particle
Return type:np.ndarray (N)
class Union(s1, s2)

Bases: holopy.scattering.scatterer.csg.CsgScatterer

in_domain(points)

Tell which domain of a scatterer points are in

Parameters:points (np.ndarray (Nx3)) – Point or list of points to evaluate
Returns:domain – The domain of each point. Domain 0 means not in the particle
Return type:np.ndarray (N)

Defines cylinder scatterers.

class Cylinder(n=None, h=None, d=None, center=None, rotation=(0, 0, 0))

Bases: holopy.scattering.scatterer.scatterer.CenteredScatterer

Scattering object representing cylinder scatterers

Parameters:
  • n (complex) – Index of refraction
  • h (height of cylinder) –
  • d (diameter) –
  • center (3-tuple, list or numpy array) – specifies coordinates of center of the scatterer
  • rotation (3-tuple, list or numpy.array) – specifies the Euler angles (alpha, beta, gamma) in radians defined in a-dda manual section 8.1

Defines ellipsoidal scatterers.

class Ellipsoid(n=None, r=None, center=None, rotation=(0, 0, 0))

Bases: holopy.scattering.scatterer.scatterer.CenteredScatterer

Scattering object representing ellipsoidal scatterers

Parameters:
  • n (complex) – Index of refraction
  • r (float or (float, float, float)) – x, y, z semi-axes of the ellipsoid
  • center (3-tuple, list or numpy array) – specifies coordinates of center of the scatterer
  • rotation (3-tuple, list or numpy.array) – specifies the Euler angles (alpha, beta, gamma) in radians defined in a-dda manual section 8.1
indicators

Ellipsoid indicators does not currently apply rotations

Type:NOTE

Defines two types of Janus (two faced) Spheres as scattering primitives.

class JanusSphere_Tapered(n=None, r=None, rotation=(0, 0), center=None)

Bases: holopy.scattering.scatterer.scatterer.CenteredScatterer

indicators
class JanusSphere_Uniform(n=None, r=None, rotation=(0, 0, 0), center=None)

Bases: holopy.scattering.scatterer.scatterer.CenteredScatterer

indicators

The abstract base class for all scattering objects

class CenteredScatterer(center=None)

Bases: holopy.scattering.scatterer.scatterer.Scatterer

class Indicators(functions, bound=None)

Bases: holopy.core.holopy_object.HoloPyObject

Class holding functions describing a scatterer

One or more functions (one per domain) that take Nx3 arrays of points and return a boolean array of membership in each domain. More than one indicator is allowed to return true for a given point, in that case the point is considered a member of the first domain with a true value.

class Scatterer(indicators, n, center)

Bases: holopy.core.holopy_object.HoloPyObject

Base class for scatterers

bounds
contains(points)
from_parameters(parameters)

Create a Scatterer from a dictionary of parameters

Parameters:parameters (dict) – Parameters for a scatterer. This should be of the form returned by Scatterer.parameters.
Returns:scatterer – A scatterer with the given parameter values
Return type:Scatterer class
in_domain(points)

Tell which domain of a scatterer points are in

Parameters:points (np.ndarray (Nx3)) – Point or list of points to evaluate
Returns:domain – The domain of each point. Domain 0 means not in the particle
Return type:np.ndarray (N)
index_at(points, background=0)
num_domains
parameters

Get a dictionary of this scatterer’s parameters

Parameters:None
Returns:parameters – A dictionary of this scatterer’s parameters. This dict can be passed to Scatterer.from_parameters to make a copy of this scatterer
Return type:dict
translated(coord1, coord2=None, coord3=None)

Make a copy of this scatterer translated to a new location

Parameters:y, z (x,) – Value of the translation along each axis
Returns:translated – A copy of this scatterer translated to a new location
Return type:Scatterer
voxelate(spacing, medium_index=0)

Represent a scatterer by discretizing into voxels

Parameters:
  • spacing (float) – The spacing between voxels in the returned voxelation
  • medium_index (float) – The background index of refraction to fill in at regions where the scatterer is not present
Returns:

voxelation – An array with refractive index at every pixel

Return type:

np.ndarray

voxelate_domains(spacing)
x
y
z
bound_union(d1, d2)
find_bounds(indicator)

Finds the bounds needed to contain an indicator function

Notes

Will probably determine incorrect bounds for functions which are not convex

Defines Sphere, a scattering primitive

class LayeredSphere(n=None, t=None, center=None)

Bases: holopy.scattering.scatterer.sphere.Sphere

Alternative description of a sphere where you specify layer thicknesses instead of radii

n

Index of each each layer

Type:list of complex
t

Thickness of each layer

Type:list of float
center

specifies coordinates of center of sphere

Type:length 3 listlike
r
class Sphere(n=None, r=0.5, center=None)

Bases: holopy.scattering.scatterer.scatterer.CenteredScatterer

Contains optical and geometrical properties of a sphere, a scattering primitive.

This can be a multiple layered sphere by making r and n lists.

n

index of refraction of each layer of the sphere

Type:complex or list of complex
r

radius of the sphere or outer radius of each sphere.

Type:float or list of float
center

specifies coordinates of center of sphere

Type:length 3 listlike
indicators
num_domains
rotated(alpha, beta, gamma)

Defines Spheres, a Scatterers scatterer consisting of Spheres

class RigidCluster(spheres, translation=(0, 0, 0), rotation=(0, 0, 0))

Bases: holopy.scattering.scatterer.spherecluster.Spheres

from_parameters(parameters)

Makes a new object similar to self with values as given in parameters. This returns a physical object, so any priors are replaced with their guesses if not included in passed-in parameters.

Parameters:
  • parameters (dict) – dictionary of parameters to use in the new object. Keys should match those of self.parameters.
  • overwrite (bool (optional)) – if True, constant values are replaced by those in parameters
scatterers
class Spheres(scatterers, warn=True)

Bases: holopy.scattering.scatterer.composite.Scatterers

Contains optical and geometrical properties of a cluster of spheres.

spheres

Spheres which will make up the cluster

Type:list of Spheres
warn

if True, overlapping spheres raise warnings.

Type:bool

Notes

add(scatterer)
center
centers
largest_overlap()
n
n_imag
n_real
overlaps
r
x
y
z

Defines spheroidal scatterers.

class Spheroid(n=None, r=None, rotation=(0, 0, 0), center=None)

Bases: holopy.scattering.scatterer.scatterer.CenteredScatterer

Scattering object representing spheroidal scatterers

n

Index of refraction

Type:complex
r

length of xy and z semi-axes of the spheroid

Type:(float, float)
rotation

specifies the Euler angles (alpha, beta, gamma) in radians

Type:3-tuple, list or numpy array
center

specifies coordinates of center of the scatterer

Type:3-tuple, list or numpy array
indicators