xopto.util.animation.tr.common module

create_deposition_animation_xz(data_source: str, filename: Optional[str] = None, overwrite=False, logscale=False, fps: Optional[float] = None, duration: Optional[float] = None, axis_off: bool = False, title: Optional[str] = None, autoscale: bool = True, writer: Optional[str] = None, dpi: Optional[int] = None, verbose: bool = False)matplotlib.animation.FuncAnimation[source]

Creates a continuous animation of the sampling volume projected onto the x-z plane.

Parameters
  • data_source (str or dict) – File with the simulation results or simulation results as returned by sv_fiber_incidence().

  • filename (str) – Output file for the animation.

  • overwrite (bool) – If False, existing animation files will not be overwritten.

  • logscale (bool) – If True, logarithmically scale the sampling volume data.

  • fps (float) – Frame rate of the animation (1/s). Another way to control the frame rate is specify the duration parameter.

  • duration (float) – Duration of one full animation (s). The same effect can be achieved with the fps parameter.

  • axis_off (bool) – Turns off the axis and related labels.

  • title (str) – Plot title.

  • autoscale (bool) – Independently autoscale the intensity of each frame.

  • writer (str or mpl.animation.MovieWriter) – Movie writer.

  • dpi (int) – Resolution of the exported images.

  • verbose (bool) – Turns on verbose progress report.

Returns

animation – Animation instance

Return type

FuncAnimation

main(sim_task: callable, ani_task: callable, config: dict)[source]

Code for the __main__ section of the sampling volume simulation modules.

Parameters
  • sim_task (callable) – A function that runs the sampling volume simulations.

  • ani_task (callable) – A function that runs/prepares the animations from the simulation results.

  • config (dict) – Sampling volume simulation configuration as a dict. Note that the entries of this configuration dict can change during the call.

mc_tr_deposition_cli(description: Optional[str] = None, parser: Optional[argparse.ArgumentParser] = None)[source]

Collects command line arguments and returns a dict of values.

Parameters
  • description (str) – Command line description.

  • parser (argparse.ArgumentParser) – Externally created argument parser can be used to add custom command line arguments.

Returns

  • args (argparse.Namespace) – Parsed command line arguments. If the parser was passed as an input argument, use the returned namespace to extract any custom parameters.

  • arguments (dict) – Returns the collected arguments as a dict with the following keys:

    • num_packets: int

      Minimum number of packets that should reach the detector.

    • batch_packets:

      int Number of packets to launch in a single simulation run.

    • filename: str

      File for the simulation results.

    • overwrite: bool

      Overwrite existing file.

    • verbose: bool

      Enables verbose reports.

    • animation: bool

      Creates animation after completing the sampling volume simulations.

    • fps: float

      Frame rate (1/s) to use in the sampling volume animation.

    • duration: float

      Animation duration (s).

    • autoscale: bool

      Independently autoscale the intensity of each frame.

    • logscale: bool

      Apply logarithmic scale to the deposition data.

    • axis_off: bool

      Turns off the plot axis in animation.

    • dpi: int

      Resolution of the exported images.

    • opencl_device: str

      OpenCL device to use for the simulations.

    • opencl_index: int

      Index (zero-based) of the OpenCL device to use for the simulations.