xopto.pf.miemlpd module

class MieMlPd(nlayers: float, nmedium: float, diameters: float, wavelength: float, pd: Callable[[float], float], drange: Tuple[float, float], nd: int = 1000, dscalefun: Optional[Callable[[numpy.ndarray, float], numpy.ndarray]] = None, limit: Optional[int] = None)[source]

Bases: xopto.pf.pfbase.PfBase

Mie scattering phase function for layered spherical particles that follow the given size probability density function within the given range of outer diameters. By default, the layer stack is multiplicatively scaled to the current value of the outer diameter.

Parameters
  • nlayers (float, complex, list, tuple, numpy.ndarray vector) – Refractive indices (complex) of the concentric spherical layers, starting with the refractive index of the innermost layer.

  • nmedium (float, complex) – Refractive index (complex) of the surrounding medium.

  • diameters (float, list, tuple, numpy.ndarray vector) – Diameters of the concentric spherical layers (m), starting with the innermost layer. The layer stack is scaled according to the current diameter of the distribution. A custom scaling function can be passed in the scalefum parameter. A multiplicative scaling of the layer stack to the current outer diameter given by the distribution is used by default.

  • wavelength (float) – Wavelength of light (m).

  • pd (Callable[[float], float]) – Particlne number density distribution function. Integral of pd over diameter range given in drange should equal 1.0.

  • drange ([float, float] or (float, float)) – Layered spherical particle outer diameter range as [dmin, dmax], where dmin and dmax stand for the minimum and maximum diameter of spherical particles, respectively.

  • nd (int) – Number of equally spaced control points between dmin and dmax that are used to estimate the phase function. A fixed-step Simpson numerical integration is used to estimate the phase function at the given deflection angle cosines. If nd is None, adaptive-step numerical integration is used (note that the computational time might increase dramatically!!!).

  • scalefun (Callable[[np.ndarray, float], float]) – A function that scales the layer stack to the current outer diameter of the distribution. If None (default), multiplicative scaling is used to transfor the layer stack so that the outermost layer diameter matches the current distribution diameter.

  • limit (int) – An upper bound on the number of subintervals used in the quad adaptive algorithm. Set to None for default value.

Examples

Mie scattering phase function for a normal distribution of hollow spherical particles with a mean outer diameter of 1 um, standard deviation of 100 nm, a wall thickness that equals 5% of the outer diameter, wall refractive index of 1.45, for 550 nm monochromatic light (vacuum) suspended in water (refractive index 1.33). A 7-sigma diameter range is used for numerical computation.

>>> import numpy as np
>>> from matplotlib import pyplot as pp
>>> from xopto.pf.distribution import Normal
>>>
>>> dmean = 1e-6    # normal particle distrbution mean
>>> dsigma = 0.1e-6 # normal particle distribution standard deviation
>>> pd = Normal(dmean, dsigma)
>>> cos_theta = np.linspace(-1.0, 1.0, 1000)
>>>
>>> miemlpd = MieMlPd([1.0, 1.45], 1.33, [0.9e-6, 1.0e-6], 550e-9, pd, pd.range)
>>> pf_values = miemlpd(cos_theta)
>>>
>>> pp.figure()
>>> pp.semilogy(cos_theta, pf_values)
acs()float[source]

Returns the absorption cross section.

distribution()Callable[[float], float][source]

Returns the underlaying size distribution object.

Returns

pd – A callable size distribution that takes the size parameter/diameter and returns the corresponding probability density.

Return type

Callable[[float], float]

ecs()float[source]

Returns the extinction cross section.

fastg(n: float, *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: float, **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.

pd(diameter: float)float[source]

Evaluates the number density function at the specified particle diameter.

Parameters

diameter (float) – Particle diameter (m).

Returns

pd – The value of number density function at the specified particle diameter.

Return type

float

static scale(diameters: numpy.ndarray, diameter: float)numpy.ndarray[source]

Multiplicatively scale the diameters of the layer stack to match the outer diameter of the stack with the specified diameter.

Parameters
  • diameters (np.ndarray) – Diameters of the layer stack.

  • diameter (float) – Target outer diameter.

Returns

scaled_diameters – Diameters of the layer stack scaled to the specified outer diameter.

Return type

np.ndarray

scs()float[source]

Returns the scattering cross section.