# holopy.scattering.scatterer package¶

## Module contents¶

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

## holopy.scattering.scatterer.bisphere module¶

Defines cylinder scatterers.

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

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

## holopy.scattering.scatterer.capsule module¶

Defines capsule scatterers.

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

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

## holopy.scattering.scatterer.composite module¶

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)

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 – List of scatterers that make up this object

Notes

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

add(scatterer)
classmethod from_parameters(parameters)
get_component_list()
in_domain(points)
index_at(point)
parameters
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 translated – A copy of this scatterer translated to a new location Scatterer

## holopy.scattering.scatterer.csg module¶

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

class CsgScatterer(s1, s2)
bounds
rotated(alpha, beta, gamma)
class Difference(s1, s2)
bounds
in_domain(points)
class Intersection(s1, s2)
in_domain(points)
class Union(s1, s2)
in_domain(points)

## holopy.scattering.scatterer.cylinder module¶

Defines cylinder scatterers.

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

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

## holopy.scattering.scatterer.ellipsoid module¶

Defines ellipsoidal scatterers.

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

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

NOTE – Ellipsoid indicators does not currently apply rotations

all_numbers(x)
isnumber(x)

## holopy.scattering.scatterer.janus module¶

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

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

## holopy.scattering.scatterer.scatterer module¶

The abstract base class for all scattering objects

class CenteredScatterer(center=None)
classmethod from_parameters(parameters)

Create a Scatterer from a dictionary of parameters

Parameters: parameters (dict or list) – Parameters for a scatterer. This should be of the form returned by Scatterer.parameters. scatterer – A scatterer with the given parameter values Scatterer class
parameters

Get a dictionary of this scatterer’s parameters

Parameters: None – parameters – A dictionary of this scatterer’s parameters. This dict can be passed to Scatterer.from_parameters to make a copy of this scatterer dict
class Indicators(functions, bound=None)

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)

Base class for scatterers

bounds
contains(points)
guess()
in_domain(points)

Tell which domain of a scatterer points are in

Parameters: points (np.ndarray (Nx3)) – Point or list of points to evaluate domain – The domain of each point. Domain 0 means not in the particle np.ndarray (N)
index_at(points, background=0)
num_domains
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 translated – A copy of this scatterer translated to a new location 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 voxelation – An array with refractive index at every pixel 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

## holopy.scattering.scatterer.sphere module¶

Defines Sphere, a scattering primitive

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

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

n

list of complex – Index of each each layer

t

list of float – Thickness of each layer

center

length 3 listlike – specifies coordinates of center of sphere

r
class Sphere(n=None, r=0.5, center=None)

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

complex or list of complex – index of refraction of each layer of the sphere

r

float or list of float – radius of the sphere or outer radius of each sphere.

center

length 3 listlike – specifies coordinates of center of sphere

guess()
indicators
like_me(**overrides)
num_domains
rotated(alpha, beta, gamma)

## holopy.scattering.scatterer.spherecluster module¶

Defines Spheres, a Scatterers scatterer consisting of Spheres

class Spheres(scatterers, warn=True)

Contains optical and geometrical properties of a cluster of spheres.

spheres

list of Spheres – Spheres which will make up the cluster

Notes

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

## holopy.scattering.scatterer.spheroid module¶

Defines spheroidal scatterers.

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

Scattering object representing spheroidal scatterers

n

complex – Index of refraction

r

(float, float) – length of xy and z semi-axes of the spheroid

rotation

3-tuple, list or numpy array – specifies the Euler angles (alpha, beta, gamma) in radians

center

3-tuple, list or numpy array – specifies coordinates of center of the scatterer

indicators