xopto.mccyl.mcrun.mcrun module

class RunMinPacketsTrace(min_packets: float, batch_size: int)[source]

Bases: xopto.mcbase.mcrun.RunMinPacketsBase

Object for running MC simulations until the desired number of packets is collected in the (filtered) trace.

Parameters
  • min_packets (float) – Minimum number of packet traces that needs to be collected.

  • batch_size (int) – Number of packets to launch in a single simulation.

process_batch(result: Tuple[xopto.mcbase.mctrace.Trace, Union[xopto.mcbase.mcfluence.fluence.Fluence, xopto.mcbase.mcfluence.fluencecyl.FluenceCyl, xopto.mcbase.mcfluence.fluencerz.FluenceRz, xopto.mcbase.mcfluence.fluencet.Fluencet, xopto.mcbase.mcfluence.fluencerzt.FluenceRzt, xopto.mcbase.mcfluence.fluencecylt.FluenceCylt], xopto.mccyl.mcdetector.base.Detectors])Tuple[float, int, Tuple[xopto.mcbase.mctrace.Trace, Union[xopto.mcbase.mcfluence.fluence.Fluence, xopto.mcbase.mcfluence.fluencecyl.FluenceCyl, xopto.mcbase.mcfluence.fluencerz.FluenceRz, xopto.mcbase.mcfluence.fluencet.Fluencet, xopto.mcbase.mcfluence.fluencerzt.FluenceRzt, xopto.mcbase.mcfluence.fluencecylt.FluenceCylt], xopto.mccyl.mcdetector.base.Detectors]][source]

Process one MC simulation.

Note

Do not call this method directly. The method is called by run().

Parameters

result (mc.MC_RESULT_TYPE) – A tuple as returned by the mcml.mc.Mc.run() method.

Returns

  • total_weight (float) – Total weight collected by the selected detector.

  • n (int) – The number of packets collected by the detector or None.

  • result (mc.MC_RESULT_TYPE) – Input simulation result ready for the next Monte Carlo simulation.

class RunMinWeightOuter(min_weight: float, batch_size: int, selection: Optional[slice] = None)[source]

Bases: xopto.mccyl.mcrun.mcrun._RunMinWeightDetector

Object for running MC simulations until the desired weight is collected by the outer detector.

Parameters
  • min_weight (float) – Minimum weight that needs to be collected by the detector.

  • batch_size (int) – Number of packets to launch in a single simulation.

  • selection (slice or int) – A slice / region or index of the detector that is used to compute the collected weight. If None (default), the entire detector contributes to the total weight.

class RunMinWeightSpecular(min_weight: float, batch_size: int, selection: Optional[slice] = None)[source]

Bases: xopto.mccyl.mcrun.mcrun._RunMinWeightDetector

Object for running MC simulations until the desired weight is collected by the specular detector.

Parameters
  • min_weight (float) – Minimum weight that needs to be collected by the detector.

  • batch_size (int) – Number of packets to launch in a single simulation.

  • selection (slice or int) – A slice / region or index of the detector that is used to compute the collected weight. If None (default), the entire detector contributes to the total weight.

class RunMinWeightTrace(min_weight: float, batch_size: int)[source]

Bases: xopto.mcbase.mcrun.RunMinWeightBase

Object for running MC simulations until the desired weight is collected by the trace, i.e. the sum of terminal weights of the traced packets.

Parameters
  • min_weight (float) – Minimum total terminal weight of the packets that needs to be collected by the trace.

  • batch_size (int) – Number of packets to launch in a single simulation.

process_batch(result: Tuple[xopto.mcbase.mctrace.Trace, Union[xopto.mcbase.mcfluence.fluence.Fluence, xopto.mcbase.mcfluence.fluencecyl.FluenceCyl, xopto.mcbase.mcfluence.fluencerz.FluenceRz, xopto.mcbase.mcfluence.fluencet.Fluencet, xopto.mcbase.mcfluence.fluencerzt.FluenceRzt, xopto.mcbase.mcfluence.fluencecylt.FluenceCylt], xopto.mccyl.mcdetector.base.Detectors])Tuple[float, int, Tuple[xopto.mcbase.mctrace.Trace, Union[xopto.mcbase.mcfluence.fluence.Fluence, xopto.mcbase.mcfluence.fluencecyl.FluenceCyl, xopto.mcbase.mcfluence.fluencerz.FluenceRz, xopto.mcbase.mcfluence.fluencet.Fluencet, xopto.mcbase.mcfluence.fluencerzt.FluenceRzt, xopto.mcbase.mcfluence.fluencecylt.FluenceCylt], xopto.mccyl.mcdetector.base.Detectors]][source]

Process one MC simulation.

Note

Do not call this method directly. The method is called by run().

Parameters

result (mc.MC_RESULT_TYPE) – A tuple as returned by the mcml.mc.Mc.run() method.

Returns

  • total_weight (float) – Total weight collected by the selected detector.

  • n (int) – The number of packets collected by the detector or None.

  • result (mc.MC_RESULT_TYPE) – Input simulation result ready for the next Monte Carlo simulation.