xopto.mccyl.mcsource.gaussianbeam module

class GaussianBeam(sigma: float, clip: float = 5.0, position: Tuple[float, float, float] = (0.0, 0.0, 0.0), direction: Tuple[float, float, float] = (1.0, 0.0, 0.0))[source]

Bases: xopto.mccyl.mcsource.base.Source

Collimated Gaussian beam photon packet source.

Parameters
  • sigma (float or (float, float)) – Collimated beam width in terms of standard deviation given along the y and z axis. If a single value is provided, the same width is used along the y and z axis.

  • clip (float) – Clip the beam at clip*sigma distance from the beam axis.

  • position ((float, float, float)) – Center of the collimated beam as an array-like object of size 3 (x, y, z).

  • direction ((float, float, float)) – Direction of the collimated beam as an array-like object of size 3 (px, py, pz). The vector should be normalized to unit length.

Note

The beam will be first propagated from the given position to the entry point on the sample surface along the propagation direction (no interactions with the medium during this step). Note that in case the position lies within the sample, the beam will be propagated to the entry point using reversed direction. From there it will be refracted into the sample. The MC simulation will start after subtracting the specular reflectance at the sample boundary from the initial weight of the packet.

static cl_declaration(mc: xopto.mcbase.mcobject.McObject)str[source]

Structure that defines the source in the Monte Carlo simulator.

static cl_implementation(mc: xopto.mcbase.mcobject.McObject)str[source]

Implementation of the source in the Monte Carlo simulator.

cl_pack(mc: xopto.mcbase.mcobject.McObject, target: Optional[xopto.cl.cltypes.Structure] = None)xopto.cl.cltypes.Structure[source]

Fills the structure (target) with the data required by the Monte Carlo simulator. See the GaussianBeam.cl_type() for a detailed list of fields.

Parameters
  • mc (mcobject.McObject) – Monte Carlo simulator instance.

  • target (pyopyo.mccyl.mcsource.GaussianBeam.cl_type) – Structure that is filled with the source data.

Returns

  • target (pyopyo.mccyl.mcsource.GaussianBeam.cl_type) – Filled structure received as an input argument or a new instance if the input argument target is None.

  • topgeometry (None) – This source does not use advanced geometry at the top sample surface.

  • bottomgeometry (None) – This source does not use advanced geometry at the bottom sample surface.

static cl_type(mc: xopto.mcbase.mcobject.McObject)xopto.cl.cltypes.Structure[source]

Structure that is passed to the Monte carlo simulator kernel.

Parameters

mc (McObject) – A Monte Carlo simulator instance.

Returns

struct – A structure type that represents the Gaussian beam in the Monte Carlo kernel.

The returned structure type implements the following fields:

  • transformation: mc_matrix3f_t

    Transformation from the beam coordinate system to the Monte Carlo coordinate system.

  • position: (float, float, float)

    Center of the collimated beam as an array-like object of size 3 (x, y, z). The beam will be always propagated to the top sample surface.

  • direction: (float, float, float)

    Direction of the collimated beam as an array-like object of size 3 (px, py, pz). The vector should be normalized to unit length and have a positive z coordinate (hitting the top sample surface).

  • sigma: mc_point2f_t

    Width of the Gaussian beam in terms of standard deviation along the x and y axis,

  • clip: mc_fp_t

    Clips the gaussian beam at the specified number of sigmas.

Return type

cltypes.Structure

property clip: float

Number of standard deviations at which the beam is clipped.

property direction: Tuple[float, float, float]

Source direction.

static fwhm2sigma(fwhm: float)float[source]

Converts sigma to Full width at half maximum (FWHM).

Parameters

sigma (float) – Standard deviation of the Gaussian.

Returns

fwhm – FWHM parameter of the Gaussian

Return type

float

property position: Tuple[float, float, float]

Source position.

property sigma: Tuple[float, float]

Beam standard deviation (m).

static sigma2fwhm(sigma: float)float[source]

Converts Full width at half maximum (FWHM) to sigma (standard deviation).

Parameters

fwhm (float) – Full width at half maximum (FWHM).

Returns

sigma – Standard deviation of the Gaussian.

Return type

float

todict()dict[source]

Export object to a dict.

update(other: xopto.mccyl.mcsource.gaussianbeam.GaussianBeam)[source]

Update this source configuration from the other source. The other source must be of the same type as this source or a dict with appropriate fields.

Parameters

other (GaussianBeam or dict) – This source is updated with the configuration of the other source.