Runners for simulation software.#
Support module for running CORSIKA and sim_telarray.
corsika_runner#
Generate run scripts and directories for CORSIKA simulations.
- class runners.corsika_runner.CorsikaRunner(corsika_config, simtel_path, label=None, keep_seeds=False, use_multipipe=False)[source]#
Generate run scripts and directories for CORSIKA simulations. Run simulations if requested.
CorsikaRunner is responsible for configuring and running CORSIKA, using corsika_autoinputs provided by the sim_telarray package. CorsikaRunner generates shell scripts to be run externally or by the simulator module simulator.
CorsikaRunner is configured through a CorsikaConfig instance.
- Parameters:
- corsika_config_data: CorsikaConfig
CORSIKA configuration.
- simtel_path: str or Path
Location of source of the sim_telarray/CORSIKA package.
- label: str
Instance label.
- keep_seeds: bool
Use seeds based on run number and primary particle. If False, use sim_telarray seeds.
- use_multipipe: bool
Use multipipe to run CORSIKA and sim_telarray.
- get_file_name(simulation_software='corsika', file_type=None, run_number=None, mode='')[source]#
Get the full path of a file for a given run number.
- Parameters:
- simulation_software: str
Simulation software.
- file_type: str
File type.
- run_number: int
Run number.
- Returns:
- str
File name with full path.
- prepare_run_script(run_number=None, extra_commands=None, input_file=None, use_pfp=True)[source]#
Get the full path of the run script file for a given run number.
- Parameters:
- use_pfp: bool
Whether to use the preprocessor in preparing the CORSIKA input file
- run_number: int
Run number.
- extra_commands: str
Additional commands for running simulations.
- Returns:
- Path:
Full path of the run script file.
simtel_runner#
Base class for running sim_telarray simulations.
- exception runners.simtel_runner.SimtelExecutionError[source]#
Exception for simtel_array execution error.
- class runners.simtel_runner.SimtelRunner(simtel_path, label=None, corsika_config=None, use_multipipe=False)[source]#
Base class for running sim_telarray simulations.
- Parameters:
- simtel_path: str or Path
Location of sim_telarray installation.
- label: str
Instance label. Important for output file naming.
- static get_config_option(par, value=None, weak_option=False)[source]#
Build sim_telarray command.
- Parameters:
- par: str
Parameter name.
- value: str
Parameter value.
- weak_option: bool
If True, use -W option instead of -C.
- Returns:
- str
Command for sim_telarray.
- get_file_name(simulation_software='simtel', file_type=None, run_number=None, mode='')[source]#
Get the full path of a file for a given run number.
- Parameters:
- simulation_software: str
Simulation software.
- file_type: str
File type.
- run_number: int
Run number.
- Returns:
- str
File name with full path.
- prepare_run_script(test=False, input_file=None, run_number=None, extra_commands=None)[source]#
Build and return the full path of the bash run script containing the sim_telarray command.
- Parameters:
- test: bool
Test flag for faster execution.
- input_file: str or Path
Full path of the input CORSIKA file.
- run_number: int
Run number.
- extra_commands: str
Additional commands for running simulations given in config.yml.
- Returns:
- Path
Full path of the run script.
corsika_simtel_runner#
Run simulations with CORSIKA and pipe it to sim_telarray using the multipipe functionality.
- class runners.corsika_simtel_runner.CorsikaSimtelRunner(corsika_config, simtel_path, label=None, keep_seeds=False, use_multipipe=False, sim_telarray_seeds=None)[source]#
Run simulations with CORSIKA and pipe it to sim_telarray using the multipipe functionality.
Uses CorsikaConfig to manage the CORSIKA configuration and SimulatorArray for the sim_telarray configuration.
- Parameters:
- corsika_configCorsikaConfig
Configuration parameters for CORSIKA.
- simtel_pathstr or Path
Location of the sim_telarray package.
- labelstr
Label.
- keep_seedsbool
Use seeds based on run number and primary particle. If False, use sim_telarray seeds.
- use_multipipebool
Use multipipe to run CORSIKA and sim_telarray.
- get_file_name(simulation_software=None, file_type=None, run_number=None, mode=None)[source]#
Get the full path of a file for a given run number.
- Parameters:
- simulation_software: str
Simulation software.
- file_type: str
File type.
- run_number: int
Run number.
- Returns:
- str
File name with full path.
- prepare_run_script(run_number=None, input_file=None, extra_commands=None, use_pfp=False)[source]#
Get the full path of the run script file for a given run number.
- Parameters:
- run_number: int
Run number.
- use_pfp: bool
Whether to use the preprocessor in preparing the CORSIKA input file
- Returns:
- Path:
Full path of the run script file.
runner_services#
Base service methods for simulation runners.
- class runners.runner_services.RunnerServices(corsika_config, label=None)[source]#
Base services for simulation runners.
- Parameters:
- corsika_configCorsikaConfig
Configuration parameters for CORSIKA.
- labelstr
Label.
- get_file_name(file_type, run_number=None, mode=None)[source]#
Get a CORSIKA/sim_telarray style file name for various log and data file types.
- Parameters:
- file_typestr
The type of file (determines the file suffix).
- run_numberint
Run number.
- mode: str
out or err (optional, relevant only for sub_log).
- Returns:
- str
File name with full path.
- Raises:
- ValueError
If file_type is unknown.
- get_resources(run_number=None)[source]#
Read run time of job from last line of submission log file.
- Parameters:
- run_number: int
Run number.
- Returns:
- dict
run time and number of simulated events