xopto.mcbase.mcfluence.fluencerz module

class FluenceRz(raxis: xopto.mcbase.mcutil.axis.Axis, zaxis: Optional[xopto.mcbase.mcutil.axis.Axis] = None, center: Tuple[float, float] = (0.0, 0.0), mode: str = 'deposition')[source]

Bases: xopto.mcbase.mcobject.McObject

Fluence object constructor. Default constructor disables the fluence functionality by creating a zero-size fluence accumulator array.

Parameters
  • raxis (Axis or FluenceRz) – Axis that defines accumulators along the radial axis. If Fluence instance, a new copy is created.

  • zaxis (Axis) – Axis that defines accumulators along the z axis.

  • center (Tuple[float, float]) – Center of the polar accumulator in the x-y plane.

  • mode (str from ('deposition', 'fluence')) –

    Mode that is used to accumulate the photon packet weight:

    • fluence - fluence rate ( 1/m 2)

    • deposition - absorbed energy (sum of photon packet weights absorbed in the voxel 1/m 3).

Note

The fluence accumulator buffer data type is inherited from the Monte Carlo simulator mc_accu_t type.

property center: numpy.ndarray

Center of the polar coordinate system in the x-y plane.

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

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

  • target (ClFluenceRz) – CStructure that is filled with the source data.

  • buffer (np.ndarray) – Accumulator buffer or None. Should be checked for proper size. Use py:attr:mc.types.np_accu attribute to determine the numpy type of the accumulator used in the Monte Carlo simulator.

Returns

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

Return type

ClFluenceRz

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

FluenceRz accumulator - deposition or fluence rate.

property dr: numpy.ndarray

The size of voxels along the r axis.

property dz: numpy.ndarray

The size of voxels along the z axis.

classmethod fromdict(data: dict)xopto.mcbase.mcfluence.fluencerz.FluenceRz[source]

Create a Fluence instance from a dictionary.

Parameters

data (dict) – Dictionary created by the Fluence.todict() method.

property k: int

Fluence floating point to accumulatorinteger conversion coefficient.

property mode: int

The accumulator mode.

property nphotons: int

The number of photon packets that produced the raw data accumulator content.

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

Show fluence slices or integral projections.

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

  • show (bool) –

property r: numpy.ndarray

Accumulator centers along the r axis.

property raw: numpy.ndarray

Raw fluence accumulator data if any.

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

Accumulator axis object along the r axis.

property shape: Tuple[int, int]

Fluence array shape.

todict()dict[source]

Save the fluence configuration without the accumulator data to a dictionary.

Returns

data – Fluence configuration as a dictionary.

Return type

dict

update(obj: xopto.mcbase.mcfluence.fluencerz.FluenceRz)[source]

Update the fluence accumulator with data from the given fluence object.

Parameters

obj (FluenceRz) – Update the fluence accumulator of this instance with the data from fluence instance obj.

update_data(mc: xopto.mcbase.mcobject.McObject, data: Dict[numpy.dtype, List[numpy.ndarray]], nphotons: int, **kwargs)[source]

Update fluence accumulator data with simulation results.

Parameters
  • mc (mcobject.McObject) – Simulator instance that produced the data.

  • data (Dict[np.dtype, List[np.ndarray]]) – List of allocated accumulators (this implementation uses only one accumulator buffer).

  • nphotons (int) – The number of photon packets that produced the raw data accumulator content.

  • kwargs (dict) – Additional keyword arguments not used by this implementation.

property z: numpy.ndarray

Accumulator centers along the z axis.

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

Accumulator axis object along the z axis.