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

holopy.scattering.scatterer.bisphere module

Defines bisphere scatterers.

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

Bases: 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

holopy.scattering.scatterer.capsule module

Defines capsule scatterers.

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

Bases: 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

property 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)

Bases: 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:
  • x (float) – Value of the translation along each axis

  • y (float) – Value of the translation along each axis

  • z (float) – Value of the translation along each axis

Returns:

translated – A copy of this scatterer translated to a new location

Return type:

Scatterer

holopy.scattering.scatterer.csg module

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

class CsgScatterer(s1, s2)

Bases: Scatterer

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

Bases: CsgScatterer

property 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: 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: 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)

holopy.scattering.scatterer.cylinder module

Defines cylinder scatterers.

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

Bases: 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

holopy.scattering.scatterer.ellipsoid module

Defines ellipsoidal scatterers.

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

Bases: 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

property indicators

Ellipsoid indicators does not currently apply rotations

Type:

NOTE

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)

Bases: CenteredScatterer

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

Bases: CenteredScatterer

property indicators

holopy.scattering.scatterer.scatterer module

The abstract base class for all scattering objects

class CenteredScatterer(center=None)

Bases: Scatterer

class Indicators(functions, bound=None)

Bases: 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: HoloPyObject

Base class for scatterers

property 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)
property num_domains
property 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:
  • x (float) – Value of the translation along each axis

  • y (float) – Value of the translation along each axis

  • z (float) – 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)
property x
property y
property 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)

Bases: 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

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

Bases: 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

property indicators
property num_domains
rotated(alpha, beta, gamma)

holopy.scattering.scatterer.spherecluster module

Defines Spheres, a Scatterers scatterer consisting of Spheres

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

Bases: 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

property scatterers
class Spheres(scatterers, warn=True)

Bases: 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)
property center
property centers
largest_overlap()
property n
property n_imag
property n_real
property overlaps
property r
property x
property y
property z

holopy.scattering.scatterer.spheroid module

Defines spheroidal scatterers.

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

Bases: 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

property indicators