pymchelper.executor package#

Submodules#

pymchelper.executor.options module#

class pymchelper.executor.options.FlukaEnvironment[source]#

Bases: MCEnvironment

FLUKA Environment

executable_filename = 'rfluka'#
simulator_type = 3#
class pymchelper.executor.options.MCEnvironment[source]#

Bases: object

MCEnvironment subclasses are helpful to discover which MC engine (i.e. FLUKA or SHIELD-HIT12A) is being used they provide information about expected executable filename, by inspecting the path to executable filename (i.e. checking if it ends with rfluka) we can find corresponding code type

executable_filename = None#
class pymchelper.executor.options.SH12AEnvironmentLinux[source]#

Bases: MCEnvironment

SHIELD-HIT12A Environment for Linux

executable_filename = 'shieldhit'#
simulator_type = 1#
class pymchelper.executor.options.SH12AEnvironmentWindows[source]#

Bases: MCEnvironment

SHIELD-HIT12A Environment for Windows

executable_filename = 'shieldhit.exe'#
simulator_type = 1#
class pymchelper.executor.options.SH12ASettings(input_path: str, simulator_type: SimulatorType | None = None, simulator_exec_path: str = None, cmdline_opts: str = None)[source]#

Bases: SimulationSettings

TODO

class pymchelper.executor.options.SimulationSettings(input_path: str, simulator_type: SimulatorType | None = None, simulator_exec_path: str = None, cmdline_opts: str = None)[source]#

Bases: object

This class is responsible for keeping track of options for MC simulation:
  • location of the MC simulator executable

  • additional options provided by the user

  • location of the input files or directories

Moreover this class performs automatic discovery of the MC input (i.e. whether this is SHIELD-HIT12A, Fluka or TOPAS input)

set_no_of_primaries(number_of_primaries)[source]#

This methods modifies command line options of the MC engine by setting (or overriding) the number of primaries to be simulated by each of the parallel jobs TODO this method is specific to SH12A, more general should be added TODO add support for no of primaries provided as –nstat, instead of -n

set_rng_seed(rng_seed)[source]#

This methods modifies command line options of the MC engine by setting (or overriding) the value of RNG seed TODO this method is specific to SH12A, more general should be added TODO add support for RNG seed provided as –seedofset, instead of -N

class pymchelper.executor.options.TopasEnvironment[source]#

Bases: MCEnvironment

TOPAS Environment

executable_filename = 'topas'#
simulator_type = 2#

pymchelper.executor.runner module#

class pymchelper.executor.runner.OutputDataType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: IntEnum

Output type requested by user plots (i.e .png) or text data

plot = 1#
txt = 2#
class pymchelper.executor.runner.Runner(settings: SimulationSettings, jobs: int = None, keep_workspace_after_run: bool = False, output_directory: str = '.')[source]#

Bases: object

Main class responsible for configuring and starting multiple parallel MC simulation processes It can be used to access combined averaged results of the simulation.

clean()[source]#

Removes all working directories (if exists)

get_data()[source]#

Scans the output directory for location of the working directories (like run_1, run_2). Takes all files from all working directories in output_dir, merges their content to form pymchelper Estimator objects. For each of the output file a single Estimator objects is created, which holds numpy arrays with results. Return dictionary with keys being output filenames, and values being Estimator objects

run()[source]#

Execute parallel simulation processes, creating workspace (and working directories) in the output_directory In case of successful execution return True, otherwise return False

class pymchelper.executor.runner.SingleSimulationExecutor[source]#

Bases: object

Callable class responsible for execution of the single MC simulation process.

class pymchelper.executor.runner.WorkspaceManager(output_directory='.', keep_workspace_after_run=False)[source]#

Bases: object

A workspace consists of multiple working directories (i.e. run_1, run_2), each per one of the parallel simulation run.

clean()[source]#

clean the workspace by removing all working directories (only if requested by keep_workspace_after_run flag)

create_working_directories(simulation_input_path, rng_seeds=())[source]#

Create working directories and fill self.working_directories_abs_paths

Module contents#