# holopy.scattering.theory package¶

## Module contents¶

Theories to compute scattering from objects.

All theories have a common interface defined by holopy.scattering.theory.scatteringtheory.ScatteringTheory.

## holopy.scattering.theory.dda module¶

Compute holograms using the discrete dipole approximation (DDA). Currently uses ADDA (http://code.google.com/p/a-dda/) to do DDA calculations. .. moduleauthor:: Thomas G. Dimiduk <tdimiduk@physics.harvard.edu>

class DDA(n_cpu=1, max_dpl_size=None, use_indicators=False, keep_raw_calculations=False, addacmd=[])

Computes scattering using the the Discrete Dipole Approximation (DDA). It can (in principle) calculate scattering from any arbitrary scatterer. The DDA uses a numerical method that represents arbitrary scatterers as an array of point dipoles and then self-consistently solves Maxwell’s equations to determine the scattered field. In practice, this model can be extremely computationally intensive, particularly if the size of the scatterer is larger than the wavelength of light. This model requires an external scattering code: a-dda .. attribute:: n_cpu

int (optional) – Number of threads to use for the DDA calculation
max_dpl_size

float (optional) – Force a maximum dipole size. This is useful for forcing extra dipoles if necessary to resolve features in an object. This may make dda calculations take much longer.

use_indicators

bool – If true, a scatterer’s indicators method will be used instead of its built-in adda definition

keep_raw_calculations

bool – If true, do not delete the temporary file we run ADDA in, instead print its path so you can inspect its raw results

Notes

Does not handle near fields. This introduces ~5% error at 10 microns. This can in principle handle any scatterer, but in practice it will need excessive memory or computation time for particularly large scatterers.

required_spacing(medium_wavelen, medium_index, n)

## holopy.scattering.theory.mie module¶

Calculates holograms of spheres using Fortran implementation of Mie theory. Uses superposition to calculate scattering from multiple spheres. Uses full radial dependence of spherical Hankel functions for scattered field.

class Mie(compute_escat_radial=True, full_radial_dependence=True, eps1=0.01, eps2=1e-16)

Compute scattering using the Lorenz-Mie solution.

This theory calculates exact scattering for single spheres and approximate results for groups of spheres. It does not account for multiple scattering, hence the approximation in the case of multiple spheres. Neglecting multiple scattering is a good approximation if the particles are sufficiently separated.

This model can also calculate the exact scattered field from a spherically symmetric particle with an arbitrary number of layers with differing refractive indices, using Yang’s recursive algorithm ([Yang2003]).

By default, calculates radial component of scattered electric fields, which is nonradiative.

Currently, in calculating the Lorenz-Mie scattering coefficients, the maximum size parameter x = ka is limited to 1000.

## holopy.scattering.theory.multisphere module¶

Defines Multisphere theory class, which calculates scattering for multiple spheres using the (exact) superposition method implemented in modified version of Daniel Mackowski’s SCSMFO1B.FOR. Uses full radial dependence of spherical Hankel functions for the scattered field.

class Multisphere(niter=200, eps=1e-06, meth=1, qeps1=1e-05, qeps2=1e-08, compute_escat_radial=False, suppress_fortran_output=True)

Exact scattering from a cluster of spheres.

Calculate the scattered field of a collection of spheres through a numerical method that accounts for multiple scattering and near-field effects (see [Fung2011], [Mackowski1996]). This approach is much more accurate than Mie superposition, but it is also more computationally intensive. The Multisphere code can handle any number of spheres; see notes below for details.

niter

integer (optional) – maximum number of iterations to use in solving the interaction equations

meth

integer (optional) – method to use to solve interaction equations. Set to 0 for biconjugate gradient; 1 for order-of-scattering

eps

float (optional) – relative error tolerance in solution for interaction equations

qeps1

float (optional) – error tolerance used to determine at what order the single-sphere spherical harmonic expansion should be truncated

qeps2

float (optional) – error tolerance used to determine at what order the cluster spherical harmonic expansion should be truncated

Notes

According to Mackowski’s manual for SCSMFO1B.FOR [1] and later papers [2], the biconjugate gradient is generally the most efficient method for solving the interaction equations, especially for dense arrays of identical spheres. Order-of-scattering may converge better for non-identical spheres.

Multisphere does not check for overlaps becaue overlapping spheres can be useful for getting fits to converge. The results to be sensible for small overlaps even though mathemtically speaking they are not xstrictly valid.

Currently, Multisphere does not calculate the radial component of scattered electric fields. This is a good approximation for large kr, since the radial component falls off as 1/kr^2.

scfodim.for contains three parameters, all integers:
• nod: Maximum number of spheres
• nod: Maximum order of individual sphere expansions. Will depend on
size of largest sphere in cluster.
• notd: Maximum order of cluster-centered expansion. Will depend on
overall size of cluster.

Changing these values will require recompiling Fortran extensions.

The maximum size parameter of each individual sphere in a cluster is currently limited to 1000, indepdently of the above scfodim.for parameters.

References

 [1] Daniel W. Mackowski, SCSMFO.FOR: Calculation of the Scattering Properties for a Cluster of Spheres, ftp://ftp.eng.auburn.edu/pub/dmckwski/scatcodes/scsmfo.ps
 [2] D.W. Mackowski, M.I. Mishchenko, A multiple sphere T-matrix Fortran code for use on parallel computer clusters, Journal of Quantitative Spectroscopy and Radiative Transfer, In Press, Corrected Proof, Available online 11 March 2011, ISSN 0022-4073, DOI: 10.1016/j.jqsrt.2011.02.019.
normalize_polarization(illum_polarization)

## holopy.scattering.theory.scatteringtheory module¶

Base class for scattering theories. Implements python-based calc_intensity and calc_holo, based on subclass’s calc_field .. moduleauthor:: Jerome Fung <jerome.fung@post.harvard.edu> .. moduleauthor:: Vinothan N. Manoharan <vnm@seas.harvard.edu> .. moduleauthor:: Thomas G. Dimiduk <tdimiduk@physics.harvard.edu>

class ScatteringTheory

Defines common interface for all scattering theories. .. rubric:: Notes

A subclasses that do the work of computing scattering should do it by implementing _raw_fields and/or _raw_scat_matrs and (optionally) _raw_cross_sections. _raw_cross_sections is needed only for calc_cross_sections. Either of _raw_fields or _raw_scat_matrs will give you calc_holo, calc_field, and calc_intensity. Obviously calc_scat_matrix will only work if you implement _raw_cross_sections. So the simplest thing is to just implement _raw_scat_matrs. You only need to do _raw_fields there is a way to compute it more efficently and you care about that speed, or if it is easier and you don’t care about matrices.

stack_spherical(a)
wavevec(a)

## holopy.scattering.theory.tmatrix module¶

Compute holograms using Mishchenko’s T-matrix method for axisymmetric scatterers. Currently uses

class Tmatrix(delete=True)

Computes scattering using the axisymmetric T-matrix solution by Mishchenko with extended precision.

It can calculate scattering from axisymmetric scatterers such as cylinders and spheroids. Calculations for particles that are very large or have high aspect ratios may not converge.

delete

bool (optional) – If true (default), delete the temporary directory where we store the input and output file for the fortran executable

Notes

Does not handle near fields. This introduces ~5% error at 10 microns.