xopto.mcml.mcsource.fiber module

class LambertianFiber(fiber: xopto.mcbase.mcutil.fiber.MultimodeFiber, 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.fiber.UniformFiber

An optical fiber photon packet source.

Parameters
  • fiber (MultimodeFiber) – Optical fiber parameters.

  • position ((float, float, float)) – Position of the center of the fiber source array-like object as tuple (x, y, z). The z coordinate is ignored and set to 0.

  • direction ((float, float, float)) – Direction of the fiber axis as an array-like object of size 3 (px, py, pz). If not perpendicular to the sample surface, the fiber tip is cut at an angle so that the fiber surface is parallel with the sample layer boundary. The z component of the direction vector must be positive (Fiber pointing towards the sample).

Note

The fiber will be always terminated in a way that forms a tight coupling between the sample surface and the fiber tip. If the incidence is not normal, the fiber will have an elliptical cross-section ( cut at an angle). The entry point on the sample surface will be determined by propagating the position along the given direction (no interactions with the medium during this step). Note that in case the position lies within the sample, the position will be propagated to the entry point using reversed direction. From there the packets will be launched according to the NA of the fiber and refractive index of the sample surface. The MC simulation will start after subtracting the specular reflectance at the 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 the structure (target) with the data required by the Monte Carlo simulator. See the LambertianFiber.cl_type() for a detailed list of fields.

Parameters
Returns

  • target (cltypes.Structure) – 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]
class TopGeometryFiber(fiber: xopto.mcml.mcsource.fiber.UniformFiber)[source]

Bases: xopto.mcbase.mcobject.McObject

static cl_declaration(mc: xopto.mcbase.mcobject.McObject)str[source]
static cl_implementation(mc: xopto.mcbase.mcobject.McObject)str[source]
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 FiberGeometryTop.cl_type() for a detailed list of fields.

Parameters
Returns

target – Filled ctypes structure received as an input argument or a new instance if the input argument target is None.

Return type

cltypes.Structure

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

Top sample surface geometry representing an optical fiber.

Parameters

mc (McObject) – A Monte Carlo simulator instance.

Returns

struct – A structure type that represents a top surface geometry in the Monte Carlo kernel.

The returned structure type implements the following fields:

  • transformation mc_matrix3f_t

    Transformation from the Monte Carlo coordinate system to the fiber coordinate system (position must be expressed relative to the fiber center).

  • position: mc_point3f_t

    Position of the optical fiber in the Monte Carlo coordinate system.

  • core_radius: mc_fp_t

    Outer radius of the fiber core.

  • cladding_radius: mc_fp_t

    Outer radius of the fiber cladding.

  • core_n: mc_fp_t

    Refractive index of the fiber core.

  • cladding_n: mc_fp_t

    Refractive index of the fiber cladding.

  • core_cos_critical: mc_fp_t

    Cosine of the total internal reflection angle for the transition sample -> fiber core.

  • cladding_cos_critical: mc_fp_t

    Cosine of the total internal reflection angle for the transition sample -> fiber cladding.

Return type

cltypes.Structure

class UniformFiber(fiber: xopto.mcbase.mcutil.fiber.MultimodeFiber, 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

An optical fiber photon packet source.

Parameters
  • fiber (MultimodeFiber) – Optical fiber parameters.

  • position ((float, float, float)) – Position of the center of the fiber source array-like object as tuple (x, y, z). The z coordinate is ignored and set to 0.

  • direction ((float, float, float)) – Direction of the fiber axis as an array-like object of size 3 (px, py, pz). If not perpendicular to the sample surface, the fiber tip is cut at an angle so that the fiber surface is parallel with the sample layer boundary. The z component of the direction vector must be positive (Fiber pointing towards the sample).

Note

The fiber will be always terminated in a way that forms a tight coupling between the sample surface and the fiber tip. If the incidence is not normal, the fiber will have an elliptical cross-section ( cut at an angle). The entry point on the sample surface will be determined by propagating the position along the given direction (no interactions with the medium during this step). Note that in case the position lies within the sample, the position will be propagated to the entry point using reversed direction. From there the packets will be launched according to the NA of the fiber and refractive index of the sample surface. The MC simulation will start after subtracting the specular reflectance at the 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 the structure (target) with the data required by the Monte Carlo simulator. See the UniformFiber.cl_type() for a detailed list of fields.

Parameters
Returns

  • target (cltypes.Structure) – 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 direction: Tuple[float, float, float]

Source direction.

property fiber: xopto.mcbase.mcutil.fiber.MultimodeFiber

Multimode optical fiber.

classmethod fromdict(data: dict)xopto.mcml.mcsource.fiber.UniformFiberLut[source]

Create a new instance of a photon packet source from a dict that was created by the todict() method.

property position: Tuple[float, float, float]

Source position.

todict()dict[source]

Export object to a dict.

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

class UniformFiberLut(fiber: xopto.mcbase.mcutil.fiber.MultimodeFiberLut, 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

An optical fiber photon packet source with emission characteristics defined by a lookup table. The lookup table is sampled using a uniform random variable and linear interpolation. The obtained value represents cosine of the propagation direction with respect to the fiber normal. The propagation direction cosines defined in the lookup table should be valid for a surrounding medium with refractive index 1 (air). The propagation direction is internally adjusted according to the refractive index of the medium surrounding the optical fiber: sin(theta_lut) = n_medium*sin(theta_medium). The reflectance at the optical fiber-medium boundary is subtracted from the initial weight of the photon packet.

Parameters
  • lut (np.ndarray) – Lookup table data (cos(theta_air)).

  • diameter (float) – Diameter of the fiber core.

  • n (float) – Refractive index of the fiber core.

  • position ((float, float, float)) – Center position the fiber source array-like object of size 3 (x, y, z). The z coordinate is ignored and set to 0.

  • direction ((float, float, float)) – Direction of the fiber axis as an array-like object of size 3 (px, py, pz). If not perpendicular to the sample surface, the fiber tip is cut at an angle so that the fiber surface is parallel with the sample layer boundary. The z component of the direction vector must be positive (Fiber pointing towards the sample).

Note

The fiber will be always terminated in a way that forms a tight coupling between the sample surface and the fiber tip. If the incidence is not normal, the fiber will have an elliptical cross-section ( cut at an angle). The entry point on the sample surface will be determined by propagating the position along the given direction (no interactions with the medium during this step). Note that in case the position lies within the sample, the position will be propagated to the entry point using reversed direction. From there the packets will be launched according to the given angular distribution and the refractive index of the sample surface. The MC simulation will start after subtracting the specular reflectance at the 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.

static cl_options(mc: xopto.mcbase.mcobject.McObject)List[Tuple[str, str]][source]

This source uses lookup table of floating-point data.

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

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

Parameters
Returns

  • target (cltypes.Structure) – 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 direction: Tuple[float, float, float]

Source direction.

property fiber: xopto.mcbase.mcutil.fiber.MultimodeFiberLut

Multimode lookup table optical fiber.

classmethod fromdict(data: dict)xopto.mcml.mcsource.fiber.UniformFiberLut[source]

Create a new instance of a photon packet source from a dict that was created by the todict() method.

property position: Tuple[float, float, float]

Source position.

todict()dict[source]

Export object to a dict.

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