xopto.pf.miemixture module¶
- class MieMixture(miepds: Tuple[xopto.pf.miepd.MiePd], weights: list)[source]¶
Bases:
xopto.pf.pfbase.PfBase
Scattering phase function of a mixture of MiePd scattering phase functions.
- Parameters
miepds` (list or tuple of MiePd) – A list of scattering phase functions.
weights (tuple, list or numpy.ndarray) – Weights of the individual scattering phase functions. The sum of weights should equal 1.
Examples
Scattering phase functions of a mixture of Normally distributed microspherical particles: 1. mean diameter 0.5 um, standard deviation 15 nm, and weight 0.98, 2. mean diameter 1.0 um, standard deviation 25 nm, and weight 0.02.
>>> from matplotlib import pyplot as pp >>> import numpy as np >>> from xopto import pf >>> >>> cost_heta = np.linspace(-1.0, 1.0, 1000) >>> normal1 = pf.MieNormal(0.5e-6, 15e-9, nsphere=1.6, nmedium=1.33, wavelength=550e-9, nd=1000) >>> normal2 = pf.MieNormal(1e-6, 25e-9, nsphere=1.6, nmedium=1.33, wavelength=550e-9, nd=1000) >>> mixture = pf.MieMixture((normal1, normal2), (0.98, 0.02)) >>> >>> pp.figure() >>> pp.semilogy(cost_heta, mixture(cost_heta), label='Mixture 0.98*N(0.5 um, 15 nm) + 0.02*N(1 um, 25 nm)') >>> pp.grid() >>> pp.legend() >>> pp.show() >>>
- distribution() → xopto.pf.distribution.Mixture[source]¶
Creates and returns a mixture object that represents the number density of all constituents/components as a function of diameter.
- Returns
mixture – A mixture object representing the number density of all constituents/components as a function of diameter.
- Return type
- 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.
- miepd(index: int) → xopto.pf.miepd.MiePd[source]¶
Returns scattering phase function at the specified index.
- Parameters
index (int, slice) – Scattering phase function(s) at the specified index/slice.
- Returns
miepd – Scattering phase function(s) at the specified index.
- Return type
- pd(diameter: float) → float[source]¶
Evaluates to the number density value 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
- weight(index: int) → float[source]¶
Returns weight of scattering phase functions at the specified index or slice.
- Parameters
index (int, slice) – Index or slice of the selected scattering phase function weight.
- Returns
weight – The selected scattering phase function weight(s).
- Return type
float or tuple