xopto.mcml.mcsource.uniformbeam module

class UniformBeam(diameter: float, position: Tuple[float, float, float] = (0.0, 0.0, 0.0), direction: Tuple[float, float, float] = (0.0, 0.0, 1.0))[source]

Bases: xopto.mcml.mcsource.base.Source

Uniform intensity collimated beam photon packet source.

Parameters
  • diameter (float or (float, float)) – Collimated beam diameter. Or diameters of the ellipse along the x and y axis

  • 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).

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)Tuple[xopto.cl.cltypes.Structure, None, None][source]

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

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

  • target (pyopyo.mcml.mcsource.UniformBeam.cl_type) – Ctypes structure that is filled with the source data.

Returns

  • target (pyopyo.mcml.mcsource.UniformBeam.cl_type) – Filled ctypes 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]
property diameter: float

Beam diameter along the x and y axis (m).

property direction: Tuple[float, float, float]

Source direction.

property position: Tuple[float, float, float]

Source position.

todict()dict[source]

Export object to a dict.

update(other: dict)[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 (UniformBeam or dict) – This source is updated with the configuration of the other source.