pyrt.fit_asymmetry_parameter#
- pyrt.fit_asymmetry_parameter(phase_function, scattering_angles)[source]#
Fit an asymmetry parameter to a phase function.
- Parameters:
phase_function (ArrayLike) – 1-dimensional phase function.
scattering_angles (ArrayLike) – 1-dimensional scattering angles [degrees] corresponding to each value in
phase_function.
- Returns:
N-dimensional array of asymmetry parameters with a shape of
phase_function.shape[1:].- Return type:
float
Notes
The asymmetry parameter is defined as
\[g \equiv \frac{1}{4 \pi} \int_{4\pi} p(\theta)\cos(\theta) d\Omega\]where \(g\) is the asymmetry parameter, \(p\) is the phase function, \(\theta\) is the scattering angle, and \(\Omega\) is the solid angle. This is essentially the expectation value of the phase function.
Examples
Make a phase function from a known asymmetry parameter, then see how well this function recovers the asymmetry parameter.
>>> import numpy as np >>> import pyrt >>> g = 0.8 >>> sa = np.linspace(0, 180, num=181) >>> pf = pyrt.construct_henyey_greenstein(g, sa) * 4 * np.pi # 4 pi is a normalization factor >>> fit_g = pyrt.fit_asymmetry_parameter(pf, sa) >>> print(round(fit_g, 5)) 0.83473
It’s not completely terrible but not particularly inspiring. The error is due to the coarse resolution. Increasing the number of points in the phase function can reduce the error.
>>> sa = np.linspace(0, 180, num=18100) >>> pf = pyrt.construct_henyey_greenstein(g, sa) * 4 * np.pi >>> fit_g = pyrt.fit_asymmetry_parameter(pf, sa) >>> print(round(fit_g, 5)) 0.80034