xopto.pf.discrete module

class Discrete(costheta: numpy.ndarray, pf: numpy.ndarray, kind: str = 'cubic', **kwargs)[source]

Bases: xopto.pf.pfbase.PfBase

Scattering phase function defined on a discrete grid of \cos(\theta). The grid should always include the -1 and +1 scattering angle cosines! A cubic interpolating spline is used to estimate the scattering phase function at an arbitrary \cos(\theta).

Parameters
  • costheta (np.ndarray) – Discrete \cos(\theta) points at which the scattering phase function values in parameter pf are defined.

  • pf (np.ndarray) – The values of the scattering phase function at the costheta points.

  • kind (str) – Type of interpolation used to estimate the value of the scattering phase function at an arbitrary \cos(\theta).

  • kwargs (dict) – Optional input arguments passed to the scipy.interpolate.interp1d.

Examples

Discrete representation of a HG scattering phase function for g=0.8.

>>> import numpy as np
>>> from matplotlib import pyplot as pp
>>>
>>> cos_theta = np.linspace(-1.0, 1.0, 1000)
>>> cos_theta_d = np.linspace(-1.0, 1.0, 50)
>>> pf_hg = Hg(0.8)
>>> pf_dhg = Discrete(cos_theta_d, pf_hg(cos_theta_d))
>>>
>>> pp.figure()
>>> pp.semilogy(cos_theta, pf_hg(cos_theta), label='Hg')
>>> pp.semilogy(cos_theta, pf_dhg(cos_theta), label='Discrete')
>>> pp.legend()