xopto.mcbase.mcpf.pc module

class Pc(n: float)[source]

Bases: xopto.mcbase.mcpf.pfbase.PfBase

Power of cosines (PC) scattering phase function.

Pc(\cos(\theta)) &= \frac{n + 1}{2^{n + 1}}(1 + \cos(\theta))^{n}

Parameters

n (float >= 0) – Parameter of the power of cosine scattering phase function.

Note

The cumulative density function of PC follows:

CDF(\cos(\theta)) &= \frac{(1 + \cos(\theta))^{n + 1}}{2^{n + 1}}

For a given uniformly distributed random number :math`xi in [0, 1]`, the scattering angle cosine can be computed as:

\cos(\theta) &= 2 e^{\frac{1}{n + 1}} - 1

Since this expression becomes singular for n=-1, only positive values of n are allowed.

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
Returns

target – Target structure received as an input argument or a new instance of ClPc if the input argument target is None.

Return type

cltypes.Structure

cl_type()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.

  • Structure fields

  • —————-

  • n (mc_fp_t) – Power of the cosine,

property n: float

Power of cosine.

pf()xopto.pf.pc.Pc[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.Pc

todict()[source]

Export object to a dict.