xopto.pf.miepd module¶
- class MiePd(nsphere: float, nmedium: float, wavelength: float, pd: Callable[[float], float], drange: Tuple[float, float], nd: int = 1000)[source]¶
Bases:
xopto.pf.pfbase.PfBase
Mie scattering phase function of an arbitrary size distribution of spherical particles over the specified diameter range.
- Parameters
nsphere (float, complex) – Refractive index (complex) of the spherical particles.
nmedium (float, complex) – Refractive index (complex) of the surrounding medium.
wavelength (float) – Wavelength of light (m).
drange (list) – Diameter range of the spherical particles as [dmin, dmax], where dmin and dmax stand for the minimum and maximum diameters of the spherical particles, respectively.
pd (callable(float) -> float) – Particle distribution number probability density function. Integral of pd over drange should equal 1.0.
nd (int) – Number of equally spaced control points between dmin and dmax that are used to estimate the scattering phase function. A fixed-step Simpson numerical integration is used to estimate the scattering phase function at the given scattering angle cosines. If nd is None, an adaptive-step numerical integration is used (note that the computational time might increase dramatically!!!).
Examples
Mie scattering phase function for a normal distribution of spherical particles with a mean diameter of 1 um, standard deviation of 100 nm, and refractive index of 1.6, for 550 nm monochromatic light in water surrounding (refractive index 1.33). A 7-sigma diameter range is used for numerical computations.
>>> import numpy as np >>> from matplotlib import pyplot as pp >>> >>> dmean = 1e-6 # normal particle distrbution mean >>> dsigma = 0.1e-6 # normal particle distribution standard deviation >>> pd = lambda d: 1.0/(dsigma*np.sqrt(2*np.pi))*np.exp(-(d - dmean)**2/(2*dsigma**2)) >>> cos_theta = np.linspace(-1.0, 1.0, 1000) >>> >>> miepd = MiePd(1.6, 1.33, 550e-9, pd, [dmean - 7*dsigma, dmean + 7*dsigma]) >>> pf_values = miepd(cos_theta) >>> >>> pp.figure() >>> pp.semilogy(cos_theta, pf_values)
- distribution() → Callable[[float], float][source]¶
Returns the underlying distribution object.
- Returns
pd
- Return type
callable(float) -> float
- fastg(n: int, *args, **kwargs) → float[source]¶
Overloads the
PfBase.fastg()
method of the base class. .. note:: If n is 1, a precalculated g1 is returned.
- g(n: int, **kwargs) → float[source]¶
Overloads the
PfBase.g()
method of the base class. Computes the n-th Legendre moment of the scattering phase function.Note
If n is 1, a precalculated g1 is returned.