xopto.mcbase.mcpf.rayleigh module¶
- class Rayleigh(gamma)[source]¶
Bases:
xopto.mcbase.mcpf.pfbase.PfBase
The Rayleigh scattering phase function is defined as:
[Anthony Bucholtz, Applied Optics, Vol. 34, No. 15 Rayleigh-scattering calculations for the terrestrial atmosphere]. The scattering angle cosine is sampled/computed by using the Cardans formula to solve
, where:
Jeppe Revall Frisvad, Journal of the Optical Society of America A, Vol. 28, Issue 12, pp. 2436-2441 (2011), Importance sampling the Rayleigh phase function.
For a special case when
, i.e. isotropic scattering, the scattering angle cosine becomes
, where
is a random number from
. For gamma != 1 the solution (
) is defined in terms of Cardano formula:
- Parameters
gamma (float) – Molecular anisotropy. Scattering is isotropic for gamma = 0.
- static cl_declaration(mc: xopto.mcbase.mcobject.McObject) → str[source]¶
OpenCL declarations of the scattering phase function.
- static cl_implementation(mc: xopto.mcbase.mcobject.McObject) → str[source]¶
OpenCL implementation of the scattering phase function.
- cl_pack(mc: xopto.mcbase.mcobject.McObject, target: Optional[xopto.cl.cltypes.Structure] = None) → xopto.cl.cltypes.Structure[source]¶
Fills the OpenCL Structure (target) with the data required by the Monte Carlo simulator. See the
cl_type()
method for a detailed list of fields.- Parameters
mc (McObject) – Simulator instance.
target (cltypes.Structure) – Target OpenCL structure for packing.
- Returns
target – Target structure received as an input argument or a new instance of ClRayleigh if the input argument target is None.
- Return type
- static cl_type(mc: xopto.mcbase.mcobject.McObject) → xopto.cl.cltypes.Structure[source]¶
Returns an OpenCL structure that can be passed to the Monte carlo simulator.
- Parameters
mc (McObject) – A Monte Carlo simulator instance.
- Returns
struct (cltypes.Structure) – A structure type that represents the scattering phase function in the Monte Carlo kernel.
Fields
——
gamma (mc_fp_t) – Parameter of the Rayleigh scattering phase function,
a, b (mc_fp_t) – precalculated constants used to speed up the computation.
- property gamma: float¶
Molecular anisotropy factor.
- pf() → xopto.pf.rayleigh.Rayleigh[source]¶
Returns a new instance of the related utility scattering phase function class that can be used to compute Legendre moments and other scattering phase function quantifiers.
- Returns
pf – Instance of the related utility scattering phase function.
- Return type
xopto.pf.Rayleigh