xopto.mcml.mcdetector.cartesian module

class Cartesian(xaxis, yaxis=None, cosmin=0.0, direction: Tuple[float, float, float] = (0.0, 0.0, 1.0))[source]

Bases: xopto.mcml.mcdetector.base.Detector

2D Cartesian reflectance/transmittance accumulator in the x-y plane.

The grid of the Cartesian accumulators corresponds to a 2D numpy array with the first dimension representing the y axis and second dimension representing the x axis (reflectance[y, x] or transmittance[y, x]).

Parameters
  • xaxis (axis.Axis) – Object that defines accumulators along the x axis.

  • yaxis (axis.Axis) – Object that defines accumulators along the y axis. If None, the y axis will equal x axis.

  • cosmin (float) –

    Cosine of the maximum acceptance angle (relative to the direction)

    of the detector.

    direction: (float, float, float)

    Reference direction/orientation of the source.

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

Structure that defines the accumulator in the Monte Carlo simulator.

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

Implementation of the accumulator 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 Cartesian.cl_type() method 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]
property cosmin: Tuple[float, float]

Cosine of the maximum acceptance angle.

property direction: Tuple[float, float, float]

Detector reference direction.

static fromdict(data: dict)xopto.mcml.mcdetector.cartesian.Cartesian[source]

Create an accumulator instance from a dictionary.

Parameters

data (dict) – Dictionary created by the py:meth:Cartesian.todict method.

meshgrid()Tuple[numpy.ndarray, numpy.ndarray][source]

Returns 2D arrays of x and y coordinates of the centers of accumulators that match the size of the reflectance / transmittance arrays. The grid of the Cartesian accumulators corresponds to a 2D numpy array with the first dimension representing the y axis and second dimension representing the x axis (reflectance[y, x] or transmittance[y, x]).

Returns

  • x (np.ndarray) – A 2D array of x coordinates.

  • y (np.ndarray) – A 2D array of y coordinates.

property normalized: numpy.ndarray

Normalized.

property nx: int

Number of accumulators along the x axis.

property ny: int

Number of accumulators along the y axis.

plot(scale: str = 'log', raw: bool = False, show: bool = True)[source]

Show the detector data as a 2D image.

Parameters
  • scale (str) – Data scaling can be “log” for logarithmic or “lin” for linear.

  • raw (bool) – Set to True to show the raw data. Default is False and shows the normalized (reflectance) content.

  • show (bool) –

radial(raxis, order=2, nfi=360, center=(0.0, 0.0))xopto.mcml.mcdetector.base.Detector[source]

Converts this x-y accumulator to a radial (Radial) accumulator.

Parameters
  • raxis (axis.Axis) – Radial axis of the accumulator.

  • order (int) – Order of interpolation used in the conversion process.

  • nfi (int) – Angular discretization used during conversion.

  • center ((float, float)) – Center of transformation to radial coordinates as a tuple (x_center, y_center).

Returns

radial – Radial representation of the Cartesian detector.

Return type

xopto.mcml.mcdetector.base.Detector

property reflectance: numpy.ndarray

Reflectance.

todict()dict[source]

Save the accumulator configuration without the accumulator data to a dictionary. Use the Cartesian.fromdict() method to create a new accumulator instance from the returned data.

Returns

data – Accumulator configuration as a dictionary.

Return type

dict

property transmittance: numpy.ndarray

Transmittance.

property x: numpy.ndarray

Centers of the accumulators along the x axis.

property xaxis: xopto.mcbase.mcutil.axis.Axis

Axis object of the x axis.

property xedges: numpy.ndarray

Edges of the accumulators along the x axis.

property y: numpy.ndarray

Centers of the accumulators along the y axis.

property yaxis: xopto.mcbase.mcutil.axis.Axis

Axis object of the y axis.

property yedges: numpy.ndarray

Edges of the accumulators along the y axis.